Repository navigation
Reject nonexistent local datetime inputs - #406
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Attaching an IANA timezone with
datetime.replace(tzinfo=...)does not validate whether the local clock time exists. The tool currently accepts New York's skipped springtime 02:30 and returns a timestamp that converts back to 03:30. The same issue affects half-hour gaps and entire skipped dates, and propagates into conversion, shifting and differences.Change
Validate offset-free inputs when attaching their IANA timezone. PEP 495's transition rules distinguish a gap by an increase in the UTC offset from
fold=0tofold=1. Return the existing structured error output for these missing times.Keep the first occurrence of an ambiguous overlap, the authority of explicitly supplied offsets, and ordinary dates at the datetime range boundaries. Comparing the offsets avoids UTC round-trip overflow for valid local inputs in years 1 and 9999.
This validates input parsing. The separate shift-arithmetic change in #353 handles a valid input whose shifted result crosses a clock change; it is not included here.
Validation
diffinputs, overlap default behavior, explicit offsets and year-boundary controls.git diff --check, pass.