Skip to main content

parse_range

Function parse_range 

Source
pub fn parse_range(
    range: Option<&str>,
    from: Option<&str>,
    to: Option<&str>,
    tz: Tz,
    now: DateTime<Utc>,
    dir: Direction,
) -> Result<(DateTime<Utc>, DateTime<Utc>), String>
Expand description

Resolve a named range, an Nd range, or explicit from/to bounds into a (start, end) UTC pair.

  • today / tomorrow: local midnight to the next local midnight.
  • this_week / next_week: Monday 00:00 local to the following Monday.
  • next: now to now + 14 days (callers take the first matching event).
  • Nd (e.g. 3d): now - N days to now when dir is Past (mail), or now to now + N days when dir is Future (calendar).
  • from/to: ISO 8601 date or datetime, naive values interpreted in tz; the end date is inclusive of its whole day.