HolidAPI (pronounced: "Holiday-P-I", haha get it?), is a wrapper for multiple APIs serving information about holidays.
-
European countries via openholidaysapi.org:
-
Albania, Andorra, Austria
-
Belarus, Belgium, Bulgaria
-
Croatia, Czechia
-
Estonia
-
France
-
Germany
-
Hungary
-
Ireland, Italy
-
Latvia, Lichtenstein, Lithuania, Luxembourg
-
Malta, Moldova, Monaco
-
Netherlands
-
Poland, Portugal,
-
Romania,
-
San Marino, Slovenia, Spain, Switzerland,
-
Vatican City
-
-
Germany (alternative) via feiertage-api.de
You do not see your country in this list? Help us by expanding the API wrappers! :D
# European holiday API
import std/[strformat]
import holidapi/country/europe
let
holidaysInEnglish: seq[Holiday] = Netherlands.getHolidays(2024)
holidaysInDutch {.used.}: seq[Holiday] = Netherlands.getHolidays(2024, Dutch)
for holiday in holidaysInEnglish:
echo &"{holiday.name} is on the " & holiday.dateTime.format("yyyy-MM-dd") &
&" and goes on for " & $holiday.duration.inDays() & " day(s)!"
# European holiday API (for single country)
import std/[strformat]
import holidapi/country/europe/germany
let
holidaysInEnglish: seq[Holiday] = getHolidays(2024)
holidaysInGerman {.used.}: seq[Holiday] = getHolidays(2024, German)
for holiday in holidaysInEnglish:
echo &"{holiday.name} is on the " & holiday.dateTime.format("yyyy-MM-dd") &
&" and goes on for " & $holiday.duration.inDays() & " day(s)!"
# Alternative German API
import std/[strformat]
import holidapi/country/europe/germany_alt
const
year: int = 2024
let response: OrderedTable[GermanState, seq[Holiday]] = getAllHolidays(year)
for state, holidays in response:
echo &"Holidays for state {state}:"
for i, holiday in holidays:
echo &"{i}: {holiday.name}"
See ./src/holidapi/types.nim
for documentation on the Holiday
type.
Contributions are always welcome, especially expanding the list of supported countries/regions!