WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
285078
Intl.DurationFormat in digital style breaks the output when hoursDisplay is "auto"
https://bugs.webkit.org/show_bug.cgi?id=285078
Summary
Intl.DurationFormat in digital style breaks the output when hoursDisplay is "...
itwaze
Reported
2024-12-22 05:25:52 PST
Note: the issue can be reproduced on iOS 18 only. const instance = new Intl.DurationFormat('en-US', { style: "digital", hoursDisplay: "auto", }) Expected behavior: instance.format({hours: 0, minutes: 1, seconds: 2}); // "01:02" Current behavior: instance.format({hours: 0, minutes: 1, seconds: 2}); // ":, 01:02" Separators shouldn't be part of the output.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2024-12-23 12:57:05 PST
Thank you for the report! Could you please clarify what you mean by "can be reproduced on iOS 18 only"? One can interpret this in multiple ways (e.g. that it doesn't reproduce in Safari on macOS, or doesn't reproduce on iOS 17.x, or doesn't reproduce in iOS 18.2).
Karl Dubost
Comment 2
2024-12-23 17:44:23 PST
Confirmed on macOS 15.2 tested on ``` ":, 01:02" Safari Technology Preview 209 20621.1.6 "01:02" Firefox Nightly 135.0a1 13524.12.18 "01:02" Google Chrome Canary 133.0.6914.0 6914.0 ```
Radar WebKit Bug Importer
Comment 3
2024-12-23 17:45:02 PST
<
rdar://problem/141969050
>
Karl Dubost
Comment 4
2024-12-23 18:05:04 PST
To note that instance.format({hours: 1, minutes: 2, seconds: 3}); returns the same results in all browsers "1:02:03"
Karl Dubost
Comment 5
2024-12-23 18:15:03 PST
In Safari: Also `instance.formatToParts({hours: 0, minutes: 1, seconds: 2})` ``` [ {type: "literal", value: ":"}, {type: "literal", value: ", "}, {type: "integer", value: "01", unit: "minute"}, {type: "literal", value: ":"}, {type: "integer", value: "02", unit: "second"} ] ``` while `instance.formatToParts({hours: 1, minutes: 2, seconds: 3})` ``` [ {type: "integer", value: "1", unit: "hour"}, {type: "literal", value: ":"}, {type: "integer", value: "02", unit: "minute"}, {type: "literal", value: ":"}, {type: "integer", value: "03", unit: "second"} ] ``` In Firefox/Chrome ``` [ {"type": "integer", "value": "01","unit": "minute"}, {"type": "literal", "value": ":"}, {"type": "integer", "value": "02", "unit": "second"} ] ``` So there is also an issue with `formatToParts`
Karl Dubost
Comment 6
2024-12-23 18:36:53 PST
It's a bit of a mess. instance.format({years: 1, days: 3, hours: 1, minutes: 2, seconds: 3}); "1 yr, 3 days, 1:02:03" (everywhere) instance.format({years: 1, days: 3, hours: 0, minutes: 2, seconds: 3}); "1 yr, 3 days:02:03" Safari, Firefox "1 yr, 3 days, 02:03" Chrome instance.format({years: 0, days: 3, hours: 1, minutes: 2, seconds: 3}); "3 days, 1:02:03" (everywhere) instance.format({years: 0, days: 0, hours: 0, minutes: 2, seconds: 3}); "02:03" Firefox, Chrome ":, 02:03" Safari instance.format({hours: -0, minutes: -2, seconds: -3}); instance.format({hours: 0, minutes: -2, seconds: -3}); "-02:03" Firefox, Chrome ":, 02:03" Safari
Karl Dubost
Comment 7
2024-12-23 18:43:40 PST
const instanceFR = new Intl.DurationFormat('fr-FR', { style: "digital", hoursDisplay: "auto", }) instanceFR.format({hours:0, minutes: 2, seconds: 3}) "02:03" Firefox, Chrome ": et 02:03" Safari
Sosuke Suzuki
Comment 8
2024-12-23 21:56:58 PST
Pull request:
https://github.com/WebKit/WebKit/pull/38357
EWS
Comment 9
2024-12-24 10:24:44 PST
Committed
288277@main
(5e50f4025022): <
https://commits.webkit.org/288277@main
> Reviewed commits have been landed. Closing PR #38357 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