No description
Find a file
2025-06-03 09:16:56 +02:00
.utils removed wrong documentation 2024-07-24 08:48:33 +02:00
.vscode fixed type conversion and added example for nagerdate 2024-07-24 09:18:44 +02:00
examples added examples to examples directory 2025-06-03 09:16:56 +02:00
src added docs to nagerdate.nim 2024-07-24 13:04:04 +02:00
tests removed debug print 2024-07-22 10:56:05 +02:00
.gitignore added license and expanded readme 2024-07-18 08:43:10 +02:00
COUNTRIES.adoc documentation and fixed enum typo 2024-07-24 09:06:55 +02:00
holidapi.nimble fixed type conversion and added example for nagerdate 2024-07-24 09:18:44 +02:00
LICENSE licence 2024-07-18 08:47:52 +02:00
README.adoc readme 2024-07-24 13:06:24 +02:00

= HolidAPI

== About

_HolidAPI_ (pronounced: _"Holiday-P-I"_, haha get it?), is a wrapper for multiple APIs serving information about holidays.

== Installation

`nimble install holidapi`

== Currently supported countries

See `./COUNTRIES.adoc` for a list of supported countries.

You do not see your country in this list? Help us by expanding the API wrappers! :D

== Examples

```nim
import std/[strformat]
import holidapi/api/nagerdate

let
    holidays: seq[Holiday] = SouthKorea.getHolidays(2024, bothNames)
    # `bothNames` will get the english and local name of the holiday
    # example:
    #
    # - South Korea: New Year's Day (새해)
    # - France:      New Year's Day (Jour de l'an)
    # - Russia:      New Year's Day (Новый год)

for holiday in holidays:
    echo &"{holiday.name} is on the " & holiday.dateTime.format("yyyy-MM-dd") &
        &" and goes on for " & $holiday.duration.inDays() & " day(s)!"

```
```nim
# European holiday API
import std/[strformat]
import holidapi/api/openholidaysapi

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)!"
```
```nim
# Alternative German API
import std/[strformat]
import holidapi/api/feiertageapi

let response: OrderedTable[GermanState, seq[Holiday]] = getAllHolidays(2024)

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

Contributions are always welcome, especially expanding the list of supported countries/regions!

== Licence

This project is distributed under the `GPL-3.0` licence.