Registry / serialization / pycalverter

pycalverter

JSON →
library1.6.1pypypi✓ verified 82d ago

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.

pip install pycalverter
INSTALL
IMPORT
SIG · PYCALVERTER
P
pycalverter
serializationpythonv1.6.1
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.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.000s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

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

Calverter
from calverter import Calverter
from pycalverter import CalendarConverter

Initialize a CalendarConverter, use to_jdn/from_jdn for conversions. Supported calendars: GREGORIAN, JULIAN, ISLAMIC, HEBREW, PERSIAN, INDIAN_CIVIL, BAHAI, etc.

from pycalverter import CalendarConverter # Convert Gregorian date to Julian Day Number conv = CalendarConverter() jdn = conv.to_jdn(2025, 5, 1, 'GREGORIAN') print(jdn) # e.g. 2460783 # Convert from Julian Day Number to Islamic date year, month, day = conv.from_jdn(jdn, 'ISLAMIC') print(f"Islamic: {year}-{month}-{day}")
Debug
Known issues
gotchaCalendar converter instances are stateful: calling to_jdn multiple times with different calendars will reuse internal state, causing incorrect results. Reinitialize or use separate instances.
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.
affects: all
gotchaCalendar names are case-sensitive and must be exactly as defined (e.g., 'GREGORIAN', 'ISLAMIC'). Wrong casing leads to KeyError.
fix
Use uppercase strings exactly: 'GREGORIAN', 'JULIAN', 'ISLAMIC', 'HEBREW', 'PERSIAN', 'INDIAN_CIVIL', 'BAHAI'.
affects: all
breakingIn 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.
fix
Use conv = CalendarConverter() and specify calendar in to_jdn and from_jdn: conv.to_jdn(year, month, day, 'GREGORIAN')
affects: >=1.6.0
Upgrade
Version history
1.6.1latest on PyPI · released Jun 11, 2011
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
pycalverter — pip install pycalverter · libregistry