Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime.now with invalid time zone crashes #72

Closed
wojtekmach opened this issue Dec 29, 2018 · 1 comment
Closed

DateTime.now with invalid time zone crashes #72

wojtekmach opened this issue Dec 29, 2018 · 1 comment

Comments

@wojtekmach
Copy link
Contributor

I'm using Elixir master and tzdata master.

iex> DateTime.now("America/New_Yor", Tzdata.TimeZoneDatabase)
** (MatchError) no match of right hand side value: {:error, :not_found}
    (tzdata) lib/tzdata.ex:168: Tzdata.periods_for_time/3
    (tzdata) lib/tzdata/time_zone_database.ex:15: Tzdata.TimeZoneDatabase.time_zone_period_from_utc_iso_days/2
    (elixir) lib/calendar/datetime.ex:443: DateTime.shift_zone_for_iso_days_utc/5

Per DateTime.now docs, it should return {:error, :time_zone_not_found} instead.

@lau
Copy link
Owner

lau commented Dec 29, 2018

Thank you. It should work in master now. The Tzdata.TimeZoneDatabase functionality needs some testing which I'll add soon.

@lau lau closed this as completed Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants