diff --git a/src/scalars/datetime.rs b/src/scalars/datetime.rs index 2067d3c4..8c02bd8c 100644 --- a/src/scalars/datetime.rs +++ b/src/scalars/datetime.rs @@ -1,6 +1,6 @@ use crate::{InputValueError, InputValueResult, ScalarType, Value}; use async_graphql_derive::Scalar; -use chrono::{DateTime, TimeZone, Utc}; +use chrono::{DateTime, Utc}; /// Implement the DateTime scalar /// @@ -8,8 +8,10 @@ use chrono::{DateTime, TimeZone, Utc}; #[Scalar(internal, name = "DateTimeUtc")] impl ScalarType for DateTime { fn parse(value: Value) -> InputValueResult { - match value { - Value::String(s) => Ok(Utc.datetime_from_str(&s, "%+")?), + match &value { + Value::String(s) => s + .parse::>() + .map_err(|_| InputValueError::ExpectedType(value)), _ => Err(InputValueError::ExpectedType(value)), } }