Update Rust crate chrono to 0.4.27 #167
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -739,9 +739,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[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",
|
||||||
@ -749,7 +749,7 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
"time 0.1.45",
|
"time 0.1.45",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"winapi",
|
"windows-targets 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -37,5 +37,5 @@ webauthn-rs = { version = "0.4.8", features = ["danger-allow-state-serialisation
|
|||||||
url = "2.4.1"
|
url = "2.4.1"
|
||||||
light-openid = { version = "1.0.1", features=["crypto-wrapper"] }
|
light-openid = { version = "1.0.1", features=["crypto-wrapper"] }
|
||||||
bincode = "2.0.0-rc.3"
|
bincode = "2.0.0-rc.3"
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.27"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
@ -16,8 +16,23 @@ pub fn fmt_time(timestamp: u64) -> String {
|
|||||||
NaiveDateTime::from_timestamp_opt(timestamp as i64, 0).expect("Failed to parse timestamp!");
|
NaiveDateTime::from_timestamp_opt(timestamp as i64, 0).expect("Failed to parse timestamp!");
|
||||||
|
|
||||||
// Create a normal DateTime from the NaiveDateTime
|
// Create a normal DateTime from the NaiveDateTime
|
||||||
let datetime: DateTime<Utc> = DateTime::from_utc(naive, Utc);
|
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive, Utc);
|
||||||
|
|
||||||
// Format the datetime how you want
|
// Format the datetime how you want
|
||||||
datetime.format("%Y-%m-%d %H:%M:%S").to_string()
|
datetime.format("%Y-%m-%d %H:%M:%S").to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use crate::utils::time::{fmt_time, time};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_time() {
|
||||||
|
assert!(time() > 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_fmt_time() {
|
||||||
|
assert_eq!(fmt_time(1693475465), "2023-08-31 09:51:05");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user