Skip to main content

Module query

Module query 

Source
Expand description

Date query parsing for CLI applications.

Provides flexible date and period parsing for command-line flags like --date, --from, --to, and --in. Designed for AI agent consumption.

§Supported Formats

§Single Date (parse_date)

  • 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

§Period (parse_period)

  • Year-month: 2025-12 (full month range)
  • Quarter: 2025-Q1
  • Natural language: this week, last week, this month, last month, yesterday

Structs§

DateParseError
Error returned when a date string cannot be parsed.
Period
A date range representing a reporting period.
PeriodParseError
Error returned when a period string cannot be parsed.

Functions§

parse_date
Parse a single date string. Handles:
parse_period
Parse period strings for --in flag:
try_parse_date
Try to parse a single date string. Handles:
try_parse_period
Try to parse period strings for --in flag: