File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 4
4
// Expose parse_datetime
5
5
pub mod parse_datetime;
6
6
7
- use chrono:: { Duration , Local , NaiveDate , Utc } ;
7
+ use chrono:: { Duration , Local , NaiveDate } ;
8
8
use regex:: { Error as RegexError , Regex } ;
9
9
use std:: error:: Error ;
10
10
use std:: fmt:: { self , Display } ;
@@ -92,7 +92,7 @@ impl From<RegexError> for ParseDurationError {
92
92
/// assert!(matches!(from_str("invalid"), Err(ParseDurationError::InvalidInput)));
93
93
/// ```
94
94
pub fn from_str ( s : & str ) -> Result < Duration , ParseDurationError > {
95
- from_str_at_date ( Utc :: now ( ) . date_naive ( ) , s)
95
+ from_str_at_date ( Local :: now ( ) . date_naive ( ) , s)
96
96
}
97
97
98
98
/// Parses a duration string and returns a `Duration` instance, with the duration
Original file line number Diff line number Diff line change 1
- use chrono:: { Duration , Utc } ;
1
+ use chrono:: { Duration , Utc , Local } ;
2
2
use parse_datetime:: { from_str, from_str_at_date, ParseDurationError } ;
3
3
4
4
#[ test]
@@ -128,7 +128,7 @@ fn test_display_should_fail() {
128
128
129
129
#[ test]
130
130
fn test_from_str_at_date_day ( ) {
131
- let today = Utc :: now ( ) . date_naive ( ) ;
131
+ let today = Local :: now ( ) . date_naive ( ) ;
132
132
let yesterday = today - Duration :: days ( 1 ) ;
133
133
assert_eq ! (
134
134
from_str_at_date( yesterday, "2 days" ) . unwrap( ) ,
You can’t perform that action at this time.
0 commit comments