## `Intl.DurationFormat`
## Stage 3 Update
#### TC39 May 2023
---
### Refresher to `DurationFormat`
* Stage 3 `Intl` proposal.
* Need to format compound durations.
* Eventual formatter for `Temporal.Duration` objects.
* Implementations:
* [JSC](https://bugs.webkit.org/show_bug.cgi?id=214794)
* [Ladybird LibJS](https://github.com/SerenityOS/serenity/pull/14437)
* [SpiderMonkey](https://bugzilla.mozilla.org/show_bug.cgi?id=1648139)
* [V8](https://crbug.com/v8/11660)
---
### Refresher to `DurationFormat`
```javascript
new Intl.DurationFormat("gl", { style: "long" }).format({
hours: 1,
minutes: 46,
seconds: 40,
});
// => "1 hora, 46 minutos e 40 segundos"
```
---
### [Switch to min/max fraction digits](https://github.com/tc39/proposal-intl-duration-format/pull/145)
* Based on feedback from [SFC](https://github.com/tc39/proposal-intl-duration-format/issues/144) and [ABL](https://github.com/tc39/proposal-intl-duration-format/issues/149).
* Original design had a single `fractionalDigits` option.
* Not setting `fractionalDigits` would set the minimum to 0 and maximum to 9.
* This works fine but is a bit of an odd design and doesn't give the programmer full control.
* Discussed extensively in TG2 and conclusion was to move to the tried and tested min/max pair instead.
---
### [Throw on invalid unit options](https://github.com/tc39/proposal-intl-duration-format/pull/148)
* Based on feedback from [FYT](https://github.com/tc39/proposal-intl-duration-format/issues/142).
* It was possible to set the display option to `"always"` for fractional sub-second units.
* This makes little sense, the display of these units is instead being controlled by the `fractionalDigits` option.
* Slightly odd and might lead to user confusion.
* Extensive discussion in TG2 led to the conclusion to throw `RangeError`.
---
### A bit of editorial goodness
* Break up the huge table to make it look less like a brick wall.
* Cleanup list formatting logic to be less hacky and more straightforward.
* Fix the handling of the separator used for digital style.
---
## Plan
* Get consensus on these last normative fixes.
* Clean up as much as possible editorially.
* Give some time for spec stability while working with implementations to ensure they're close to done.
* Come back next month for Stage 4.
---
# Consensus?
{"type":"slide","slideOptions":{"transition":"slide","theme":"igalia","controlsLayout":"edges","slideNumber":"c/t"}}