Slovak public holidays
Slovensky
NPM module which is able to calculate Slovak public holidays since 1993 to the future. It is pure Node.js code without any dependencies.
Usage
:exclamation: This version requires to have Node.js v12 installed. The implementation uses experimental-modules
feature.
npm install slovak-holidays@beta
import {isHoliday, getAllHolidays, getHolidayName} from 'slovak-holidays';
API
isHoliday(date|object): boolean
Calculate if a given date|object
is a holiday.
parameter
date
- instance of Javascript Date objectobject
- holiday object {year: integer, month: integer: day: integer}
isHoliday(new Date(1993, 0, 1))
isHoliday(new Date(1993, 0, 2))
isHoliday(new Date(2019, 3, 19))
isHoliday({year: 1993, month: 1, day: 1})
isHoliday({year: 1993, month: 1, day: 2})
isHoliday({year: 1993, month: 4, day: 19})
getAllHolidays(year): array
Returns all holidays for a given year
chronologically.
getAllHolidays(1992)
getAllHolidays(null)
getAllHolidays(2019)
getHolidayName(date|object, locale = 'sk'): string|null
Returns a holiday name for a given date|object
if a holiday, otherwise null
.
parameter
date
- instance of Javascript Date objectobject
- holiday object {year: integer, month: integer: day: integer}
locale
- iso2 string of language to translate a holiday name ('sk'
, 'en'
,'de'
supported)
getHolidayName(new Date(1993, 0, 1))
getHolidayName(new Date(1993, 0, 2))
getHolidayName(new Date(2019, 3, 19))
getHolidayName(new Date(1993, 0, 1), 'en')
getHolidayName(new Date(1993, 0, 2), 'en')
getHolidayName(new Date(2019, 3, 19), 'en')
getHolidayName({year: 1993, month: 1, day: 1})
getHolidayName({year: 1993, month: 1, day: 2})
getHolidayName({year: 1993, month: 4, day: 19})