Skip to content

API Reference


API Reference / @dasch-ng/utils / intl/src / IntlDurationPipe

Class: IntlDurationPipe ​

Defined in: libs/ng/utils/intl/src/lib/intl-duration.pipe.ts:49

Formats a duration with Intl.DurationFormat. Takes either a duration object or a number of milliseconds (split into hours, minutes, seconds). Use style: 'digital' for a timecode.

Needs Chrome 129, Safari 16.4 or Firefox 136 or later. Older browsers get a plain 1 hours 5 minutes style fallback.

Example ​

html
{{ { hours: 1, minutes: 5 } | intlDuration }}                  <!-- 1 hr, 5 min -->
{{ clip.durationMs | intlDuration: { style: 'digital' } }}     <!-- 0:02:14 -->
{{ 90_000 | intlDuration: { style: 'long' } : 'de-DE' }}       <!-- 1 Minute, 30 Sekunden -->

Extends ​

  • IntlPipeBase

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new IntlDurationPipe(): IntlDurationPipe

Returns ​

IntlDurationPipe

Inherited from ​

IntlPipeBase.constructor

Methods ​

locale() ​

protected locale(locale?): string

Defined in: libs/ng/utils/intl/src/lib/formatter-cache.ts:29

Parameters ​

locale? ​

string

Returns ​

string

Inherited from ​

IntlPipeBase.locale


transform() ​

transform(value, options?, locale?): string | null

Defined in: libs/ng/utils/intl/src/lib/intl-duration.pipe.ts:50

Parameters ​

value ​

number | IntlDurationValue | null | undefined

options? ​

DurationFormatOptions

locale? ​

string

Returns ​

string | null

Implementation of ​

PipeTransform.transform

Released under the MIT License.