Closed ethan-readyset closed 3 months ago
Upon further digging, it appears this is due to zoneinfo_parse
: https://github.com/chronotope/parse-zoneinfo/blob/95f488543b3a093890c004c615c74717a76bc8a1/src/transitions.rs#L15-L20
Ugh, sorry for that -- we should probably reconsider that choice.
This is likely the cause of: https://github.com/chronotope/chrono-tz/issues/135.
Maybe we should expose some API from chrono (which has a parser internally) so we can use that?
This are two things that I hope to work on, but there are plenty of things to do first for the coming months. Chrono already has most of the code to use the system time zone database, we just don't expose it yet.
And I've got the basics down for a rewrite of this crate that uses rules instead of a large table of transition dates. That would reduce the size added to the binary by ca. 90% and allow us to handle dates without an arbitrary cutoff point such as 2099.
Closing as a duplicate of #135. Thank you @westy92 for investigating!
Background When testing with the
America/New_York
time zone, I'm seeing some surprising results when it comes to daylight savings times. Since 2007 in the United States, daylight savings time begins on the second Sunday in March at 02:00 local time. My testing shows that, for the years between 2007 and 2099 (inclusive), the following passes:Adding one day to the original
naive_dt
produces a timestamp with timezoneEDT
, which is theAmerica/New_York
timezone when daylight savings is active.However, beginning with year 2100 for datetimes on the second Sunday in March at 02:00,
TIMEZONE.from_local_datetime(&naive_dt).single()
returnsSome
and produces a datetime with the timezoneEST
, which is theAmerica/New_York
timezone when daylight savings is not active. Timestamps after this one but before the end of daylight savings within the same year continue to haveEST
timezones, even though I'd expect them to beEDT
.Is this a known limitation of chrono-tz, or am I just misunderstanding how daylight savings time should work?
Minimal Reproducible Example
Versions
rustc
: 1.70.0-nightlychrono
: 0.4.37chrono-tz
: 0.8.6