Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 55784d54785e187216c433d10b4e0c504a722e98
https://github.com/WebKit/WebKit/commit/55784d54785e187216c433d10b4e0c504a722e98
Author: Sosuke Suzuki <[email protected]>
Date: 2024-08-07 (Wed, 07 Aug 2024)
Changed paths:
M JSTests/stress/intl-durationformat-format-to-parts.js
A JSTests/stress/intl-durationformat-roundingMode.js
M JSTests/test262/expectations.yaml
M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp
Log Message:
-----------
[JSC] `Intl.DurationFormat` should format seconds with `roundingMode` is
`trunc`
https://bugs.webkit.org/show_bug.cgi?id=275745
Reviewed by Yusuke Suzuki.
According to the specifications [1][2], `Intl.DurationFormat` should use
`trunc` as the
`roundingMode` when formatting seconds, milliseconds, or microseconds.
However, the current JSC is formatting with the default `roundingMode` of
`Intl.NumberFormat`,
which is `halfExpand` (in practice, it uses the corresponding ICU rounding
mode[3][4]
`rounding-mode-half-up`).
This patch changes the formatting of seconds, milliseconds, or microseconds to
use the ICU rounding
mode `rounding-mode-down`, which corresponds to `trunc` as the `roundingMode`.
[1]:
https://tc39.es/proposal-intl-duration-format/#sec-partitiondurationformatpattern
[2]: https://tc39.es/proposal-intl-duration-format/#sec-formatnumericseconds
[3]:
https://github.com/unicode-org/icu/blob/main/docs/userguide/format_parse/numbers/rounding-modes.md
[4]:
https://github.com/unicode-org/icu/blob/main/docs/userguide/format_parse/numbers/skeletons.md#rounding-mode
* JSTests/stress/intl-durationformat-format-to-parts.js:
(Intl.DurationFormat.shouldBeOneOf):
* JSTests/stress/intl-durationformat-roundingMode.js: Added.
(sameValue):
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::collectElements):
Canonical link: https://commits.webkit.org/281955@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes