Skip to main content

getDurationFrom

Stentor API Reference


Stentor API Reference / stentor-utils/src / getDurationFrom

Function: getDurationFrom()

getDurationFrom(iso8601Duration, groupBy): Duration

Defined in: packages/stentor-utils/src/date-time/getDurationFrom.ts:23

Parses the string, if in the ISO-8601 duration format, and returns a stentor-models#Duration object. If the provided string is not a duration string, it returns undefined.

https://stackoverflow.com/a/29153059/1349766

Parameters​

iso8601Duration​

string

groupBy​

GetDurationGroupBy = GetDurationGroupBy.Largest

If there are multiple duration formats specified, you can combine them by either the largest or smallest, defaults to largest.

Returns​

Duration

A duration object or undefined if the string is not of expected format.