{"id":24304,"library":"pycalverter","title":"PyCalverter","description":"PyCalverter is a Python library for converting between various calendar systems, including Gregorian, Julian, Islamic, Hebrew, Persian, Indian civil, Baháʼí, and more. Version 1.6.1 is the current release, with intermittent updates.","status":"active","version":"1.6.1","language":"python","source_language":"en","source_url":"https://github.com/niccokunzmann/pycalverter","tags":["calendar","conversion","date","gregorian","islamic","hebrew","persian"],"install":[{"cmd":"pip install pycalverter","lang":"bash","label":"Latest release"}],"dependencies":[],"imports":[{"note":"The class is not directly at the top level; you need to import CalendarConverter explicitly.","wrong":"import pycalverter","symbol":"CalendarConverter","correct":"from pycalverter import CalendarConverter"},{"note":"Calendar constants are also available from the package.","symbol":"JULIAN","correct":"from pycalverter import JULIAN"}],"quickstart":{"code":"from pycalverter import CalendarConverter\n\n# Convert Gregorian date to Julian Day Number\nconv = CalendarConverter()\njdn = conv.to_jdn(2025, 5, 1, 'GREGORIAN')\nprint(jdn)  # e.g. 2460783\n\n# Convert from Julian Day Number to Islamic date\nyear, month, day = conv.from_jdn(jdn, 'ISLAMIC')\nprint(f\"Islamic: {year}-{month}-{day}\")","lang":"python","description":"Initialize a CalendarConverter, use to_jdn/from_jdn for conversions. Supported calendars: GREGORIAN, JULIAN, ISLAMIC, HEBREW, PERSIAN, INDIAN_CIVIL, BAHAI, etc."},"warnings":[{"fix":"Create a new CalendarConverter for each conversion or use the module-level functions if available (but there are none). Safer: conv = CalendarConverter(...) per call.","message":"Calendar converter instances are stateful: calling to_jdn multiple times with different calendars will reuse internal state, causing incorrect results. Reinitialize or use separate instances.","severity":"gotcha","affected_versions":"all"},{"fix":"Use uppercase strings exactly: 'GREGORIAN', 'JULIAN', 'ISLAMIC', 'HEBREW', 'PERSIAN', 'INDIAN_CIVIL', 'BAHAI'.","message":"Calendar names are case-sensitive and must be exactly as defined (e.g., 'GREGORIAN', 'ISLAMIC'). Wrong casing leads to KeyError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use conv = CalendarConverter() and specify calendar in to_jdn and from_jdn: conv.to_jdn(year, month, day, 'GREGORIAN')","message":"In version 1.6.0, the API changed: CalendarConverter initialization no longer accepts a calendar argument; it is now passed to the conversion methods. Older code using conv = CalendarConverter('GREGORIAN') will break.","severity":"breaking","affected_versions":">=1.6.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install pycalverter' in the active Python environment.","cause":"Library not installed or installed in incorrect environment.","error":"ModuleNotFoundError: No module named 'pycalverter'"},{"fix":"Use exactly 'GREGORIAN', 'JULIAN', 'ISLAMIC', 'HEBREW', 'PERSIAN', 'INDIAN_CIVIL', 'BAHAI'. Check spelling and caps.","cause":"Using wrong case for calendar name or calendar not supported.","error":"KeyError: 'GREGORIAN'"},{"fix":"Use 'from pycalverter import CalendarConverter'.","cause":"Trying to import CalendarConverter incorrectly (e.g., import pycalverter then pycalverter.CalendarConverter).","error":"AttributeError: module 'pycalverter' has no attribute 'CalendarConverter'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}