Repository navigation
Fix month lengths for lunar years 1933, 1954 and 1978 - #25
Merged
lidaobing merged 1 commit intoNov 22, 2026
Merged
Conversation
Three entries in yearInfos disagree with the Hong Kong Observatory conversion tables, so 30 days in each of those years are converted one day off: - 1933: the leap 5th month has 30 days and the 6th month 29 (0x06e95 -> 0x16a95; HKO: 6th month starts 1933-07-23) - 1954: the 10th month has 29 days (0x0a5d0 -> 0x0a5b0; HKO: 11th month starts 1954-11-25) - 1978: the 7th month has 30 days and the 8th month 29 (0x0b5a0 -> 0x0b6a0; HKO: 8th month starts 1978-09-03) With these, every day from 1901 to 2099 matches the HKO tables.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the lunar month-length corrections and accompanying regression doctests.
No open issues 🎉
What changed in this PR
Corrects lunar month-length data for 1933, 1954, and 1978 to align date conversions with the Hong Kong Observatory tables.
Changes:
- Updates three
yearInfosentries while preserving total year lengths. - Adds five doctests covering affected dates, including leap-month and month-start boundaries.
| File | Description |
|---|---|
lunardate.py |
Corrects the three year entries and adds regression doctests for solar/lunar conversions. |
Review effort: Balanced
lidaobing
approved these changes
Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three entries in
yearInfosdon't match the Hong Kong Observatory conversion tables, so 30 days in each of these years come out one day off:0x06e950x16a950x0a5d00x0a5b00x0b5a00x0b6a0The year lengths don't change, so nothing outside those 30-day windows moves. The fixed values are the same ones used in other tables (e.g. calendar.js and overtrue/chinese-calendar).
How I checked: compared every day from 1901 to 2099 (72,684 days, plus every month start and leap month) against the HKO tables (
https://www.hko.gov.hk/en/gts/time/calendar/text/files/T1954e.txtetc.). Before this change, only these three years differ; after it, none do.Added doctests for the three years (5 of them fail before the fix).
python lunardate.py -vpasses,mypy lunardate.pyand the CI flake8 check are clean.