• Parse a string containing a list of duration measures separated by whitespaces.

    A measure is a number followed by the unit (no whitespace between is allowed). Every measure is accumulated into a duration. The string is allowed to contain any number of measures with the same unit in no particular order.

    The supported units are:

    • ms for milliseconds
    • s for seconds
    • m for minutes
    • h for hours
    • d for days

    Example

    The duration of 10 days, 1 hour, 2 minutes and 7 seconds is:

    "10d 1h 2m 7s"
    

    Throws

    The format of the string is not matching the format.

    Returns

    Parameters

    • durationString: string

      string representing a duration.

    Returns Duration

Generated using TypeDoc