Code Monkey home page Code Monkey logo

islam's Introduction

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 chrono::Local;
use islam::salah::{Config, Location, Madhab, Method, PrayerSchedule};

// https://www.mapcoordinates.net/en
let jakarta_city = Location::new(6.182_34_f32, 106.842_87_f32);
let config = Config::new().with(Method::Egyptian, Madhab::Shafi);
let prayer_times = PrayerSchedule::new(jakarta_city)?
    .on(Local::now().date_naive())
    .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

islam's People

Contributors

azzamsa avatar moanrisy avatar thechampagne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.