Fix #403
The parse function only works with naive times, so this provides timezone information to compute the offset from utc and provide _correct_for_time_frame with the utc time instead of local time as _correct_for_time_frame checks if the time has passed in utc.
This fixes #403
Could you please include a test for the fix?
Codecov Report
Merging #1002 (50c3872) into master (8af4f29) will increase coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #1002 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 234 234
Lines 2694 2697 +3
=======================================
+ Hits 2648 2651 +3
Misses 46 46
| Impacted Files | Coverage Δ | |
|---|---|---|
| dateparser/date_parser.py | 93.75% <100.00%> (ø) |
|
| dateparser/parser.py | 99.01% <100.00%> (+<0.01%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 8af4f29...50c3872. Read the comment docs.
Thanks for the comments.
- I have renamed ptz to tz.
- I passed tz to
_correct_for_time_frameto do the shift inside the method. (This looks much better indeed!) - I have added two tests that fail on master but pass with these fixes. (One for 'future' and for 'past' prefer_dates_from setting.) I wasn't sure where to put them, they're currently at the bottom of the
test_date_parser.pyfile.