Skip to content

Commit

Permalink
chore: replace deprecated chrono functions (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
hal3e authored Aug 29, 2023
1 parent 0a76e92 commit 9595252
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Inflector = "0.11.4"
async-trait = { version = "0.1.73", default-features = false }
bech32 = "0.9.1"
bytes = { version = "1.4.0", default-features = false }
chrono = "0.4.26"
chrono = "0.4.27"
elliptic-curve = { version = "0.13.5", default-features = false }
eth-keystore = "0.5.0"
fuel-abi-types = "0.3.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/fuels-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ rust-version = { workspace = true }
description = "Fuel Rust SDK core."

[dependencies]
bech32 = "0.9.0"
chrono = "0.4.2"
bech32 = { workspace = true }
chrono = { workspace = true }
fuel-abi-types = { workspace = true }
fuel-asm = { workspace = true }
fuel-core = { workspace = true, default-features = false, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/fuels-core/src/types/wrappers/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Header {
impl From<ClientHeader> for Header {
fn from(client_header: ClientHeader) -> Self {
let naive = NaiveDateTime::from_timestamp_opt(client_header.time.to_unix(), 0);
let time = naive.map(|time| DateTime::<Utc>::from_utc(time, Utc));
let time = naive.map(|time| DateTime::<Utc>::from_naive_utc_and_offset(time, Utc));

Self {
id: client_header.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl From<ClientTransactionResponse> for TransactionResponse {
ClientTransactionStatus::Success { time, .. }
| ClientTransactionStatus::Failure { time, .. } => {
let native = NaiveDateTime::from_timestamp_opt(time.to_unix(), 0);
native.map(|time| DateTime::<Utc>::from_utc(time, Utc))
native.map(|time| DateTime::<Utc>::from_naive_utc_and_offset(time, Utc))
}
};

Expand Down
5 changes: 4 additions & 1 deletion packages/fuels/tests/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,10 @@ fn given_a_message(address: Bech32Address, message_amount: u64) -> Message {

fn convert_to_datetime(timestamp: u64) -> DateTime<Utc> {
let unix = Tai64(timestamp).to_unix();
DateTime::from_local(NaiveDateTime::from_timestamp_opt(unix, 0).unwrap(), Utc)
NaiveDateTime::from_timestamp_opt(unix, 0)
.unwrap()
.and_local_timezone(Utc)
.unwrap()
}

/// This test is here in addition to `can_set_custom_block_time` because even though this test
Expand Down

0 comments on commit 9595252

Please sign in to comment.