icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Add test illustrating mismatched time zone time and zoned datetime

Open sffc opened this issue 9 months ago • 3 comments

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 (https://github.com/unicode-org/icu4x/issues/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 from isdst, maybe things could go wrong.)

@robertbastian

sffc avatar Mar 06 '25 02:03 sffc