Skip to content

Correct Bahá’í year boundary handling on Naw-Rúz dates - #68

Merged
fitnr merged 2 commits into
fix/63from
copilot/fix-code-for-review-comment
Sep 13, 2026
Merged

fitnr merged 2 commits into
fix/63from
copilot/fix-code-for-review-comment

Conversation

Copilot AI commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

A review comment identified an off-by-boundary bug: Naw-Rúz dates falling on March 20 were being assigned to the previous Bahá’í year. This PR applies the requested fix by using the computed Naw-Rúz date directly and treating only strictly earlier dates as pre-boundary.

  • Boundary logic fix (bahai.from_jd)

    • Replaced the hardcoded March 20 cutoff with a strict comparison against the computed Naw-Rúz day for the Gregorian year.
    • This ensures Naw-Rúz itself is classified as day 1 of month 1 in the new Bahá’í year.
  • Regression coverage alignment

    • Existing Bahá’í test expectations for 2016-03-20 -> (173, 1, 1) now pass with the corrected boundary behavior.
# before
x = 1 if jd <= gregorian.to_jd(gy, n_month, 20) else 0

# after
x = 1 if jd < gregorian.to_jd(gy, n_month, n_day) else 0

@fitnr
fitnr added this pull request to stack #69 September 13, 2026 19:09
Co-authored-by: fitnr <714125+fitnr@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on review comment Correct Bahá’í year boundary handling on Naw-Rúz dates Sep 13, 2026
Copilot AI requested a review from fitnr September 13, 2026 19:11
@fitnr
fitnr marked this pull request as ready for review September 13, 2026 19:23
@fitnr
fitnr merged commit ef5e9a7 into master Sep 13, 2026
20 checks passed
@fitnr
fitnr deleted the copilot/fix-code-for-review-comment branch September 13, 2026 19:40
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.

2 participants