Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5e50f4025022485232f83d9a40d824641aaa4bfa
      
https://github.com/WebKit/WebKit/commit/5e50f4025022485232f83d9a40d824641aaa4bfa
  Author: Sosuke Suzuki <aosuk...@gmail.com>
  Date:   2024-12-24 (Tue, 24 Dec 2024)

  Changed paths:
    A JSTests/stress/intl-durationformat-hourdisplay-auto.js
    M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp

  Log Message:
  -----------
  [JSC] `Intl.DurationFormat` should not print separator for hour unit when it 
isn't printed
https://bugs.webkit.org/show_bug.cgi?id=285078

Reviewed by Yusuke Suzuki.

When the `hourDisplay` option is `auto` and `hours` is 0,
the hours value is not printed. Therefore, the separator
that follows the hours should also not be printed.

However, in our current implementation, only the separator
is printed in that situation:

```js
// current behavior
const df = new Intl.DurationFormat('en-US', {
  style: "digital",
  hoursDisplay: "auto",
});
df.format({hours: 0, minutes: 1, seconds: 2}); // ":, 01:02"
```

This patch fixes that issue.

* JSTests/stress/intl-durationformat-hourdisplay-auto.js: Added.
(shouldBe):
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::collectElements):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to