Functionutilsv0.10.0
parseDuration
Parses a short duration string like 24h, 30m, 90s, 7d, or 500ms into milliseconds.
The grammar is one or more digits followed by one lowercase unit (ms, s, m, h, d).
Anything else returns null, including a bare number, an unknown unit, an uppercase unit,
surrounding whitespace, a fractional value, and a result of zero.
parseDuration('24h'); // 86400000
parseDuration('30m'); // 1800000
parseDuration('1.5h'); // null
parseDuration('foo'); // nullinput
input: stringThe duration string to parse.