Skip to content

fix(hebcal): skip non-existent year 0 when computing Gregorian end date#23

Merged
mjradwin merged 1 commit into
mainfrom
claude/hebcal-year-zero-bug-pL7h7
May 24, 2026
Merged

fix(hebcal): skip non-existent year 0 when computing Gregorian end date#23
mjradwin merged 1 commit into
mainfrom
claude/hebcal-year-zero-bug-pL7h7

Conversation

@mjradwin

Copy link
Copy Markdown
Member

When a user requested a calendar starting in a BC year (e.g. year=-1) with
the default NumYears=1, getStartAndEnd computed the end as
greg.ToRD(year+numYears, January, 1) = greg.ToRD(0, ...), which panics
because the historical Gregorian calendar has no year 0 (1 BC is
immediately followed by 1 AD). Bump the end year past 0 whenever the
range crosses the BC/AD boundary so that the requested number of years
of output is preserved.

Reported in hebcal/hebcal#310.

When a user requested a calendar starting in a BC year (e.g. year=-1) with
the default NumYears=1, getStartAndEnd computed the end as
greg.ToRD(year+numYears, January, 1) = greg.ToRD(0, ...), which panics
because the historical Gregorian calendar has no year 0 (1 BC is
immediately followed by 1 AD). Bump the end year past 0 whenever the
range crosses the BC/AD boundary so that the requested number of years
of output is preserved.

Reported in hebcal/hebcal#310.
@mjradwin mjradwin merged commit ff99ac1 into main May 24, 2026
2 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@mjradwin mjradwin deleted the claude/hebcal-year-zero-bug-pL7h7 branch May 24, 2026 18:09
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