Function parse_yyyy_mm_dd

Source
pub fn parse_yyyy_mm_dd(input: &str) -> Option<DateValue>
Expand description

Parses an exact decimal year-month-day date with a valid month and day.

Returns None for missing or extra components, numeric parse failures, or an out-of-range month/day. Surrounding whitespace and + signs follow the underlying integer parsers; callers needing a stricter wire format should validate the original string separately.

ยงExamples

use ailloli_ui_core::date_picker::parse_yyyy_mm_dd;
use ailloli_ui_core::DateValue;

assert_eq!(parse_yyyy_mm_dd("2024-02-29"), Some(DateValue::new(2024, 2, 29)));
assert_eq!(parse_yyyy_mm_dd("2023-02-29"), None);