Fix skipping day when parsing times if UTC and TIMEZONE day are different #1183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should fix #1169
If only a time is provided such as "8pm", the previous logic determines if the time is in the "future" or "past" by comparing the base time of day and the parsed time.
This works if the timezone is UTC, but to make this respect the TIMEZONE setting, #1002 subtracts the timezone's offset from the parsed time. If this causes the day to roll over, then comparing times will incorrectly report the parsed date as being in the past. For example.
datetime(2023, 2, 3, 4).time() == datetime.time(4, 0)
is reported as earlier thamdatetime(2023, 2, 2, 18).time() == datetime.time(18, 0)
, and erroneously adding day. To correct this, we could compare dates rather than times.