Skip to content

possible bug in timezone #36

@gregors

Description

@gregors

When doing the following I get TZ to blow up

DateTime.new!(~D[1974-01-01], ~T[00:00:00], "America/Jamaica")

** (FunctionClauseError) no function clause matching in Tz.TimeZoneDatabase.find_period_for_wall_secs/2    
    
    The following arguments were given to Tz.TimeZoneDatabase.find_period_for_wall_secs/2:
    
        # 1
        62293449600
    
        # 2
        []
    
    Attempted function clauses (showing 2 out of 2):
    
        defp find_period_for_wall_secs(_, [{0, period, _, _}])
        defp find_period_for_wall_secs(secs, [
      {utc_secs, period = {utc_off, std_off, _}, prev_period = {prev_utc_off, prev_std_off, _},
       rules_and_template}
      | tail
    ])
    
    (tz 0.28.1) lib/tz/time_zone_database.ex:57: Tz.TimeZoneDatabase.find_period_for_wall_secs/2
    (tz 0.28.1) lib/tz/time_zone_database.ex:29: Tz.TimeZoneDatabase.find_period_for_secs/3
    (elixir 1.19.1) lib/calendar/datetime.ex:572: DateTime.from_naive/3
    (elixir 1.19.1) lib/calendar/datetime.ex:361: DateTime.new!/4
    iex:7: (file)

However the following works

 time = DateTime.new!(~D[1974-01-01], ~T[00:00:00], "America/New_York")
#DateTime<1974-01-01 00:00:00-05:00 EST America/New_York>

iex(6)> DateTime.shift_zone(time, "America/Jamaica")
{:ok, #DateTime<1974-01-01 01:00:00-04:00 EDT America/Jamaica>}

# 1975 seems to work fine
 DateTime.new(~D[1975-01-01], ~T[00:00:00], "America/Jamaica")
{:ok, #DateTime<1975-01-01 00:00:00-05:00 EST America/Jamaica>}

iex(7)> Tz.iana_version()
"2025b"

Any insight?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions