[Webkit-unassigned] [Bug 275489] New: [JSC] Fix `Intl.DurationFormat` for `numeric` and `2-digit`
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jun 14 08:42:44 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=275489
Bug ID: 275489
Summary: [JSC] Fix `Intl.DurationFormat` for `numeric` and
`2-digit`
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Layout and Rendering
Assignee: webkit-unassigned at lists.webkit.org
Reporter: aosukeke at gmail.com
CC: bfulgham at webkit.org, simon.fraser at apple.com,
zalan at apple.com
In the current JSC `Intl.DurationFormat` implementation, only units with a value that is not 0 or a
display setting that is not `auto` are formatted. However, this behavior is incorrect according to
the current spec[1]. When a unit's style is `numeric` or `2-digit` (i.e., the unit is `hours`,
`minutes`, or `seconds`), it needs to be formatted even if its value is 0 and its display is set to
auto. For example, consider the following code:
```
const df = new Intl.DurationFormat("en", { hours: "numeric", minutesDisplay: "auto", secondsDisplay: "auto" });
print(df.format({ hours: 0, minutes: 0, seconds: 1 }));
```
This code is expected to output `0:00:01`, but the current JSC outputs `0, 01`. Only the hours and
seconds are displayed, while the minutes are not. Additionally, the separator `:` is not used; instead,
`,` is outputted.
[1]: https://tc39.es/proposal-intl-duration-format/#sec-partitiondurationformatpattern
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240614/542d08c4/attachment.htm>
More information about the webkit-unassigned
mailing list