@springworks/holidays

Utils to manage public holidays.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
00Apr 3, 2019Aug 11, 2014Minified + gzip package size for @springworks/holidays in KB

Readme

node-holidays

Build Status Coverage Status

A node module for managing local public holidays.

Example 1:

var holidays = require('node-holidays')('sv-SE');

if(holidays.isHoliday('2014-12-25')) {
  // The 25th of December is a holiday.
}

Example 2:

var Holidays = require('node-holidays'),
    holidays = Holidays('sv-SE');

if(holidays.isHoliday('2014-12-25')) {
  // The 25th of December is a holiday.
}

Example 3:

var Holidays = require('node-holidays'),
    holidays = Holidays('sv-SE');

holidays.setLocale('en-US'); // Set the locale to en-US.
if(holidays.isHoliday('2014-12-25')) {
  // The 25th of December is a holiday.
}

API

getLocale()

Returns the current locale.

var holidays = require('node-holidays')('en-US');
assert(holidays.getLocale() === 'en-US');

setLocale(locale)

Sets the current locale for the module.

var holidays = require('node-holidays')('en-US');
assert(holidays.getLocale() === 'en-US');
holidays.setLocale('sv-SE');
assert(holidays.getLocale() === 'sv-SE');

isHoliday(date)

Checks if a given date is a holiday.

var is_holiday = holidays.isHoliday('2014-12-25');
assert(is_holiday === true);

getHolidays(year)

Gets an array of all holidays for a given year.

var 2014_holidays = holidays.getHolidays(2014);
assert(2014_holidays.indexOf('2014-12-25') > -1);

Extending

Look at /lib/l10n/_template.js for an example.

sv-SE

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.