Skip to content
GitHub

FormatDurationOptions

interface in meocord/common Since 4.3.0

interface FormatDurationOptions

How formatDuration writes a duration.

Members

units

units?: number

How many units to show, largest first: 2 unless given, Infinity for every unit down to smallest.

largest

largest?: DurationUnit

The largest unit shown: 'd' unless given, so ten days read 10d.

smallest

smallest?: DurationUnit

The smallest unit shown: 's' unless given, so 1500 ms reads 1s.

round

round?: keyof typeof ROUNDING

How the value is rounded at the smallest unit shown: 'down' unless given.

style

style?: typeof STYLES[number]

'narrow' (the default) writes 1h 5m; 'long' writes 1 hour, 5 minutes, joined as the locale's catalog joins them; 'param' writes 1h5m, which a {x:duration} param reads back, never translated, for a value up to Number.MAX_SAFE_INTEGER.

t

t?: Translator<any>

The translator, for a Locale target or to use another than the target's app's.