Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c5c46669ba3028504eabe3b704064817b6aa92af
https://github.com/WebKit/WebKit/commit/c5c46669ba3028504eabe3b704064817b6aa92af
Author: Sosuke Suzuki <[email protected]>
Date: 2026-09-19 (Sat, 19 Sep 2026)
Changed paths:
A JSTests/stress/intl-datetimeformat-resolved-options-am-pm.js
M JSTests/stress/intl-datetimeformat.js
M Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
Log Message:
-----------
[JSC] `Intl.DateTimeFormat` should not report dayPeriod for the AM/PM marker
https://bugs.webkit.org/show_bug.cgi?id=324559
Reviewed by Yusuke Suzuki.
setFormatsFromPattern treated 'a' (the AM/PM marker) like 'b' and 'B' (the
flexible day periods that the dayPeriod option requests). Any 12-hour
formatter therefore reported dayPeriod: "short" without it being
requested, and creating a formatter from its resolvedOptions() changed
"10:05 AM" into "10:05 in the morning".
ECMA-402 sets [[dayPeriod]] only for "{dayPeriod}" in a pattern [1]; the
AM/PM marker is the separate "{ampm}". Populate m_dayPeriod only from 'b'
and 'B'.
[1]: https://tc39.es/ecma402/#sec-datetimeformat-format-record
Test: JSTests/stress/intl-datetimeformat-resolved-options-am-pm.js
* JSTests/stress/intl-datetimeformat-resolved-options-am-pm.js: Added.
(shouldBe):
(roundTrip):
(shouldBe.string_appeared_here.in.recreated.resolvedOptions):
(shouldBe.recreated.resolvedOptions):
(original.format):
* JSTests/stress/intl-datetimeformat.js:
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::setFormatsFromPattern):
Canonical link: https://commits.webkit.org/321443@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications