There are three lengths that can be used when formatting a duration.
Formats a Duration using the specified Length and Locale
import Cldr.Locale exposing (en)
format Long en { zero | hours = 1, minutes = 30}
--> "1 hour, 30 minutes"An empty duration. All units are set to 0.
A duration that can be formatted.
To be consistent with
Intl.DurationFormat, years are the largest units. This only accepts integers for the various units, which is consistent with passing an object intoIntl.DurationFormat. The browser'sIntl.DurationFormatcan also accept an ISO8601 duration string directly (which can have decimals in the numbers), although JS has the "luxury" of simply throwing an error if you provide a combination of decimals that it doesn't know how to handle. To use this library, you have to turn "1.5 hours" into{zero | hours = 1, minutes = 30}yourself.