diff --git a/arrow-cast/src/parse.rs b/arrow-cast/src/parse.rs index b8f806a89cfc..a29b913920e7 100644 --- a/arrow-cast/src/parse.rs +++ b/arrow-cast/src/parse.rs @@ -479,19 +479,19 @@ const ERR_NANOSECONDS_NOT_SUPPORTED: &str = "The dates that can be represented a impl Parser for Date32Type { fn parse(string: &str) -> Option { - let date = string.parse::().ok()?; + let date = parse_date(string.as_bytes().try_into().ok()?).ok()?; Some(date.num_days_from_ce() - EPOCH_DAYS_FROM_CE) } fn parse_formatted(string: &str, format: &str) -> Option { - let date = chrono::NaiveDate::parse_from_str(string, format).ok()?; + let date = NaiveDate::parse_from_str(string, format).ok()?; Some(date.num_days_from_ce() - EPOCH_DAYS_FROM_CE) } } impl Parser for Date64Type { fn parse(string: &str) -> Option { - let date_time = string.parse::().ok()?; + let date_time = string_to_datetime(&Utc, string).ok()?; Some(date_time.timestamp_millis()) }