Template helper duration


Outputs a duration

Duration - implictly in milliseconds

{{duration d}}

Duration with explicit input date unit type

{{duration d input="s"}}

Amount of date units in duration

{{duration d "seconds"}}
{{duration d "minutes"}}
{{duration d "years"}}
{{duration d get="seconds"}}
{{duration d "s"}}

Duration as date units

{{duration d "asseconds"}}
{{duration d "asminutes"}}
{{duration d "asyears"}}
{{duration d as="seconds"}}

Humanize duration output

{{duration d "humanize"}}
{{duration d "humanize" true}}
{{duration d suffix=true}}

Manipulate durations

{{duration d add=damount as="milliseconds"}}
{{duration d subtract=damount as="seconds"}}
{{duration d subtract=damount as="days"}}
Name Type Attributes Default Description
duration string <optional>

Length of duration

input string <optional>

Unit of duration

add number <optional>
subtract number <optional>
addunit|addparam number <optional>
subtractunit|subtractparam number <optional>
as string <optional>

Sets duration method to as

get string <optional>

Sets duration method to get

humanize string <optional>

Sets duration method to humanize

suffix boolean <optional>