# `Intl.DurationFormat` update
### Ben Allen, 100th TC39
---
# Major refactor
* Current version of proposal has one AO, `PartitionDurationFormatPattern`, that has hard-to-read / hard-to-implement complexities
* Most of these complexities are related to the need for special handling when formatting units with `"numeric"` and `"2-digit"` styles
* The complexity of this AO has proved *quite annoying* for implementors
---
# Major refactor
* Refactor splits out handling for these styles into new AOs
* Additional refactor in progress: simplify`FormatNumericUnits` AO
---
# Why are `"numeric"`-like styles difficult?
* All other duration unit styles produce separated lists (in `'en'` these lists separated by commas and/or "and")
* `"numeric"`-like styles produce output resembling the display on a digital clock, with hour/minute and minute/second separators between them
---
* `df = new Intl.DurationFormat('en', {style: "short"}).format({hours: 1, minutes: 2, seconds: 3}) -->
"1 hr, 2 min, 3 sec"`
* `df = new Intl.DurationFormat('en', {hours: "numeric"}).format({hours: 1, minutes: 2, seconds: 3})
--> "1:02:03"`
---
# Why are `"numeric"`-like styles difficult?
* `"numeric"`-like formatting is a fundamentally different task than formatting the other styles, and the steps for handling it are likewise different
* Previously the steps for `"numeric"`-like and non-`"numeric"`-like had been intermixed, producing most of the frustrating complexity
---
# Other editorial (?) changes
* Alongside the refactor are potentially normative changes related to `"numeric"`-like formatting.
* Several new slots for locale-dependent information introduced, (largely) in preparation for a hypothetical DurationFormat.v2
---
# Other editorial (?) changes
* `[[HoursMinutesSeparator]]` and `[[MinutesSecondsSeparator]]`
* Some locales use different separators between hours/minutes and minutes/seconds.
* For example, `fr-CA` uses 'h' between hours and minutes, and 'm' between minutes and seconds
---
# Other editorial (?) changes
* `[HoursDigits]]`
* Some locales, notably 'af', use two-digit hours for clock-style formatting, i.e. "07:00" instead of "7:00". This slot allows us to produce properly-formatted output for those locales
---
# Other editorial (?) changes
* To ensure that this update is purely editorial, the current version has a note saying that `[[HoursMinutesSeparator]]` and `[[MinutesSecondsSeparator]]` must be the same, and a note saying that `[[HoursDigits]]` must be 1
---
# Reasoning
* Need to avoid major normative changes while at Stage 3
* However: Because both of these changes are about correctly formatting durations for all locales, this could be conceptualized as a bugfix
---
# Thanks!