Registry / data / jdcal
library1.4.1pypypi✓ verified 23d ago

jdcal is a Python module designed for converting between Julian dates and calendar dates, supporting both proleptic Gregorian and Julian calendars. It enhances precision by storing Julian dates as a pair of floating-point numbers. The library provides functions for conversions in both directions (e.g., `gcal2jd` for Gregorian to Julian Date, and `jd2gcal` for the reverse). The current version is 1.4.1, with its last update in April 2019, suggesting a maintenance-focused release cadence.

pip install jdcal
INSTALL
IMPORT
SIG · JDCAL
J
jdcal
datapythonv1.4.1
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.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.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

gcal2jd
from jdcal import gcal2jd
jd2gcal
from jdcal import jd2gcal
jcal2jd
from jdcal import jcal2jd
jd2jcal
from jdcal import jd2jcal

This example demonstrates how to convert a Gregorian date to a Julian date using `gcal2jd` and then convert it back to a Gregorian date using `jd2gcal`.

from jdcal import gcal2jd, jd2gcal # Convert Gregorian date to Julian date year, month, day = 2000, 1, 1 jd1, jd2 = gcal2jd(year, month, day) print(f"Gregorian {year}-{month}-{day} is Julian Date: {jd1} + {jd2} = {jd1 + jd2}") # Convert Julian date back to Gregorian date g_year, g_month, g_day, g_fraction = jd2gcal(jd1, jd2) print(f"Julian Date {jd1} + {jd2} converts to Gregorian: {g_year}-{g_month}-{g_day} (fraction: {g_fraction})")
Debug
Known issues
gotchaJulian dates are returned and expected as two separate floating-point numbers (jd1, jd2) to maintain maximum precision. Always handle both components for calculations.
fix
Always pass and receive Julian dates as a tuple of two floats. For the full Julian date, sum `jd1 + jd2`.
affects: All versions
gotchaThe library uses 'proleptic' calendars, meaning Gregorian and Julian calendar rules are applied to dates even before their historical adoption. This may not align with historical calendar usage in specific regions.
fix
Be aware that conversions for dates far in the past apply modern calendar rules. For historical accuracy, external logic might be needed to determine the correct calendar system for a given date.
affects: All versions
breakingInstallation of `jdcal==1.0` via `pip` was problematic due to a missing `LICENSE.txt` file in the PyPI tarball, leading to installation failures.
fix
Avoid installing version 1.0 directly. Use the latest stable version (`pip install jdcal`) or a version greater than 1.0.
affects: 1.0
gotchaOlder versions of `openpyxl` (a dependency of `jdcal` for some users, but not a direct dependency *of* `jdcal`) had integration issues leading to `ImportError` if `jdcal` was not installed or if installation order was incorrect.
fix
Ensure `jdcal` is installed before `openpyxl` if using older versions of `openpyxl` that explicitly relied on it, or upgrade `openpyxl` to a newer version where this is less of an issue. `jdcal` itself does not have a dependency on `openpyxl`.
affects: < 2.5 of `openpyxl` (and implicitly `jdcal` when used with it)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'jdcal'
The 'jdcal' library is not installed in your Python environment or is not accessible via your Python path.
fix
Install the jdcal package using pip: `pip install jdcal`
TypeError: gcal2jd() missing 2 required positional arguments: 'month' and 'day'
The `gcal2jd` function requires three integer arguments: year, month, and day. This error occurs when insufficient arguments are provided.
fix
Provide all three required integer arguments for year, month, and day: `jdcal.gcal2jd(2023, 10, 26)`
AttributeError: module 'jdcal' has no attribute 'gcaltojd'
This error typically occurs when attempting to call a function or access an attribute that does not exist or is misspelled within the `jdcal` module.
fix
Ensure you are using the correct function name, `gcal2jd`, for converting Gregorian calendar dates to Julian dates: `jdcal.gcal2jd(2023, 10, 26)`
TypeError: jd2gcal() missing 1 required positional argument: 'jd2'
The `jd2gcal` function expects two floating-point numbers representing the Julian date (jd1 and jd2) to maintain precision. This error occurs when only one argument is provided.
fix
Provide both Julian date components: `jdcal.jd2gcal(2400000.5, 59198.0)`
Upgrade
Version history
1.4.1latest on PyPI · released Apr 24, 2019
Audit
Dependencies

No dependency data recorded yet.

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