Code cleanup
This commit is contained in:
parent
766fd8ea7d
commit
7581ecf331
|
@ -15,7 +15,7 @@ use serde::{Deserialize, Deserializer, Serialize};
|
|||
use ts_rs::TS;
|
||||
|
||||
pub(crate) mod packed_time {
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::de::Error;
|
||||
use serde::{Deserialize, Deserializer, Serializer};
|
||||
|
||||
|
@ -30,15 +30,12 @@ pub(crate) mod packed_time {
|
|||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Ok(DateTime::<Utc>::from_naive_utc_and_offset(
|
||||
NaiveDateTime::from_timestamp_millis(
|
||||
DateTime::<Utc>::from_timestamp_millis(
|
||||
String::deserialize(deserializer)?
|
||||
.parse::<i64>()
|
||||
.map_err(Error::custom)?,
|
||||
)
|
||||
.ok_or_else(|| Error::custom("millisecond value out of range"))?,
|
||||
Utc,
|
||||
))
|
||||
.ok_or_else(|| Error::custom("millisecond value out of range"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue