hijri-converter
hijri-converter is a Python package designed for accurate conversions between Hijri (Islamic) and Gregorian dates, primarily based on the Umm al-Qura calendar. While it provided robust date conversion features, it is now deprecated in favor of the `hijridate` package. The current version is 2.3.2.post1, and it is no longer actively maintained, with future development and support continuing under `hijridate`.
Warnings
- breaking The `hijri-converter` package is officially deprecated and will not receive any further updates. Users are strongly advised to migrate to the `hijridate` package.
- gotcha The converter has a limited date range, supporting dates from 1343 AH to 1500 AH (approximately August 1, 1924 CE to November 16, 2077 CE). Dates outside this range may not be converted accurately or may raise errors.
- gotcha The conversion is based on astronomical calculations for the Umm al-Qura calendar and is not intended for religious purposes where the sighting of the lunar crescent is preferred for determining the start of Hijri months. Local moon sighting can cause a one-day difference.
Install
-
pip install hijri-converter -
pip install hijridate
Imports
- Hijri, Gregorian
from hijri_converter import Hijri, Gregorian
Quickstart
from hijri_converter import Hijri, Gregorian
# Convert a Hijri date to Gregorian
h_date = Hijri(1403, 2, 17)
g_date = h_date.to_gregorian()
print(f"Hijri 1403-02-17 is Gregorian: {g_date}")
# Convert a Gregorian date to Hijri
g_date_input = Gregorian(1982, 12, 2)
h_date_output = g_date_input.to_hijri()
print(f"Gregorian 1982-12-02 is Hijri: {h_date_output}")