Skip to content

Rebase part 1#358

Merged
ptomato merged 30 commits intomainfrom
rebase-part1
Apr 6, 2026
Merged

Rebase part 1#358
ptomato merged 30 commits intomainfrom
rebase-part1

Conversation

@ptomato
Copy link
Copy Markdown
Contributor

@ptomato ptomato commented Apr 2, 2026

Part 1 of a rebase to the latest proposal state, in preparation for a release.

gibson042 and others added 9 commits March 31, 2026 11:41
Fixes #3099

UPSTREAM_COMMIT=1117eaf808847537135951f24d67e0361ad8daff
UPSTREAM_COMMIT=943e11d796285a0a09329997c0f4b0c7b3930425
Checks that a successful TemporalTimeString parse does not additionally
parse as an AmbiguousTimeString. This moves the validation previously
done as an early error, to a second algorithm step.

See: #3128

UPSTREAM_COMMIT=fa3d0b913bb59551966b901858ce6ddebadf2baf
For the weeks and days part, we already used a shortcut instead of
looping, so we keep it the same as before. For the years and months
calculation, we change to the new definition of ISODateSurpasses.

UPSTREAM_COMMIT=f6e78d07dea1daf9e12c8c987cc12d4c9a2b2583
See PRs #3135 and #3139.

UPSTREAM_COMMIT=f88588507fcb27f72a21838489e0bb740ca58c2a
See PR #3134.

UPSTREAM_COMMIT=8f7261dff406fd54b5db2cc83f1c9e0444320fd1
largestUnit can be any unit, ~auto~, or ~unset~ here.
ValidateTemporalUnitValue just checks if it is any unit, ~auto~, or
~unset~, so it's a no-op.

UPSTREAM_COMMIT=07c924ba73a77b993cf100bca0bc437f20146ad8
This name matches the spec text.

UPSTREAM_COMMIT=5f15e4ea5dbc62fcbed5e908ec78b7d9464f105e
The polyfill already contained two functions that were doing essentially
the same things, so rename them. However they were also doing duplicated
work of validation that was already done in ToMonthCode, so eliminate
that duplication.

This simplifies the calendar code a little bit.

UPSTREAM_COMMIT=5b3a9528ac67d8b87f069011045ebeccce559fdb
@ptomato ptomato requested review from 12wrigja and justingrant April 2, 2026 01:49
@ptomato ptomato force-pushed the rebase-part1 branch 3 times, most recently from 0b104f7 to fe95574 Compare April 2, 2026 03:15
Comment thread lib/ecmascript.ts
ptomato added 15 commits April 2, 2026 14:10
Co-Authored-By: Richard Gibson <richard.gibson@gmail.com>

UPSTREAM_COMMIT=f860ac642b08f9d0c03ba0b412317dad2ce28808
Co-Authored-By: Richard Gibson <richard.gibson@gmail.com>

UPSTREAM_COMMIT=e6f565d69c0bb64c9a40ff7896aa00aaa37b744e
Error messages are not defined in the spec text, but should not cause
observable effects.

UPSTREAM_COMMIT=1e75002d03c17872ea7487482862409355a322b3
See https://tc39.es/proposal-intl-era-monthcode/#sup-availablecalendars

These IDs correspond to calendars that in practice are not being used in
real life, and have already been removed in Firefox.

UPSTREAM_COMMIT=b11afab212480befb68c30db652204a1c115da87
The era/monthCode proposal went through some changes in the era codes in
the past while. Update the calendar definitions to reflect these
changes.

This allows removing makeHelperGregorianFixedEpoch, as there are now no
longer any solar calendars without eras. We can also move
completeEraYear into the nonISOBaseHelper's adjustCalendarDate method,
since the only calendars without eras are now lunisolar calendars that
have to override adjustCalendarDate anyway.

UPSTREAM_COMMIT=28fe786e2261845e59596bbef343b27183f2f22e
This is needed for dealing with the coptic era that
proposal-intl-era-monthcode drops, but is still present in old versions
of ICU as ERA0. We give it a Symbol era code so that it can never be
matched by user code.

UPSTREAM_COMMIT=a42ad8559512fcbf844373b0409f07f76611ae8b
…c IDs

The calendar IDs 'islamic' and 'islamic-rgsa' don't actually correspond
to calendars in use and don't specify a calendar algorithm. The era-
monthCode proposal makes implementations define fallback behaviour for
them.

If the JS engine already performs the fallback behaviour, this code
should have no effect.

UPSTREAM_COMMIT=fdd8f1a9eb1850357fff8e55ee57bb6a6a81f721
There is another comment not too far below this one that says basically
the same thing.

UPSTREAM_COMMIT=eb2c9f48733627ff779a6c8ae81ffda7af25f4e6
The calendar impl object doesn't have an `id` property, only the helper
object does.

UPSTREAM_COMMIT=8e8ca066a628a8959195c9ccb76b9476a0516042
This makes the reference implementation slightly more like the spec
text, which should help make sure the spec text is correct. More commits
like this to follow.

UPSTREAM_COMMIT=878f93d93236d196214df25d71deb0e299865e6d
This makes the reference implementation slightly more like the spec
text, which should help make sure the spec text is correct.

UPSTREAM_COMMIT=a1fd8ac8288de8dfa1a8f6a457b969eb51a300b1
This makes the reference implementation slightly more like the spec
text, which should help make sure the spec text is correct.

The derivation of monthsPerYear from the table for non-lunisolar
calendars would ideally be written differently, but this is temporary
until we can refactor the implementation to be even more like the spec.

UPSTREAM_COMMIT=92bbd2e7cc156acae0b174cb15a9f3a9f6b836b0
Adding days to an ISO date does not have any calendar-specific behaviour
so extract it out of the calendar helper objects. There were also some
calls with a leftover cache parameter which was unused.

UPSTREAM_COMMIT=4a77bde30d7222025b860722d837f40a120b44c8
UPSTREAM_COMMIT=4fc4a3f280fe46a8ae7742b30d857005b3da440b
The Node versions that got CLDR updates now have many failing tests. Put
these in a new "expected-failures-cldr48.txt" file that applies to Node
20, 22, and 24, (but not 23), and hopefully will be deleted in a future
rebase.
ptomato added 6 commits April 2, 2026 14:15
This polyfill's ToPrimitive implementation wasn't according to spec. Fix
it and move it into a separate file so that it can also be imported in
monthcode.ts which can't depend on ecmascript.ts.
TypeScript complained while editing the rebase-upstream-commits utility.
Pulls in a new version of browserslist, which gets rid of an out-of-date
warning.
This gets rid of a security vulnerability in the dependencies. There
don't seem to be any breaking changes.

We cannot update to Rollup 4.x, as rollup-plugin-dts is blocking that;
it requires Node 16 from 6.0.1 onwards.

rollup/plugin-terser would require Node 20 from 1.0.0 onwards.
These are all feature releases or patch releases, so should not affect
backwards compatibility.

There is one dependency remaining with security alerts:
serialize-javascript. Updating it would be a breaking change, because
it would pull in rollup/plugin-terser 1.0.0, which bumps the required
Node version to 20.
(Except TypeScript, which I'll update separately some time in the
future together with the main package)
Copy link
Copy Markdown
Contributor

@justingrant justingrant left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for catching up the polyfill!

Comment thread lib/ecmascript.ts
@ptomato ptomato merged commit ef32041 into main Apr 6, 2026
31 checks passed
@ptomato ptomato deleted the rebase-part1 branch April 6, 2026 16:20
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.

3 participants