Registry / serialization / hijridate

hijridate

JSON →
library2.6.0pypypi✓ verified 23d ago

A Python package for accurate Hijri-Gregorian date conversion based on the Umm al-Qura calendar. It offers reliable date conversion, optimized performance, and multilingual support. The current version is 2.6.0 and it is actively maintained with a regular release cadence, including support for new Python versions.

pip install hijridate
INSTALL
IMPORT
SIG · HIJRIDATE
H
hijridate
serializationpythonv2.6.0
Install
1.6s avg
Import
16ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.018s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.014s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Hijri
from hijridate import Hijri
from hijri_converter import Hijri
The package was renamed from `hijri-converter` to `hijridate` in v2.3.0.
Gregorian
from hijridate import Gregorian
from hijri_converter import Gregorian
The package was renamed from `hijri-converter` to `hijridate` in v2.3.0.

Initialize `Hijri` or `Gregorian` objects and use their `to_gregorian()` or `to_hijri()` methods for conversion. The `Hijri.today()` class method provides the current Hijri date.

from hijridate import Hijri, Gregorian # Convert a Hijri date to Gregorian hijri_date = Hijri(1445, 6, 15) gregorian_date = hijri_date.to_gregorian() print(f"Hijri {hijri_date} is Gregorian {gregorian_date}") # Convert a Gregorian date to Hijri gregorian_date = Gregorian(2023, 12, 28) hijri_date_converted = gregorian_date.to_hijri() print(f"Gregorian {gregorian_date} is Hijri {hijri_date_converted}") # Get today's Hijri date today_hijri = Hijri.today() print(f"Today's Hijri date: {today_hijri}")
Debug
Known issues
breakingThe package was renamed from `hijri-converter` to `hijridate` in version 2.3.0.
fix
Update your `pip install` command to `pip install hijridate` and modify all import statements from `from hijri_converter import ...` to `from hijridate import ...`.
affects: >=2.3.0
breakingSupport for Python 3.8 and 3.9 was dropped in `hijridate` v2.6.0. Python 3.7 support was dropped in v2.4.0, and Python 3.6 in v2.3.0.
fix
Upgrade your Python environment to 3.10 or newer for `hijridate` versions 2.6.0 and above. For earlier `hijridate` versions, ensure you meet their specific Python requirements (e.g., Python 3.8+ for v2.5.0).
affects: >=2.3.0
breakingThe `validate` argument for `Hijri` and `Gregorian` object instantiation, and the `padding` argument for `dmyformat()` functions, became keyword-only arguments in v2.5.0.
fix
When instantiating `Hijri` or `Gregorian` objects (e.g., `Hijri(1445, 6, 15, validate=True)`) or calling `dmyformat()` (e.g., `date_obj.dmyformat(padding=False)`), use keyword arguments for these parameters instead of positional ones.
affects: >=2.5.0
breakingThe `slashformat()` method was removed from `Hijri` and `Gregorian` classes in v2.2.0.
fix
Replace calls to `date_obj.slashformat()` with `date_obj.dmyformat(separator='/')` to achieve the same formatting.
affects: >=2.2.0
gotchaThe converter supports dates only within the range 1343 AH to 1500 AH (1 August 1924 CE to 16 November 2077 CE) due to limitations of the official Umm al-Qura calendar sources. It is also not intended for religious purposes where lunar crescent sighting is preferred over astronomical calculations.
fix
Users should be aware of the supported date range and the library's intended use. For dates outside this range or for religious sighting, alternative solutions may be required.
affects: All versions
Errors
Common errors & fixes
TypeError: an integer is required (got type datetime.datetime)
The `hijridate.Gregorian` class constructor expects year, month, and day as separate integer arguments, not a `datetime.datetime` object directly.
fix
Pass the year, month, and day as individual integers, or use the `Gregorian.fromdate()` class method if you have a `datetime.date` or `datetime.datetime` object.
ModuleNotFoundError: No module named 'hijri_converter'
Users are attempting to import from an older, deprecated package name (`hijri_converter`) instead of the current `hijridate` package. The package was renamed for the current version.
fix
Install the correct package (`pip install hijridate`) and import from `hijridate`.
Hijri Date incorrect (off by one day)
Discrepancies in Hijri date conversions often arise due to different calculation methods (e.g., Umm al-Qura vs. lunar sighting) or timezone considerations. The `hijridate` library is based on the Umm al-Qura calendar.
fix
Ensure you understand that `hijridate` strictly follows the Umm al-Qura calendar. If your expected date differs by a day, it's likely due to a different calendar standard or a local adjustment for moon sightings. The library's calculations are accurate according to its specified calendar system.
Upgrade
Version history
2.6.0latest on PyPI · released Jan 6, 2026
Audit
Dependencies
pythonrequiredRuntime environment. Minimum Python 3.10 is required for version 2.6.0.
Agent activity
9 hits · last 30 days
node
8
Resources
hijridate — pip install hijridate · libregistry