Skip to main content

parse_period

Function parse_period 

Source
pub fn parse_period(period: &str) -> Result<(NaiveDate, NaiveDate), String>
Expand description

Parse a calendar-period shortcut into an inclusive (start, end) range.

Accepted forms (case-insensitive on the suffix):

  • YYYY — the full calendar year.
  • YYYYQ1 / Q2 / Q3 / Q4 — that calendar quarter.
  • YYYYH1 / H2 — the first or second half of the year.