Skip to content

Conversation

@catamorphism
Copy link
Contributor

@catamorphism catamorphism commented Jan 5, 2026

For PlainYearMonth.from with non-ISO calendars, add test coverage for the cases where the month is one month before the earliest supported month, and the month is one month after the latest supported month (an exception should be thrown).

Closes tc39/proposal-temporal#3082

@catamorphism catamorphism requested a review from a team as a code owner January 5, 2026 21:48
@catamorphism catamorphism force-pushed the month-before-earliest-supported-month branch from c226bad to ab8fd09 Compare January 5, 2026 21:51
For PlainYearMonth.from with non-ISO calendars, add test coverage
for the cases where the month is one month before the earliest supported
month, and the month is one month after the latest supported month
(an exception should be thrown).
@Ms2ger Ms2ger force-pushed the month-before-earliest-supported-month branch from ab8fd09 to 0cd5a2f Compare January 6, 2026 14:01
@Ms2ger Ms2ger merged commit 7371d62 into tc39:main Jan 6, 2026
14 checks passed
@Manishearth
Copy link
Contributor

I don't think this test is correct for Coptic, and I think the polyfill is wrong here.

Temporal.PlainDate.from({ calendar: "coptic", year: 275471, era: "am", eraYear: 275471, month: 5, day: 1); gives 275760-08-23[u-ca=coptic] in the polyfill. 275760-09-13 is the max ISO date.

The coptic test tests Temporal.PlainYearMonth.from({ calendar: "coptic", year: 275471, era: "am", eraYear: 275471, month: 6, monthCode: "M06"});, which will of course produce a value after 275760-09-13. The corresponding date for day: 1 is 275760-09-22

But: CalendarYearMonthFromFields doesn't check for the ISO date being out of range, it only checks ISOYearMonthWithinLimits, which checks the month not the day. As far as I can understand it, this test does not match the spec.

cc @ptomato who might catch something I missed.

@ptomato
Copy link
Contributor

ptomato commented Jan 13, 2026

Thanks for checking, I'll take a look tomorrow.

@ptomato
Copy link
Contributor

ptomato commented Jan 14, 2026

@Manishearth I concur, looks like I made a wrong assumption when I wrote the issue description in tc39/proposal-temporal#3082

@catamorphism
Copy link
Contributor Author

Created tc39/proposal-temporal#3251 to track the bug in the polyfill.

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.

Coverage gap: Test what happens when PlainYearMonth's first day falls in ISO month -271821-03

4 participants