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 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

Usage

Getting Prayer Times

rust // https://www.mapcoordinates.net/en let jakarta_city = Location::new(6.182_34_f32, 106.842_87_f32); let today = NaiveDateTime::now_local()?.date(); let config = Config::new().with(Method::Singapore, Madhab::Shafi); let prayer_times = PrayerSchedule::new(jakarta_city)? .on(today) .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 available in the docs. There are also madhab configurations that you can choose from.

Getting Hijri Date

rust let from_gregorian = HijriDate::from_gregorian(date!(2021 - 4 - 9), 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