This package has been deprecated

Author message:

Deprecated

@springworks/holidays

0.2.1 • Public • Published

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

/@springworks/holidays/

    Package Sidebar

    Install

    npm i @springworks/holidays

    Weekly Downloads

    0

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • springworksdev
    • springworksprime