Repository navigation
EthiopianDateParser: use the computed Gregorian month for the year-offset branch - #849
ManasBagul23 wants to merge 1 commit into
Conversation
…ian input month, for the year-offset branch geezToGregorianDateConverter implements the standard Julian-Day-Number-to- Gregorian conversion (Fliegel & Van Flandern). That algorithm's year-offset step branches on the *computed Gregorian* month (year = C-4715 when the Gregorian month is January/February, else C-4716) -- it has nothing to do with which calendar the input date was in. The code branched on `month`, the Ethiopian input month, instead of the `gregorianMonth` value it had already computed two lines above. Ethiopian months 1-2 (Meskerem/Tikimt, ~September/October) and 5-6 (Tir/Yekatit, ~January/February) straddle the Gregorian year boundary in the opposite sense from their own month numbers, so exactly those months hit the wrong branch: - Ethiopian month 1 or 2 (<=2, so the old code used C-4715) actually falls in Gregorian September/October (>2, needs C-4716) -> year off by +1. - Ethiopian month 5 or 6 (>2, so the old code used C-4716) actually falls in Gregorian January/February (<=2, needs C-4715) -> year off by -1. Verified against every example in dbpedia#845 (a standalone reimplementation of the algorithm in Python, run against the exact Ethiopian dates and their Gregorian year given in the issue): all nine reproduce the reported wrong year with the old branch and the correct year with `gregorianMonth`, e.g. Meskerem 7, 1984 (Ethiopian) is old=1992, new=1991, matches the article's own gloss of 17 Sep 1991. No Scala/sbt toolchain available locally to run the project's own test suite. This fixes only item A of dbpedia#845 (the year-offset bug). Item B (the `ቀን` date-format regex never matching) is a separate, unrelated fix left for a follow-up. Related to dbpedia#845 (item A only)
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe Ethiopian date converter now selects the Gregorian year offset using the calculated Gregorian month. Gregorian months January and February use ChangesEthiopian date conversion
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change selects the Gregorian year based on the converted month, correcting dates that fall in January or February. The inspected boundary calculations support this behavior, and no concrete merge-blocking risk is established; normal project checks remain appropriate. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Thanks for the controbution @ManasBagul23 |
|
there was some recent merge on this parser, can you rebase your changes on the latest code and check if the fix is still needed @ManasBagul23 |
|
Checked — PR #846 (merged as c870f5d) already fixes this exact bug the same way (branches the year offset on |



Related to #845 (item A only).
geezToGregorianDateConverterimplements the standard Julian-Day-Number-to-Gregorian conversion (Fliegel & Van Flandern). That algorithm's year-offset step branches on the computed Gregorian month (year = C-4715when the Gregorian month is January/February, elseC-4716) — it has nothing to do with which calendar the input date was originally in.The code branched on
month, the Ethiopian input month, instead of thegregorianMonthvalue it had already computed two lines above:Ethiopian months 1–2 (Meskerem/Tikimt, ~September/October) and 5–6 (Tir/Yekatit, ~January/February) straddle the Gregorian year boundary in the opposite sense from their own month numbers, so exactly those months hit the wrong branch — matching #845's report that only months 1, 2, 5, 6 are affected:
Verification: reimplemented the algorithm standalone in Python and ran it against every example in #845's evidence table (the article's own Gregorian gloss for each Ethiopian date). All nine reproduce the reported wrong year with the old branch condition and the correct year with
gregorianMonth— e.g. Meskerem 7, 1984 (Ethiopian) gives old=1992, new=1991, matching ሊኑክስ's own gloss of 17 Sep 1991. No Scala/sbt toolchain available locally to run the project's own test suite.This fixes only item A of #845 (the year-offset bug). Item B (the
ቀንdate-format regex never matching) is a separate, unrelated fix and is left for a follow-up.Prepared with AI assistance; I reviewed the changes.
Summary by CodeRabbit