Add test illustrating mismatched time zone time and zoned datetime #6239
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.
I realized that ZonedDateTime can contain two different datetimes: the "main" datetime and the reference datetime for the time zone.
It's fairly easy to get into this state. For example, someone might pick "Unix epoch" or "current datetime" to put into the fairly obscure
at_time
function when constructing their TimeZoneInfo, which is almost always wrong.This might be partially mitigated if we change the reference datetime to be an absolute time (#6238) so that there isn't a categorical mismatch, but it can still happen.
Maybe fine to ignore. If people use
infer_zone_offsets
, they won't get a specific non-location zone name that is wrong, only not applicable at the given time, which is confusing but not wrong. (However, if they pull the zone variant fromisdst
, maybe things could go wrong.)@robertbastian