[webkit-changes] [WebKit/WebKit] d0e99d: [JSC] `fractionalDigits` of `Intl.DurationFormat` ...

SUZUKI Sosuke noreply at github.com
Sun Jun 2 21:17:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d0e99dfc02abd030c519c3e459f087e842405338
      https://github.com/WebKit/WebKit/commit/d0e99dfc02abd030c519c3e459f087e842405338
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2024-06-02 (Sun, 02 Jun 2024)

  Changed paths:
    M JSTests/stress/intl-durationformat-digital.js
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp

  Log Message:
  -----------
  [JSC] `fractionalDigits` of `Intl.DurationFormat` should be treated as at most 9 digits if it is omitted
https://bugs.webkit.org/show_bug.cgi?id=274974

Reviewed by Yusuke Suzuki.

According to the spec[1], if the `fractionalDigits` option of `Intl.DurationFormat` is omitted, it
should be treated as at most 9 digits. However, in the current JSC, it is treated as exact 0 digits.

The README of the proposal repository[2] states the following:
> If this option is omitted, only nonzero decimals will be displayed and trailing zeroes will be omitted.

This patch changes to treat it as at most 9 digits, using the ICU's Fraction Precision notation[3].

[1]: https://tc39.es/proposal-intl-duration-format/#sec-partitiondurationformatpattern ( 4.f.ii.1.b )
[2]: https://github.com/tc39/proposal-intl-duration-format#parameters
[3]: https://github.com/unicode-org/icu/blob/main/docs/userguide/format_parse/numbers/skeletons.md#fraction-precision

* JSTests/stress/intl-durationformat-digital.js:
(Intl.DurationFormat.shouldBeOneOf.fmt.format):
(Intl.DurationFormat.shouldBeOneOf):
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::collectElements):

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



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


More information about the webkit-changes mailing list