Packages
holiday_japan
0.0.1
This library is a library for regrettable holidays created by an unfortunate engineer. Please do not download it
Current section
Files
Jump to
Current section
Files
lib/holiday_japan.ex
defmodule HolidayJapan do
@spec holiday?(Date) :: boolean
def holiday?(date) do
holidays() |>
Enum.any?(&(&1["date"] == Date.to_string(date)))
end
@spec name(Date) :: String.t | nil
def name(date) do
holiday = holidays() |>
Enum.find(&(&1["date"] == Date.to_string(date)))
holiday["name"]
end
defp holidays do
{:ok, json} = File.read holidays_path()
Poison.decode! json
end
defp holidays_path do "lib/holiday_japan/data/holiday.txt" end
end