{"id":2530,"library":"hijri-converter","title":"hijri-converter","description":"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`.","status":"deprecated","version":"2.3.2.post1","language":"python","source_language":"en","source_url":"https://github.com/dralshehri/hijridate","tags":["date","calendar","hijri","gregorian","islamic","conversion"],"install":[{"cmd":"pip install hijri-converter","lang":"bash","label":"Install `hijri-converter` (deprecated)"},{"cmd":"pip install hijridate","lang":"bash","label":"Install `hijridate` (recommended successor)"}],"dependencies":[{"reason":"Required runtime environment.","package":"Python","optional":false}],"imports":[{"note":"This is the correct import for the deprecated 'hijri-converter' package. For new projects, use 'from hijridate import Hijri, Gregorian' as the API is identical but the package name differs.","wrong":"from hijridate import Hijri, Gregorian","symbol":"Hijri, Gregorian","correct":"from hijri_converter import Hijri, Gregorian"}],"quickstart":{"code":"from hijri_converter import Hijri, Gregorian\n\n# Convert a Hijri date to Gregorian\nh_date = Hijri(1403, 2, 17)\ng_date = h_date.to_gregorian()\nprint(f\"Hijri 1403-02-17 is Gregorian: {g_date}\")\n\n# Convert a Gregorian date to Hijri\ng_date_input = Gregorian(1982, 12, 2)\nh_date_output = g_date_input.to_hijri()\nprint(f\"Gregorian 1982-12-02 is Hijri: {h_date_output}\")","lang":"python","description":"This example demonstrates how to convert dates between Hijri and Gregorian calendars using the `Hijri` and `Gregorian` classes. Both date systems allow conversion to the other."},"warnings":[{"fix":"Uninstall `hijri-converter` and install `hijridate`. The API remains identical, so import statements need to change from `from hijri_converter import ...` to `from hijridate import ...`.","message":"The `hijri-converter` package is officially deprecated and will not receive any further updates. Users are strongly advised to migrate to the `hijridate` package.","severity":"breaking","affected_versions":"All versions (from 2.3.2.post1 onwards)"},{"fix":"Ensure input dates fall within the supported range. For dates outside this range, alternative conversion methods or libraries may be required.","message":"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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For religious observances, always consult local religious authorities or confirmed moon sighting announcements rather than relying solely on programmatic conversion.","message":"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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2.3.2':51 'accur':13 'activ':58 'al':27 'al-qura':26 'base':22 'calendar':29,69 'continu':65 'convers':14,35,73 'convert':3,6 'current':48 'date':20,34,68 'deprec':40 'design':11 'develop':62 'favor':42 'featur':36 'futur':61 'gregorian':19,71 'hijri':2,5,16,70 'hijri-convert':1,4 'hijrid':45,67 'islam':17,72 'longer':57 'maintain':59 'packag':10,46 'post1':52 'primarili':21 'provid':32 'python':9 'qura':28 'robust':33 'support':64 'umm':25 'version':49","created_at":"2026-04-11T01:32:00.259405+00:00","updated_at":"2026-04-16T15:34:12.125483+00:00","problems":[{"fix":"Ensure the package is correctly installed using pip: `pip install hijri-converter` or, if already installed, check your virtual environment or Python path. Sometimes, the installed package name on the file system might differ from the import name (though less common for this specific package, it's a general troubleshooting step for ModuleNotFoundError).","cause":"The Python interpreter cannot find the 'hijri_converter' package, likely because it was not installed, installed incorrectly, or there's a typo in the import statement.","error":"ModuleNotFoundError: No module named 'hijri_converter'"},{"fix":"Import the `Hijri` and `Gregorian` classes directly from the package: `from hijri_converter import Hijri, Gregorian`. Then use them as `Hijri(year, month, day)` or `Gregorian(year, month, day)`.","cause":"This error occurs when a user tries to access `convert.Hijri` or `convert.Gregorian` after importing `from hijri_converter import convert`. The `Hijri` and `Gregorian` classes are directly available from the `hijri_converter` module, not nested under a 'convert' object.","error":"AttributeError: module 'hijri_converter' has no attribute 'convert'"},{"fix":"Provide a valid day number for the specified month and year according to the Umm al-Qura calendar. You may need to cross-reference with an accurate Hijri calendar or ensure your input data respects the calendar's rules. The library includes date validation by default; for example, `Hijri(1433, 12, 30)` would fail if Dhu al-Hijjah 1433 AH only had 29 days.","cause":"This error indicates that an invalid day was provided for a given month in the Hijri date conversion. The Umm al-Qura calendar, which `hijri-converter` is based on, has specific month lengths (29 or 30 days) that are strictly validated.","error":"ValueError: day must be in 1..29 for month (or 1..30)"},{"fix":"Ensure that date components (year, month, day) extracted from strings are converted to integers before being passed to the `Hijri` or `Gregorian` class constructors. For example, if `yr_str`, `mth_str`, `day_str` are strings, use `Hijri(int(yr_str), int(mth_str), int(day_str))`.","cause":"This error often occurs when attempting to call a string variable as if it were a function, especially in older Python 2 code or when mixing string manipulation with object instantiation. In the context of date conversion, it might stem from incorrectly parsing date components from a string and then trying to use those string components directly as callable objects instead of arguments to the date constructor.","error":"TypeError: 'unicode' object is not callable"},{"fix":"Migrate your project to use the `hijridate` package. Install it with `pip install hijridate` and update your import statements from `from hijri_converter import Hijri, Gregorian` to `from hijridate import Hijri, Gregorian`. The API remains largely identical.","cause":"The `hijri-converter` package is no longer actively maintained and has been superseded by the `hijridate` package. While not a runtime error, continued use may lead to unaddressed bugs or lack of compatibility with newer Python versions and operating systems.","error":"hijri-converter is deprecated"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.3.2.post1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/hijri-converter/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}