Skip to main content

parse_duration

Function parse_duration 

Source
pub fn parse_duration(x: &Value) -> Option<Duration>
Expand description

Parse a duration string: Dataview’s <number> <unit> pairs, each pair separated from the next by spaces, a comma, or nothing ("1h30m", "2 days, 3 hours"; a trailing separator is malformed), units case-insensitive: y|yr|yrs|year|years, mo|mos|month|months, w|wk|wks|week|weeks, d|day|days, h|hr|hrs|hour|hours, m|min|mins|minute|minutes, s|sec|secs|second|seconds — or an ISO-8601 duration (P1DT2H, PT90M, P2W). None when it is neither.