diff --git a/src/builtins/time.rs b/src/builtins/time.rs index dbf47af..b4c1e2e 100644 --- a/src/builtins/time.rs +++ b/src/builtins/time.rs @@ -1,4 +1,4 @@ -use chrono::{DateTime, Local, Utc}; +use chrono::{DateTime, Utc}; use crate::error::ShellError; @@ -27,9 +27,8 @@ fn format_time(time: DateTime, formatting: &str) -> String { #[cfg(test)] mod tests { - use std::str::FromStr; - use chrono::{NaiveDate, NaiveDateTime, NaiveTime, TimeZone}; + use chrono::TimeZone; use super::*; @@ -46,4 +45,10 @@ mod tests { "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") + } }