1 of 6

Intl.DurationFormat Normative PR

Ben Allen, 104th TC39

2 of 6

402 Normative PRs

Ben Allen

Normative: turn useGrouping *false* for hours & smaller units when style is 2-digits or numeric

3 of 6

402 Normative PRs

Ben Allen

  • The "digital" style option in Intl.DurationFormat is used to display durations as on a digital clock:

new Intl.DurationFormat('en', {style: "digital"}).format({hours: 1, minutes: 2, seconds: 3})

// "1:02:03"

  • If users enter durations with very large values for hours, minutes, or seconds, currently the duration is formatted using grouping separators. These badly break the digital clock metaphor

new Intl.DurationFormat('en', {style: "digital"}).format({hours: 1, minutes: 2, seconds: 30000000})

// "1:02:30,000,000"

The issue

4 of 6

402 Normative PRs

Ben Allen

  • This PR sets "useGrouping" to false when using the "digital" style, and the associated "numeric" and "2-digit" styles for individual units.

The solution

5 of 6

402 Normative PRs

Ben Allen

  • This issue is embarrassing for two reasons:
  • We didn’t catch it sooner
  • I accidentally merged it early
  • We don’t anticipate this PR failing to get consensus, but if so I can back it out.
    • Sorry!

The embarrassment

6 of 6