lau / tzdata

tzdata for Elixir. Born from the Calendar library.
MIT License
303 stars 71 forks source link

Invalid gap for the first naive datetime in the gap range #110

Closed LostKobrakai closed 3 years ago

LostKobrakai commented 3 years ago
iex(7)> DateTime.from_naive(~N[2020-03-29 02:00:01], "Europe/Berlin")
{:gap, #DateTime<2020-03-29 01:59:59.999999+01:00 CET Europe/Berlin>,
 #DateTime<2020-03-29 03:00:00+02:00 CEST Europe/Berlin>}
iex(8)> DateTime.from_naive(~N[2020-03-29 02:00:00], "Europe/Berlin")
{:gap, #DateTime<2019-10-27 02:59:59.999999+02:00 CEST Europe/Berlin>,
 #DateTime<2020-03-29 03:00:00+02:00 CEST Europe/Berlin>}
iex(9)> db = Calendar.get_time_zone_database()
Tzdata.TimeZoneDatabase
iex(10)> db.time_zone_periods_from_wall_datetime(~N[2020-03-29 02:00:00], "Europe/Berlin")
{:gap,
 {%{
    from_wall: ~N[2019-03-31 03:00:00],
    std_offset: 3600,
    until_wall: ~N[2019-10-27 03:00:00],
    utc_offset: 3600,
    zone_abbr: "CEST"
  }, ~N[2019-10-27 03:00:00]},
 {%{
    from_wall: ~N[2020-03-29 03:00:00],
    std_offset: 3600,
    until_wall: ~N[2020-10-25 03:00:00],
    utc_offset: 3600,
    zone_abbr: "CEST"
  }, ~N[2020-03-29 03:00:00]}}
iex(11)> Tzdata.tzdata_version
"2020d"