Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9aea44e083d4c180796641f4a4e77d5e3e5b5bad
https://github.com/WebKit/WebKit/commit/9aea44e083d4c180796641f4a4e77d5e3e5b5bad
Author: Sosuke Suzuki <[email protected]>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A JSTests/stress/intl-durationformat-numeric-unit-display-default.js
M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp
Log Message:
-----------
[JSC] `Intl.DurationFormat` drops zero minutes and seconds after a numeric
unit
https://bugs.webkit.org/show_bug.cgi?id=324561
Reviewed by Yusuke Suzuki.
new Intl.DurationFormat("en", { hours: "numeric" }).format({ hours: 1 }) returns
"1" instead of "1:00:00", and resolvedOptions() reports minutesDisplay and
secondsDisplay as "auto". The equivalent { style: "digital" } already returns
"1:00:00".
When a unit's style is unspecified and the previous unit is numeric or 2-digit,
GetDurationUnitOptions [1] defaults the display to "auto" only for units other
than minutes and seconds. intlDurationUnitOptions set "auto" for every unit in
that case. Follow the spec.
[1]: https://tc39.es/ecma402/#sec-getdurationunitoptions
Test: JSTests/stress/intl-durationformat-numeric-unit-display-default.js
* JSTests/stress/intl-durationformat-numeric-unit-display-default.js: Added.
(shouldBe):
(displays):
(format):
(catch):
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::intlDurationUnitOptions):
Canonical link: https://commits.webkit.org/321755@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications