chrono
chrono copied to clipboard
NaiveDate::parse_from_str with format "%d/%m/%Y" doesn't work
assert!(NaiveDate::parse_from_str("2015/9/31", "%Y/%m/%d").is_err());
assert!(NaiveDate::parse_from_str("10/10/2021", "%d/%m/%Y").is_err());
thread 'main' panicked at 'assertion failed: NaiveDate::parse_from_str("10/10/2021", "%d/%m/%Y").is_err()',
That is_err at the end means that the assertion will fail if the function was successful. The first statement was unsuccessful, probably because September only has 30 days. The second was successful.
The corollary to is_err would be is_ok, which is probably what you wanted
I believe this issue can be closed, there is nothing to do here.