14 releases (8 stable)

4.0.2 Aug 9, 2024
3.2.0 Sep 3, 2023
2.0.0 Jun 22, 2023
1.0.0 Jan 22, 2023
0.1.3 Apr 22, 2021

#123 in Date and time

Download history 1/week @ 2024-06-28 37/week @ 2024-07-05 5/week @ 2024-07-26 211/week @ 2024-08-02 167/week @ 2024-08-09 7/week @ 2024-08-16 4/week @ 2024-08-23 9/week @ 2024-08-30 2/week @ 2024-09-06 29/week @ 2024-09-13 38/week @ 2024-09-20 29/week @ 2024-09-27 2/week @ 2024-10-04 3/week @ 2024-10-11

74 downloads per month
Used in bilal

GPL-3.0-only

49KB
1K SLoC

islam


islam is an Islamic library for Rust. It is a direct port of PyIslam with a slight change in the API part.

Why?

I have always got panic! working with salah. Previously, I have a good experience with PyIslam. In my case, it is very precise and has a simple algorithm. Nowadays, I work a lot with Rust. So here it is, islam is born!

Features

  • Hijri date
  • Prayer times

Usage

Getting Prayer Times

use islam::salah::{Config, Location, Madhab, Method, PrayerSchedule};

let central_jakarta = Location::new(6.1, 106.49);
let config = Config::new().with(Method::Singapore, Madhab::Shafi);
let prayer_times = PrayerSchedule::new(central_jakarta)?
    .with_config(config)
    .calculate()?;

First, you need to specify Location with latitude, and longitude as parameters. Then choose a calculation method such Singapore. Other methods are available in the docs. There are also madhab configurations that you can choose from.

Getting Hijri Date

let date = NaiveDate::from_ymd_opt(2021, 4, 9)
let from_gregorian = HijriDate::from_gregorian(date, 0);
println!(
    "From gregorian: {}-{}-{}",
    from_gregorian.year, from_gregorian.month, from_gregorian.day,
);

from_gregorian accepts Date and correction value as parameters.

More Examples

To learn more, see other examples.

Acknowledgement

The calculation part of this library is a direct port of PyIslam with a slight change in the API part. The API took inspiration from salah

Dependencies

~3MB
~50K SLoC