Skip to content

formatDuration

formatDuration(value, unit, options?): string

Defined in: packages/core/src/time/format-duration.ts:74

Formats value, expressed in unit, by selecting the largest unit whose magnitude is at least 1 and delegating to Intl.DurationFormat.

precision controls how many smaller units are shown alongside the selected one (e.g. "1s 234ms" for a duration of 1.234 seconds at the default precision of 3), rounding — with carry — the last one shown.

number

DurationUnit

FormatDurationOptions

string