{"id":21477,"library":"jalali-core","title":"jalali-core","description":"A Python library for converting between Gregorian and Jalali (Persian/Solar Hijri) dates, targeting Python 3.8+. Version 1.0.0 is the first stable release, with a focus on simplicity and correctness. The library provides a single core function for conversion and is designed to be lightweight with no external dependencies. Release cadence is not yet established.","status":"active","version":"1.0.0","language":"python","source_language":"en","source_url":"https://github.com/slashmili/jalali-core","tags":["jalali","persian","date-conversion","calendar","gregorian"],"install":[{"cmd":"pip install jalali-core","lang":"bash","label":"pip"}],"dependencies":[],"imports":[{"note":"Wrong: module not imported correctly. Use from import.","wrong":"import jalali_core","symbol":"GregorianToJalali","correct":"from jalali_core import GregorianToJalali"},{"wrong":"","symbol":"JalaliToGregorian","correct":"from jalali_core import JalaliToGregorian"}],"quickstart":{"code":"from jalali_core import GregorianToJalali, JalaliToGregorian\nimport datetime\n\ng2j = GregorianToJalali()\ngregorian_date = datetime.date(2025, 4, 27)\njalali_date = g2j(gregorian_date)\nprint(f\"Gregorian {gregorian_date} -> Jalali {jalali_date}\")\n\nj2g = JalaliToGregorian()\njalali_date = (1404, 2, 7)\ngregorian_date = j2g(jalali_date)\nprint(f\"Jalali {jalali_date} -> Gregorian {gregorian_date}\")","lang":"python","description":"Basic conversion between Gregorian and Jalali dates."},"warnings":[{"fix":"Ensure Jalali years are positive (>= 1).","message":"Jalali year zero does not exist. The library expects years in the usual Jalali calendar with 1-based years (e.g., 1404). Do not pass year 0.","severity":"gotcha","affected_versions":"1.0.0"},{"fix":"Validate Jalali dates yourself before conversion (e.g., month 1-12, day according to month).","message":"Input dates must be valid. The library does not validate Jalali dates; passing invalid dates (e.g., month 13) may produce incorrect results or raise exceptions.","severity":"gotcha","affected_versions":"1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with `pip install jalali-core`, then import as `from jalali_core import ...`.","cause":"Wrong import path: some may try 'import jalali' or 'import jalali_core' but the package name is 'jalali-core' (with hyphen) and module is 'jalali_core'.","error":"ModuleNotFoundError: No module named 'jalali_core'"},{"fix":"Use `JalaliToGregorian()( (year, month, day) )` with a tuple argument.","cause":"Passing a single datetime.date object to JalaliToGregorian instead of a tuple (year, month, day).","error":"TypeError: cannot unpack non-iterable datetime.date object"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}