Skip to main content

parse_duration_string

Function parse_duration_string 

Source
pub fn parse_duration_string(s: &str) -> Option<Duration>
Expand description

v0.7.0 (issue #518) — parse a duration string of the form "<integer><unit>" into a chrono::Duration. Supported units: s (seconds), m (minutes), h (hours), d (days), w (weeks). Whitespace and case are tolerated. Returns None on malformed input — the caller falls through to “no since filter applied”.

Intentionally a small bespoke parser rather than a humantime dependency: the surface we need is tiny (4-5 units) and operators expect the same shape they already type into --since flags.