Skip to content

Commit ba26e17

Browse files
committed
fix: replace use of deprecated function
1 parent 329e2ce commit ba26e17

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

graph-gateway/src/subscriptions.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::str::FromStr;
22

33
use alloy_primitives::Address;
4-
use chrono::{DateTime, NaiveDateTime, TimeZone as _, Utc};
4+
use chrono::{DateTime, Utc};
55
use serde::{de::Error, Deserialize, Deserializer};
66

77
#[derive(Clone, Debug)]
@@ -39,10 +39,9 @@ where
3939
D: Deserializer<'de>,
4040
{
4141
let input = String::deserialize(deserializer)?;
42-
let timestamp = input.parse::<u64>().map_err(D::Error::custom)?;
43-
NaiveDateTime::from_timestamp_opt(timestamp.try_into().map_err(D::Error::custom)?, 0)
42+
let timestamp = input.parse::<i64>().map_err(D::Error::custom)?;
43+
DateTime::<Utc>::from_timestamp(timestamp, 0)
4444
.ok_or_else(|| D::Error::custom("invalid timestamp"))
45-
.map(|t| Utc.from_utc_datetime(&t))
4645
}
4746

4847
fn deserialize_u128<'de, D>(deserializer: D) -> Result<u128, D::Error>

0 commit comments

Comments
 (0)