fixed usages of deprecated chrono DateTime::from_utc (#10161)

This addresses the warnings generated from using DateTime::from_utc.
DateTime::from_utc was deprecated as of chrono 0.4.27

Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
Jack Wright 2023-08-30 15:04:19 -07:00 committed by GitHub
parent b943cbedff
commit fd4ba0443d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

10
Cargo.lock generated
View file

@ -565,16 +565,16 @@ dependencies = [
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.26" version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
"num-traits", "num-traits",
"pure-rust-locales", "pure-rust-locales",
"serde", "serde",
"winapi", "windows-targets 0.48.1",
] ]
[[package]] [[package]]
@ -3998,9 +3998,9 @@ dependencies = [
[[package]] [[package]]
name = "pure-rust-locales" name = "pure-rust-locales"
version = "0.5.6" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b45c49fc4f91f35bae654f85ebb3a44d60ac64f11b3166ffa609def390c732d8" checksum = "4b856d7d028ebb0011d78eded5bc9185932412f36c12c67930f222d6b407526b"
[[package]] [[package]]
name = "pwd" name = "pwd"

View file

@ -912,7 +912,8 @@ fn series_to_values(
} }
} }
}; };
let datetime = DateTime::<FixedOffset>::from_utc(naive_datetime, offset); let datetime =
DateTime::<FixedOffset>::from_naive_utc_and_offset(naive_datetime, offset);
Value::Date { Value::Date {
val: datetime, val: datetime,
@ -982,7 +983,8 @@ fn series_to_values(
} }
} }
}; };
let datetime = DateTime::<FixedOffset>::from_utc(naive_datetime, offset); let datetime =
DateTime::<FixedOffset>::from_naive_utc_and_offset(naive_datetime, offset);
Value::Date { Value::Date {
val: datetime, val: datetime,

View file

@ -3993,7 +3993,7 @@ mod tests {
#[test] #[test]
fn test_datetime() { fn test_datetime() {
let string = Value::Date { let string = Value::Date {
val: DateTime::from_utc( val: DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_millis(-123456789).unwrap(), NaiveDateTime::from_timestamp_millis(-123456789).unwrap(),
FixedOffset::east_opt(0).unwrap(), FixedOffset::east_opt(0).unwrap(),
), ),
@ -4010,7 +4010,7 @@ mod tests {
#[test] #[test]
fn test_negative_year_datetime() { fn test_negative_year_datetime() {
let string = Value::Date { let string = Value::Date {
val: DateTime::from_utc( val: DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_millis(-72135596800000).unwrap(), NaiveDateTime::from_timestamp_millis(-72135596800000).unwrap(),
FixedOffset::east_opt(0).unwrap(), FixedOffset::east_opt(0).unwrap(),
), ),