Skip to main content

parse_date

Function parse_date 

Source
pub fn parse_date(src: &str) -> Option<(SimpleDate, DateFormat)>
Expand description

Recognizes a date written as text, returning both the date and the notation it was written in.

Returns None for anything that is not a date, which is how Sheet::commit decides whether a literal becomes a plain number or a number carrying a date format. Text that merely looks like a date is therefore quoted on import (xlsx::text_cell_src) to keep it text.

Recognizes - and / as separators, two- and three-part forms, and month names in either spelling; a two-digit year below 30 is read as 20xx, otherwise 19xx. Day and month are validated against the calendar, so 2/30/2026 is not a date.