Skip to content

Instantly share code, notes, and snippets.

lau / simple_time_zone_list.ex
Last active April 15, 2021 07:41
Simple city to time zone mapping from Rails. As an Elixir map.
View simple_time_zone_list.ex
# Could be used for instance like this in Phoenix: <%= select f, :time_zone, SimpleTimeZoneList.mapping %>
defmodule SimpleTimeZoneList do
@mapping %{
"International Date Line West" => "Pacific/Midway",
"Midway Island" => "Pacific/Midway",
"American Samoa" => "Pacific/Pago_Pago",
"Hawaii" => "Pacific/Honolulu",
"Alaska" => "America/Juneau",
"Pacific Time (US & Canada)" => "America/Los_Angeles",
"Tijuana" => "America/Tijuana",