Skip to content

Commit

Permalink
Support full day of week names
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuprog committed Sep 7, 2024
1 parent fb0b0d4 commit 34d9a97
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/tz/iana_file_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,22 @@ defmodule Tz.IanaFileParser do
end

defp day_of_week_string_to_integer(day_of_week_string) do
day_of_week_names = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
1 + Enum.find_index(day_of_week_names, &(day_of_week_string == &1))
day_of_week_names = [
{"Mon", "Monday"},
{"Tue", "Tuesday"},
{"Wed", "Wednesday"},
{"Thu", "Thursday"},
{"Fri", "Friday"},
{"Sat", "Saturday"},
{"Sun", "Sunday"}
]

index =
Enum.find_index(day_of_week_names, fn {abbr, full} ->
day_of_week_string == abbr || day_of_week_string == full
end)

1 + index
end

defp parse_time_string(time_string) do
Expand Down

0 comments on commit 34d9a97

Please sign in to comment.