Registry / serialization / convertdate

convertdate

JSON →
library2.4.1pypypi✓ verified 26d ago

The `convertdate` library provides methods and functions for converting dates between various calendar systems, including Gregorian, Hebrew, Islamic, Julian, Mayan, and many others. It is currently at version 2.4.1 and sees a few releases per year, indicating active development.

pip install convertdate
INSTALL
IMPORT
SIG · CONVERTDATE
C
convertdate
serializationpythonv2.4.1
Install
3.2s avg
Import
136ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.4.1 · 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.142s · 23.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.2s · import 0.130s · 24MB
22MB installed
● package 22MB
Code
Verified usage

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

french_republican
from convertdate import french_republican
hebrew
from convertdate import hebrew
julian
from convertdate import julian
holidays
from convertdate import holidays
For calculating holidays in various systems.

Demonstrates converting Gregorian dates to French Republican and Hebrew calendars, and generating a Julian month calendar.

from convertdate import french_republican from convertdate import hebrew from convertdate import julian # Convert Gregorian date to French Republican fr_date = french_republican.from_gregorian(2014, 10, 31) print(f"Gregorian 2014-10-31 in French Republican: {fr_date}") # Convert Gregorian date to Hebrew he_date = hebrew.from_gregorian(2014, 10, 31) print(f"Gregorian 2014-10-31 in Hebrew: {he_date}") # Generate a Julian month calendar for January 2015 julian_month_calendar = julian.monthcalendar(2015, 1) print(f"Julian calendar for Jan 2015: {julian_month_calendar}")
Debug
Known issues
breakingPython 3.5 and 3.6 are no longer supported. Ensure your environment uses Python 3.7 or newer.
fix
Upgrade your Python interpreter to version 3.7 or higher.
affects: >=2.4.0
breakingTimezone handling internally switched from `pytz.utc` to `datetime.timezone.utc`. While direct `pytz` interaction might not be common, be aware of this change if you were relying on specific `pytz` behaviors or objects interacting with `convertdate`.
fix
Review any code that might interact with `convertdate`'s internal timezone handling or if you pass `pytz` objects directly, and adapt to use `datetime.timezone.utc` where appropriate.
affects: >=2.4.0
breakingThe Persian calendar computation method changed from an algorithmic to an astronomical one. This might lead to different results for dates compared to previous versions.
fix
Verify calculations for Persian dates after upgrading, especially for historical or sensitive applications.
affects: >=2.3.2
breakingAttempting to convert dates before the Mayan epoch will now raise a `ValueError` instead of potentially returning incorrect or undefined results.
fix
Ensure that inputs for Mayan calendar conversions are within the valid epoch or handle `ValueError` exceptions.
affects: >=2.3.2
breakingSeveral calendar modules had their variable names regularized (e.g., `coptic.MONTH_NAMES` was renamed to `coptic.MONTHS`). Code accessing the old variable names will no longer function.
fix
Update your code to use the new variable names as specified in the changelog (e.g., `coptic.MONTHS` instead of `coptic.MONTH_NAMES`).
affects: >=2.3.0
breakingThe Julian converter now uses astronomical notation for pre-Common Era dates (1 BCE is 0, 2 BCE is -1). This is a fundamental change in date representation for these periods.
fix
Review and update any logic handling pre-Common Era Julian dates to align with the astronomical notation.
affects: >=2.0.3
gotchaDate conversions return results for noon of the day in question. Be aware that some calendar systems begin the day at sundown, which might require an adjustment in your application logic.
fix
Account for the 'noon-of-the-day' convention if your application requires precision for dates that begin at sundown in certain calendar systems.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'convertdate'
The `convertdate` library is not installed in your Python environment or the environment where you are running your code.
fix
Install the `convertdate` library using pip: `pip install convertdate`
ERROR: convertdate 2.2.0 has requirement pytz<2020,>=2014.10, but you'll have pytz 2020.1 which is incompatible.
This error occurs due to a dependency conflict where an older version of `convertdate` requires a `pytz` version older than what is currently installed or being installed.
fix
Upgrade `convertdate` to a newer version that supports the `pytz` version you have (or a more recent one), or try installing `convertdate` with a compatible `pytz` version if an older `convertdate` is strictly necessary. Often, updating `convertdate` resolves this: `pip install --upgrade convertdate`
ValueError: time data '2023-13-01' does not match format '%Y-%m-%d'
This error typically happens when you are trying to convert a date string to a datetime object using `datetime.strptime()`, but the format string provided does not exactly match the input date string's structure or the date components (like month 13) are invalid.
fix
Ensure the format string passed to `strptime()` precisely matches the input date string. If the date components are invalid, correct the input date. For `convertdate`, ensure you pass valid integer year, month, and day components after successful parsing. Example: `from datetime import datetime; date_str = '2023-12-01'; dt_obj = datetime.strptime(date_str, '%Y-%m-%d'); from convertdate import gregorian; gregorian.to_jd(dt_obj.year, dt_obj.month, dt_obj.day)`
AttributeError: module 'datetime' has no attribute 'strptime'
This error occurs when you import the `datetime` module but then try to call `strptime()` directly on the module itself (`datetime.strptime`) instead of on the `datetime` class within the module (`datetime.datetime.strptime`).
fix
You should either import `datetime` as `dt` and use `dt.datetime.strptime()`, or directly import the `datetime` class as `from datetime import datetime` and then use `datetime.strptime()`: `from datetime import datetime; date_object = datetime.strptime('2023-01-01', '%Y-%m-%d')`
Upgrade
Version history
2.4.1latest on PyPI · released Feb 8, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
convertdate — pip install convertdate · libregistry