HijriDate-rs
Convert between hijri and gregorian date. (with wasm target)
Limits
The algorithm used has the following limits:
Minimum | Maximum | |
---|---|---|
Hijri | 1356 | 1499 |
Gregorian | 1938 | 2076 |
Minimum Rust version
From version 0.4.0
and onwards the MSRV is 1.51
Usage
Conversion
- Hijri → Gregorian
use HijriDate;
let hd = from_hijri;
assert_eq!;
- Gregorian → Hijri
use HijriDate;
let hd = from_gr;
assert_eq!;
Comparison
use HijriDate;
let hd_1 = from_hijri;
let hd_2 = from_hijri;
assert!;
Misc
- Subtract duration from a day
use ;
let hd_1 = from_hijri;
let hd_2 = from_hijri;
assert_eq!;
- Subtract a day from another to get a duration
use ;
let hd_1 = from_hijri;
let hd_2 = from_hijri;
assert_eq!;
Formatting
- Hijri day and month name
use HijriDate;
let hd = from_hijri;
println!;
- Formatting guide
hijri
%Y hijri_year
%m hijri_month
%d hijri_day
%D hijri_day_name
%M hijri_month_name
%l hijri_month_len
gregorian
%gY gregorian_year
%gm gregorian_month
%gd gregorian_day
%gD gregorian_day_name
%gM gregorian_month_name
Wasm
To compile to Wasm run:
cargo build --release --target wasm32-unknown-unknown
Deno bindings are exposed, see ./deno
for more info
Credits
I translated Tytkal's Python library to Rust.
-
Original algorithm author
Suhail Alkowaileet
-
Python version author
Khalid Al-hussayen