Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 399973c04a04c5fbd4519c6b51f28a54b1acf59a
https://github.com/WebKit/WebKit/commit/399973c04a04c5fbd4519c6b51f28a54b1acf59a
Author: Yijia Huang <[email protected]>
Date: 2026-08-07 (Fri, 07 Aug 2026)
Changed paths:
A JSTests/stress/temporal-calendar-merge-fields-with.js
A JSTests/stress/temporal-isodatetofields-call-sites.js
M Source/JavaScriptCore/API/tests/TemporalCoreTest.cpp
M Source/JavaScriptCore/runtime/TemporalPlainDate.h
M Source/JavaScriptCore/runtime/TemporalPlainDatePrototype.cpp
M Source/JavaScriptCore/runtime/TemporalPlainDateTime.h
M Source/JavaScriptCore/runtime/TemporalPlainDateTimePrototype.cpp
M Source/JavaScriptCore/runtime/TemporalPlainMonthDayPrototype.cpp
M Source/JavaScriptCore/runtime/TemporalPlainTime.cpp
M Source/JavaScriptCore/runtime/TemporalPlainTime.h
M Source/JavaScriptCore/runtime/TemporalPlainTimePrototype.cpp
M Source/JavaScriptCore/runtime/TemporalPlainYearMonthPrototype.cpp
M Source/JavaScriptCore/runtime/TemporalZonedDateTimePrototype.cpp
M Source/JavaScriptCore/runtime/temporal/core/CalendarFields.cpp
M Source/JavaScriptCore/runtime/temporal/core/CalendarFields.h
M Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp
M Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.h
Log Message:
-----------
[JSC][Temporal] Implement ISODateToFields and CalendarMergeFields as the
spec's own operations
https://bugs.webkit.org/show_bug.cgi?id=321189
rdar://184247766
Reviewed by Yusuke Suzuki.
Add isoDateToFields and calendarMergeFields, plus the CalendarFieldKeysPresent,
CalendarFieldKeysToIgnore and NonISOFieldKeysToIgnore operations they rest on.
Every .with() entry point previously hand-fused those steps with its own
field-priority rules, PlainMonthDay's in 44 lines, and the MergeMode enum they
needed is gone. differenceYearMonth's two hand-rolled copies of
ISODateToFields(~year-month~) are converted too.
CalendarFieldKeysToIgnore is what makes a year-only change correct on a
lunisolar calendar: month and monthCode encode one field, so setting either must
discard the other. Carrying the ordinal across a year change picks the wrong
month once a leap month precedes it — chinese M05 is ordinal 5 in 2018, 6 in
2020.
This also fixes PlainYearMonth.prototype.add/subtract shifting the month by a
constant -2 for "buddhist", "roc" and "japanese" when the receiver's ISO year
was in roughly 1..1582, confirmed pre-existing by A/B against a pre-conversion
build. Root cause never established.
Add calendarDayOfWeek, calendarWeekOfYear and calendarYearOfWeek so all fifteen
CalendarISOToDate fields reach the getters through one accessor family; the
spec's "undefined for calendars with no well-defined week calendar system" rule
was re-derived at six getter sites and is now one std::optional. Remove the
eight forwarders this leaves unreferenced.
Inline TemporalPlainTime::with into its prototype, and restore
ZonedDateTime.prototype.with to spec step order: steps 9, 10-16 and 18 ran after
19-22, so ISODateToFields could throw only after the options getters had run.
Tests: JSTests/stress/temporal-calendar-merge-fields-with.js
JSTests/stress/temporal-isodatetofields-call-sites.js
Source/JavaScriptCore/API/tests/TemporalCoreTest.cpp
Canonical link: https://commits.webkit.org/318785@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications