More flexible datetime parsing (#4533)

This commit is contained in:
François-Xavier Talbot
2025-10-09 21:01:07 +01:00
committed by GitHub
parent 1a72d55e2d
commit c88bdda3e6

View File

@@ -34,7 +34,7 @@ where
serde_json::from_str::<DateTime<Utc>>(&format!("\"{s}\"")) serde_json::from_str::<DateTime<Utc>>(&format!("\"{s}\""))
.or_else(|_| { .or_else(|_| {
NaiveDateTime::parse_from_str(&s, "%Y-%m-%dT%H:%M:%S%.9f") NaiveDateTime::parse_from_str(&s, "%Y-%m-%dT%H:%M:%S%.f")
.map(|date| date.and_utc()) .map(|date| date.and_utc())
}) })
.map_err(serde::de::Error::custom) .map_err(serde::de::Error::custom)