luifDuration

A filter to display a timespan or a moment.duration

Will try to transform the input to a moment.duration, if the resulting duration is not valid, it will return nothing

The arguments for this filter are :

If you do not provide a unit and precision it will use 'hour' as unit and 'minute' as precision. If you provide a unit but no precision it will use the next unit. For example 90 minutes and 45 seconds with unit='hour' will be displayed 1h30. the same duration with unit='minutes' will be displayed 90m45.

And the supported units are:

Usage

{{ myValue | luifDuration }}
{{ myValue | luifDuration : showSign : unit : precision }}

(enter '1.11:30:00' or 'PT35H30M' or such like)

Set myValue to 35h -30m

myValue : {{ myValue | luifDuration }}

myValue with unit='day': {{ myValue | luifDuration : false : 'd' }} - duration under the hour won't be displayed

myValue with unit='day' and precision='second': {{ myValue | luifDuration : false : 'd' : 's'}} - duration under the second won't be displayed

myValue with a sign: {{ myValue | luifDuration : true }}