Bugfix - JSON datetime string. (#2180)

This commit is contained in:
Finn Bear 2023-06-26 04:02:26 -07:00 committed by GitHub
parent 6d5dcfadd9
commit a10d6df430
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -341,14 +341,14 @@ fn into_json(value: Value, simplify: bool) -> JsonValue {
Value::Number(Number::Float(n)) => n.into(), Value::Number(Number::Float(n)) => n.into(),
Value::Number(Number::Decimal(n)) => json!(n), Value::Number(Number::Decimal(n)) => json!(n),
Value::Strand(strand) => match simplify { Value::Strand(strand) => match simplify {
true => strand.0.into(), true => strand.to_raw().into(),
false => json!(strand), false => json!(strand),
}, },
Value::Duration(d) => match simplify { Value::Duration(d) => match simplify {
true => d.to_string().into(), true => d.to_string().into(),
false => json!(d), false => json!(d),
}, },
Value::Datetime(d) => json!(d), Value::Datetime(d) => d.to_raw().into(),
Value::Uuid(uuid) => json!(uuid), Value::Uuid(uuid) => json!(uuid),
Value::Array(arr) => JsonValue::Array(Array::from((arr, simplify)).0), Value::Array(arr) => JsonValue::Array(Array::from((arr, simplify)).0),
Value::Object(obj) => JsonValue::Object(Object::from((obj, simplify)).0), Value::Object(obj) => JsonValue::Object(Object::from((obj, simplify)).0),

View file

@ -91,7 +91,7 @@ impl Datetime {
impl Display for Datetime { impl Display for Datetime {
fn fmt(&self, f: &mut Formatter) -> fmt::Result { fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&quote_str(&self.0.to_rfc3339_opts(SecondsFormat::AutoSi, true)), f) Display::fmt(&quote_str(&self.to_raw()), f)
} }
} }