Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -92,7 +92,7 @@ impl From<RegexError> for ParseDurationError {
/// assert!(matches!(from_str("invalid"), Err(ParseDurationError::InvalidInput)));
/// ```
pub fn from_str(s: &str) -> Result<Duration, ParseDurationError> {
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
Expand Down
4 changes: 2 additions & 2 deletions tests/simple.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use chrono::{Duration, Utc};
use chrono::{Duration, Local, Utc};
use parse_datetime::{from_str, from_str_at_date, ParseDurationError};

#[test]
Expand Down Expand Up @@ -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(),
Expand Down