Skip to content

Intl era monthcode: PlainYearMonth tests, part 1#4762

Merged
ptomato merged 4 commits intotc39:mainfrom
ptomato:intl-era-monthcode-plainyearmonth-part1
Dec 4, 2025
Merged

Intl era monthcode: PlainYearMonth tests, part 1#4762
ptomato merged 4 commits intotc39:mainfrom
ptomato:intl-era-monthcode-plainyearmonth-part1

Conversation

@ptomato
Copy link
Copy Markdown
Contributor

@ptomato ptomato commented Dec 4, 2025

This PR is part 1 of a series that will copy all of the PlainDate tests that would apply to PlainYearMonth, and adapt them where necessary.

This covers from(), with(), and daysInMonth. To follow: since(), until(), add(), subtract().

It's very large so most likely the best way to review it is spot-checking and searching for extraneous day: properties. And of course pay attention to the harness file change.

@ptomato ptomato requested a review from a team as a code owner December 4, 2025 03:21
Comment thread harness/temporalHelpers.js
There are cases where we don't care exactly what the PlainYearMonth's
ISO reference day is, just that it is consistent with PlainDate. To
enable writing tests for this, add a feature to
TemporalHelpers.assertPlainYearMonth() where you can pass null as the
referenceISODay argument, and it will be checked for consistency with
PlainDate but not asserted to be any particular value.

I considered making this the default argument, but the default argument
was already 1, which is valuable for calendars that are ISO-like, and I
didn't want to have to go back and change all callers.
This commit copies all of the PlainDate.from tests that would apply to
PlainYearMonth, and adapts them where necessary.
…th.daysInMonth

This commit copies all of the PlainDate.prototype.daysInMonth tests that
would apply to PlainYearMonth, and adapts them where necessary.
This commit copies all of the PlainDate.prototype.with tests that would
apply to PlainYearMonth, and adapts them where necessary.
@ptomato ptomato force-pushed the intl-era-monthcode-plainyearmonth-part1 branch from f92e311 to 695015b Compare December 4, 2025 18:13
@ptomato ptomato merged commit bc6f8ef into tc39:main Dec 4, 2025
12 checks passed
@ptomato ptomato deleted the intl-era-monthcode-plainyearmonth-part1 branch December 4, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants