Skip to main content

parse_range_with_granularity

Function parse_range_with_granularity 

Source
pub fn parse_range_with_granularity(
    input: &str,
    now: &Zoned,
) -> Result<(Zoned, Zoned), ParseError>
Expand description

Parse any expression and resolve it as a range with implicit granularity.

This is the API used by the td range subcommand. It accepts any expression type (not just Range variants) and applies granularity expansion based on the smallest unspecified time unit:

  • "tomorrow" -> day granularity (00:00:00..23:59:59)
  • "tomorrow at 18h" -> hour granularity (18:00:00..18:59:59)
  • "tomorrow at 18:30" -> minute granularity (18:30:00..18:30:59)
  • "now" -> instant (now..now)
  • "this week" -> week range (Monday..Sunday)