pub fn parse_date_filter(date_str: &str) -> Result<NaiveDate>Expand description
Parse date filter from string
Accepts dates in YYYY-MM-DD or YYYY-MM format. For YYYY-MM format, defaults to the first day of the month.
§Arguments
date_str- Date string to parse
§Returns
A parsed NaiveDate or an error if the format is invalid
§Example
use ccstat::cli::parse_date_filter;
use chrono::Datelike;
let date = parse_date_filter("2024-01-15").unwrap();
assert_eq!(date.year(), 2024);
assert_eq!(date.day(), 15);
let date = parse_date_filter("2024-01").unwrap();
assert_eq!(date.year(), 2024);
assert_eq!(date.month(), 1);
assert_eq!(date.day(), 1);