Pudu programming language
Menu
API reference

Std.Human.parseDuration

1 declaration

fn

parseDuration: Str -> Result[Std.Time.Duration, Std.Human.HumanError]

A duration read from text such as 90s, 1h30m, 1.5h, 2d 4h, or -250ms.

It is a run of number-and-unit pairs, with spaces admitted between and within them, optionally preceded by one sign; the units are ms, s, m, h, d (24 hours), and w (7 days). Each pair must come to whole milliseconds. m is minutes: a month has no fixed length, so no unit here claims one. The text describe in Std.Time writes reads back to the same duration.

Back to Std.HumanSearch related declarations