You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Intl.DateTimeFormat formatToParts aborts the process (unreachable code) when the locale pattern has Y: please cherry-pick V8 0426b0d1045d into v22.x, v24.x and v26.x #67076
This one matches V8's regression test (test/intl/date-format/year-woy-field.js):
node -e "new Intl.DateTimeFormat('te-u-ca-buddhist', { year: 'numeric', month: 'long' }).formatToParts(0)"
formatRangeToParts aborts in the same way. Here formatToParts works and only the range call aborts:
node -e "const f = new Intl.DateTimeFormat('ak-u-ca-buddhist', { year: 'numeric', month: 'short', timeZone: 'UTC' }); f.formatToParts(0); f.formatRangeToParts(0, 5e9)"
format() and formatRange() do not abort with the same options.
How often does it reproduce? Is there a required condition?
Every time. The condition is a locale whose ICU date pattern for the requested options contains
the pattern letter Y (week-based year). try/catch does not help, because V8 ends the process.
What is the expected behavior? Why is that the expected behavior?
formatToParts returns an array of parts and does not end the process.
ECMA-402 2026, §11.5.5 FormatDateTimePattern,
handles a pattern field it does not recognise in its last step: "Let unknown be an
implementation-, locale-, and numbering system-dependent String based on epochNanoseconds and p.
Append the Record { [[Type]]: "unknown", [[Value]]: unknown } to result." So even an
unrecognised field yields a part, never an abort.
Frame 3 is mis-symbolised. The UNREACHABLE() is the default: case of IcuDateFieldIdToDateType in deps/v8/src/objects/js-date-time-format.cc, which has no case for
ICU's UDAT_YEAR_WOY_FIELD (the Y field).
The one-line case stops the abort on its own. On v24.x and v22.x the "YY"/"Y" entries
would go into the older PatternItem call by hand. The V8 maintenance guide
says fixes for abandoned V8 branches are cherry-picked in this repository.
What the fix does not change. After the fix these locales still print a week-based year
where a calendar year is meant: gd formats 30 December 2024 as Dùbh 2025. That is CLDR data,
not Node.js or V8. CLDR-19873 (https://unicode-org.atlassian.net/browse/CLDR-19873) reports the
same data defect for gl and kek.
Activity