Skip to content
Closed
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
10 changes: 5 additions & 5 deletions src/parse_relative_time.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use crate::ParseDateTimeError;
use chrono::{Duration, Local, NaiveDate, Utc};
use chrono::{Duration, Local, NaiveDate};
use regex::Regex;
/// Parses a relative time string and returns a `Duration` representing the
/// relative time.
Expand Down Expand Up @@ -40,7 +40,7 @@ use regex::Regex;
///
/// ```
pub fn parse_relative_time(s: &str) -> Result<Duration, ParseDateTimeError> {
parse_relative_time_at_date(Utc::now().date_naive(), s)
parse_relative_time_at_date(Local::now().date_naive(), s)
}

/// Parses a duration string and returns a `Duration` instance, with the duration
Expand Down Expand Up @@ -151,7 +151,7 @@ mod tests {

use super::ParseDateTimeError;
use super::{parse_relative_time, parse_relative_time_at_date};
use chrono::{Duration, Local, NaiveDate, Utc};
use chrono::{Duration, Local, NaiveDate};

#[test]
fn test_years() {
Expand Down Expand Up @@ -601,7 +601,7 @@ mod tests {

#[test]
fn test_parse_relative_time_at_date_day() {
let today = Utc::now().date_naive();
let today = Local::now().date_naive();
let yesterday = today - Duration::days(1);
assert_eq!(
parse_relative_time_at_date(yesterday, "2 days").unwrap(),
Expand All @@ -611,7 +611,7 @@ mod tests {

#[test]
fn test_invalid_input_at_date_relative() {
let today = Utc::now().date_naive();
let today = Local::now().date_naive();
let result = parse_relative_time_at_date(today, "foobar");
println!("{result:?}");
assert_eq!(result, Err(ParseDateTimeError::InvalidInput));
Expand Down