File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -200,9 +200,7 @@ pub fn parse_datetime_at_date<S: AsRef<str> + Clone>(
200
200
// Parse epoch seconds
201
201
if let Ok ( timestamp) = parse_timestamp ( s. as_ref ( ) ) {
202
202
if let Some ( timestamp_date) = NaiveDateTime :: from_timestamp_opt ( timestamp, 0 ) {
203
- if let Ok ( dt) = naive_dt_to_fixed_offset ( date, timestamp_date) {
204
- return Ok ( dt) ;
205
- }
203
+ return Ok ( date. offset ( ) . from_utc_datetime ( & timestamp_date) ) ;
206
204
}
207
205
}
208
206
@@ -319,6 +317,14 @@ mod tests {
319
317
let actual = parse_datetime ( dt) ;
320
318
assert_eq ! ( actual. unwrap( ) . timestamp( ) , TEST_TIME ) ;
321
319
}
320
+
321
+ #[ test]
322
+ fn test_epoch_seconds_non_utc ( ) {
323
+ env:: set_var ( "TZ" , "EST" ) ;
324
+ let dt = "@1613371067" ;
325
+ let actual = parse_datetime ( dt) ;
326
+ assert_eq ! ( actual. unwrap( ) . timestamp( ) , TEST_TIME ) ;
327
+ }
322
328
}
323
329
324
330
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments