Skip to main content

parse_date_not_in_past

Function parse_date_not_in_past 

Source
pub fn parse_date_not_in_past(input: &str) -> Result<NaiveDate>
Expand description

Parses a date and rejects values that fall in the past.

Separating the “past date” check from parsing allows the error message to reference the original user input alongside the interpreted date, rather than only showing the resolved value.

Use this for add (new tasks must have a future due date). Use parse_date for edit (correcting an already-overdue task is valid).

§Errors

Returns an error if the date is before today, naming both what was typed and what was interpreted.