Skip to content

Editorial: Constrain months in NonISOCalendarDateToISO#122

Merged
ptomato merged 1 commit intotc39:mainfrom
ben-allen:issue-121-nonisocalendardatetoiso-constrain-ordinal-month
Feb 25, 2026
Merged

Editorial: Constrain months in NonISOCalendarDateToISO#122
ptomato merged 1 commit intotc39:mainfrom
ben-allen:issue-121-nonisocalendardatetoiso-constrain-ordinal-month

Conversation

@ben-allen
Copy link
Copy Markdown
Collaborator

This PR fixes a spec bug identified in #121, which resulted in assertion violations when user provides a date with a month greater than the number of months in that year for that calendar.

ordinal months greater than the number of months in the year in that
calendar for the specified year.
@ben-allen ben-allen requested a review from ptomato February 25, 2026 16:42
Copy link
Copy Markdown
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, thanks 👍

@ptomato ptomato merged commit 6c70c9e into tc39:main Feb 25, 2026
1. Let _month_ be _monthsInYear_.
1. Else,
1. Let _month_ be _fields_.[[Month]].
1. Let _daysInMonth_ be CalendarDaysInMonth(_calendar_, _fields_.[[Year]], _fields_.[[Month]]).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Let _daysInMonth_ be CalendarDaysInMonth(_calendar_, _fields_.[[Year]], _fields_.[[Month]]).
1. Let _daysInMonth_ be CalendarDaysInMonth(_calendar_, _fields_.[[Year]], _month_).

I noticed this while integrating it into tc39/ecma402#1044. I've fixed it up there.

ptomato added a commit to ptomato/proposal-intl-era-monthcode that referenced this pull request Mar 4, 2026
Similar to tc39#122, the change there must also apply here. Editorial
because otherwise we fail an assertion.

h/t fabon-f
ptomato added a commit to ptomato/proposal-intl-era-monthcode that referenced this pull request Mar 4, 2026
Similar to tc39#122, the change there must also apply here. Editorial
because otherwise we fail an assertion.

h/t fabon-f
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