Skip to content
Rust Cratev1.xMIT License0+ downloads

Hijri: Hijri dates for Jiff

Turn any Jiff date into "1 Ramadan 1445" with HijriDate::from_gregorian(), do date math in Hijri months, and get the same results as the PHP Hijri package.

$cargo add pharaonic-hijri

Compatibility

Each line is released for the versions in its row, read from that release's composer.json. Pick the line that matches your project; a combination not listed isn't supported. Find the right line of every package for your project.

LineLatest releaseRustStatusDocs
v1.xv1.0.0 Dec 2, 20261.98+Current Docs: Read the v1.x docs

Maintenance

Latest release
v1.0.0
Dec 2, 2026 (13 hours ago)
Released lines
1
documented lines with a release; see compatibility
CI on develop
Tests running
latest run Dec 2, 2026

From the package's releases and its GitHub Actions. A passing run means the test suite passed on develop, on every PHP version it supports; it isn't a security review, and each release line has its own runs on GitHub. Checked hourly.

A quick look

Convert a date, move a month ahead, and format it in Arabic.

src/main.rs
1use jiff::civil::date;
2use pharaonic_hijri::{HijriDate, Language};
3 
4let ramadan = HijriDate::from_gregorian(date(2024, 3, 11))?;
5ramadan.to_string(); // "1445-09-01"
6 
7let eid = ramadan.checked_add_months(1)?;
8eid.to_gregorian()?; // 2024-04-10
9eid.strftime("%-d %B %Y", Language::Arabic)?; // "1 شوّال 1445"
Key Features

Everything you need to work with Hijri dates

One small value type, no global state, and no panics on your input.

Gregorian to Hijri

Pass a Jiff Date, DateTime or ZonedDateTime to HijriDate::from_gregorian().

Hijri to Gregorian

to_gregorian() returns a Jiff civil::Date, ready for times and time zones.

Hijri Date Math

checked_add_months(), days_until() and years_until() follow Hijri months and years.

strftime Formatting

Format with %d, %B, %Y and friends, and parse YYYY-MM-DD strings.

Arabic and English Months

Every month name in Arabic, or transliterated into English.

Day Adjustment

Match your local calendar with a Converter that shifts conversions by whole days.

FAQ

Hijri Questions

Quick answers about installing and using Hijri.

What is Hijri?

Hijri (Islamic) calendar dates for Rust, built on Jiff. Convert dates to Hijri and back, do Hijri date math, and format month names in Arabic or English. It's a free, open-source Rust crate by Pharaonic.

How do I install Hijri?

Run cargo add pharaonic-hijri in your project's root directory.

Which Rust version does it need?

The latest release requires Rust 1.98+. It also works with Jiff 1.x dates.

Which Cargo features does it have?

One, serde, off by default. It serializes a Hijri date as its YYYY-MM-DD string.

Why is the Hijri date one day off from my calendar?

The crate uses the tabular Hijri calendar with a default adjustment of one day back, like the PHP package. Use a Converter with the adjustment that matches the calendar announced where you live.

Does it give the same dates as the PHP Hijri package?

Yes. Both use the same calendar and the same default adjustment, and the crate's tests check thousands of dates against the PHP package.

Is Hijri free to use?

Yes. Hijri is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the Hijri documentation?

Read the Hijri documentation for conversion, date math, formatting, and examples. The API reference is on docs.rs.

How do I report a bug or contribute to Hijri?

Open an issue or a pull request on GitHub, ask in GitHub Discussions, or chat with us on Discord.

Ready to dig in?

Read the full documentation for installation, the day adjustment, conversions, Hijri date math, formatting, Cargo features, and the API reference.