diff --git a/src/lib.rs b/src/lib.rs index 614b355..cbd84d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ // Expose parse_datetime pub mod parse_datetime; -use chrono::{Duration, Local, NaiveDate, Utc}; +use chrono::{Duration, Local, NaiveDate}; use regex::{Error as RegexError, Regex}; use std::error::Error; use std::fmt::{self, Display}; @@ -92,7 +92,7 @@ impl From for ParseDurationError { /// assert!(matches!(from_str("invalid"), Err(ParseDurationError::InvalidInput))); /// ``` pub fn from_str(s: &str) -> Result { - from_str_at_date(Utc::now().date_naive(), s) + from_str_at_date(Local::now().date_naive(), s) } /// Parses a duration string and returns a `Duration` instance, with the duration diff --git a/tests/simple.rs b/tests/simple.rs index a538f9d..3d2afcd 100644 --- a/tests/simple.rs +++ b/tests/simple.rs @@ -1,4 +1,4 @@ -use chrono::{Duration, Utc}; +use chrono::{Duration, Local, Utc}; use parse_datetime::{from_str, from_str_at_date, ParseDurationError}; #[test] @@ -128,7 +128,7 @@ fn test_display_should_fail() { #[test] fn test_from_str_at_date_day() { - let today = Utc::now().date_naive(); + let today = Local::now().date_naive(); let yesterday = today - Duration::days(1); assert_eq!( from_str_at_date(yesterday, "2 days").unwrap(),