fix: update references to old from_time API
This commit is contained in:
parent
ccd20c118e
commit
42eabc9e33
2 changed files with 7 additions and 6 deletions
11
src/types.rs
11
src/types.rs
|
@ -511,20 +511,22 @@ mod test {
|
||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
#[test]
|
#[test]
|
||||||
fn datetime_from_time_bounds() {
|
fn datetime_from_time_bounds() {
|
||||||
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use super::DateTime;
|
use super::DateTime;
|
||||||
use time::macros::datetime;
|
use time::macros::datetime;
|
||||||
|
|
||||||
// 1979-12-31 23:59:59
|
// 1979-12-31 23:59:59
|
||||||
assert!(DateTime::from_time(datetime!(1979-12-31 23:59:59 UTC)).is_err());
|
assert!(DateTime::try_from(datetime!(1979-12-31 23:59:59 UTC)).is_err());
|
||||||
|
|
||||||
// 1980-01-01 00:00:00
|
// 1980-01-01 00:00:00
|
||||||
assert!(DateTime::from_time(datetime!(1980-01-01 00:00:00 UTC)).is_ok());
|
assert!(DateTime::try_from(datetime!(1980-01-01 00:00:00 UTC)).is_ok());
|
||||||
|
|
||||||
// 2107-12-31 23:59:59
|
// 2107-12-31 23:59:59
|
||||||
assert!(DateTime::from_time(datetime!(2107-12-31 23:59:59 UTC)).is_ok());
|
assert!(DateTime::try_from(datetime!(2107-12-31 23:59:59 UTC)).is_ok());
|
||||||
|
|
||||||
// 2108-01-01 00:00:00
|
// 2108-01-01 00:00:00
|
||||||
assert!(DateTime::from_time(datetime!(2108-01-01 00:00:00 UTC)).is_err());
|
assert!(DateTime::try_from(datetime!(2108-01-01 00:00:00 UTC)).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
|
@ -601,7 +603,6 @@ mod test {
|
||||||
// 2020-01-01 00:00:00
|
// 2020-01-01 00:00:00
|
||||||
let clock = OffsetDateTime::from_unix_timestamp(1_577_836_800).unwrap();
|
let clock = OffsetDateTime::from_unix_timestamp(1_577_836_800).unwrap();
|
||||||
|
|
||||||
assert!(DateTime::from_time(clock).is_ok());
|
|
||||||
assert!(DateTime::try_from(clock).is_ok());
|
assert!(DateTime::try_from(clock).is_ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ impl Default for FileOptions {
|
||||||
compression_method: CompressionMethod::Stored,
|
compression_method: CompressionMethod::Stored,
|
||||||
compression_level: None,
|
compression_level: None,
|
||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
last_modified_time: DateTime::from_time(OffsetDateTime::now_utc()).unwrap_or_default(),
|
last_modified_time: OffsetDateTime::now_utc().try_into().unwrap_or_default(),
|
||||||
#[cfg(not(feature = "time"))]
|
#[cfg(not(feature = "time"))]
|
||||||
last_modified_time: DateTime::default(),
|
last_modified_time: DateTime::default(),
|
||||||
permissions: None,
|
permissions: None,
|
||||||
|
|
Loading…
Add table
Reference in a new issue