Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ee8e5dbbcc2a0a97525d805ab19d46951bbec525
      
https://github.com/WebKit/WebKit/commit/ee8e5dbbcc2a0a97525d805ab19d46951bbec525
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    A JSTests/stress/intl-durationformat-fraction-without-integer-part.js
    M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp

  Log Message:
  -----------
  [JSC] `Intl.DurationFormat` drops the fraction folded into a zero unit
https://bugs.webkit.org/show_bug.cgi?id=325238

Reviewed by Yusuke Suzuki.

new Intl.DurationFormat("en", { milliseconds: "numeric" }).format({ 
milliseconds: 500 })
returns "" instead of "0.5 sec", and { hours: 1, milliseconds: 500 } is 
formatted as
"1 hr" instead of "1 hr, 0.5 sec".

When the next unit is numeric, PartitionDurationFormatPattern [1] adds the 
smaller
units to the value as a fraction before checking whether the value is zero.
collectElements checked only the unit's own field, so a unit whose display is 
"auto"
was skipped whenever that field was 0. Check the value including the fraction.

[1]: https://tc39.es/ecma402/#sec-partitiondurationformatpattern

Test: JSTests/stress/intl-durationformat-fraction-without-integer-part.js

* JSTests/stress/intl-durationformat-fraction-without-integer-part.js: Added.
(shouldBe):
(format):
(parts):
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::collectElements):

Canonical link: https://commits.webkit.org/321878@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to