Skip to main content

parse_date

Function parse_date 

Source
pub fn parse_date(
    input: &str,
    now: OffsetDateTime,
) -> Result<OffsetDateTime, String>
Expand description

Parses a date string into an OffsetDateTime at midnight UTC.

Supported formats:

  • ISO date: “2026-01-15”
  • Relative: “today”, “yesterday”
  • Day reference: “last monday”, “last tuesday”, etc.

The now parameter is injected for testability.