Skip to main content

parse_date

Function parse_date 

Source
pub fn parse_date(input: &str, today: Date) -> Date
Expand description

Parse a single date string. Handles:

  • ISO dates: 2025-12-31
  • Present: today
  • Past: yesterday, last friday, 7 days ago, 7d ago, 1 week ago
  • Future: tomorrow, next monday, in 3 days, in 7d, next week, next month

Note: Year-month formats like 2025-12 are periods, not dates. Use parse_period instead.

Returns today if the input cannot be parsed.