WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
275489
[JSC] Fix `Intl.DurationFormat` for `numeric` and `2-digit`
https://bugs.webkit.org/show_bug.cgi?id=275489
Summary
[JSC] Fix `Intl.DurationFormat` for `numeric` and `2-digit`
Sosuke Suzuki
Reported
2024-06-14 08:42:44 PDT
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
Attachments
Add attachment
proposed patch, testcase, etc.
Sosuke Suzuki
Comment 1
2024-06-14 08:43:51 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/29823
Radar WebKit Bug Importer
Comment 2
2024-06-21 08:46:31 PDT
<
rdar://problem/130279541
>
EWS
Comment 3
2024-06-28 10:42:58 PDT
Committed
280460@main
(471838036efe): <
https://commits.webkit.org/280460@main
> Reviewed commits have been landed. Closing PR #29823 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug