← All issues

[JSC][Temporal] Implement Intl.DateTimeFormat Temporal support and toLocaleString

5745eb4

Temporal is the TC39 replacement for Date, introducing six date/time primitives (PlainDate/Time/DateTime/YearMonth/MonthDay/Instant). Intl.DateTimeFormat is JSC's locale-aware formatter backed by ICU. Bridging them requires type-aware dispatch, calendar validation with ordered exceptions, and a timezone-selection rule where plain types always format in GMT (no timezone context) while Instant uses the formatter's configured timezone.

This commit lands HandleDateTimeValue, SameTemporalType, AdjustDateTimeStyleFormat, FormatDateTime, FormatDateTimeToParts, FormatDateTimeRange, FormatDateTimeRangeToParts, and wires toLocaleString onto all six Temporal prototypes. A new TemporalFieldKind enum drives per-type ICU skeleton filtering and a lazy sub-formatter cache inside each Intl.DateTimeFormat instance. 201 test262 skips are removed.

This lands a large new intersection between two complex subsystems (Temporal and Intl), with asymmetric validation rules (RangeError-before-TypeError ordering, iso8601 exemption restricted to PlainDate/PlainDateTime only) and a per-instance ICU formatter cache — historically bug-prone surface in browser engines.

🔒

New type dispatch, asymmetric validation ordering, and lazy caching across six Temporal types — multiple edge cases worth security investigation.

Subscribe to read more