bitwalker / timex

A complete date/time library for Elixir projects.

Home Page:https://hexdocs.pm/timex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timex.Timezone.local() crashes when it can't find any local timezone

narrowtux opened this issue · comments

Steps to reproduce

Unsure how to reproduce exactly, we're running in a docker alpine environment, maybe all the files listed here are missing from there. Probably just delete all those files and then call Timex.Timezone.local().

Culprit is here: https://github.com/bitwalker/timex/blob/3.7.5/lib/timezone/local.ex#L139 - The {:ok, tz} match when the pipeline could also return nil in rare cases.

Stack trace we are receiving:

** (MatchError) no match of right hand side value: nil
    (timex 3.3.0) lib/timezone/timezone_local.ex:123: Timex.Timezone.Local.localtz/2
    (timex 3.3.0) lib/timezone/timezone_local.ex:58: Timex.Timezone.Local.lookup/1
    (timex 3.3.0) lib/timezone/timezone.ex:53: Timex.Timezone.local/1
    ... our code

Cheers