Skip to content

Correct Indian Civil leap-month lengths - #71

Open
antonsoo wants to merge 1 commit into
fitnr:masterfrom
antonsoo:fix/indian-civil-month-length
Open

antonsoo wants to merge 1 commit into
fitnr:masterfrom
antonsoo:fix/indian-civil-month-length

Conversation

@antonsoo

Copy link
Copy Markdown

indian_civil.month_length() subtracts 78 from the Saka year when checking for a Gregorian leap year. The corresponding Gregorian year is the Saka year plus 78, as already used by to_jd().

This makes Chaitra one day too short in Saka 1978 (Gregorian 2056) and one day too long in Saka 2022 (Gregorian 2100), including calendars returned by monthcalendar(). Correct the offset and add century-related regressions for month lengths, generated days and conversion boundaries. This follows section 5.1 of the Explanatory Supplement's calendar chapter.

All 147 tests pass with make cov on Python 3.10, 3.12 and 3.14; make pylint passes. A complete 400-year calendar-generation check agrees with the published civil-calendar rules, with all existing conversions and the other months unchanged.

The datetime conversion fix is independent; I can combine the changes if preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant