|
@ -1,4 +1,4 @@ |
|
|
use chrono::{DateTime, Local, Utc};
|
|
|
|
|
|
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
|
|
|
|
|
use crate::error::ShellError;
|
|
|
use crate::error::ShellError;
|
|
|
|
|
|
|
|
@ -27,9 +27,8 @@ fn format_time(time: DateTime<Utc>, formatting: &str) -> String { |
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
#[cfg(test)]
|
|
|
mod tests {
|
|
|
mod tests {
|
|
|
use std::str::FromStr;
|
|
|
|
|
|
|
|
|
|
|
|
use chrono::{NaiveDate, NaiveDateTime, NaiveTime, TimeZone};
|
|
|
|
|
|
|
|
|
use chrono::TimeZone;
|
|
|
|
|
|
|
|
|
use super::*;
|
|
|
use super::*;
|
|
|
|
|
|
|
|
@ -46,4 +45,10 @@ mod tests { |
|
|
"Thu, 20 Apr 6969 04:20:09 +0000"
|
|
|
"Thu, 20 Apr 6969 04:20:09 +0000"
|
|
|
)
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_format_time_rfc3339() {
|
|
|
|
|
|
let time = chrono::Utc.with_ymd_and_hms(6969, 4, 20, 4, 20, 9).unwrap();
|
|
|
|
|
|
assert_eq!(format_time(time, "RFC3339"), "6969-04-20T04:20:09+00:00")
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|