• Parses a duration string and converts it to milliseconds.

    The duration string can contain multiple time units, such as "1h 30m" or "2 days 3 hours". Supported time units are:

    • ms, s, sec, secs, second, seconds
    • m, min, mins, minute, minutes
    • h, hr, hrs, hour, hours
    • d, day, days
    • w, wk, wks, week, weeks
    • mo, month, months
    • y, yr, yrs, year, years

    Parameters

    • durationString: string

      The duration string to parse.

    Returns number

    The total duration in milliseconds.

    Throws a syntax error if an unknown time unit is encountered.

    Throws a syntax error if no valid duration is found inside of the duration string.