@date/holidays-us
A @date/holidays
instance with USA public and bank holidays.
Also has functions to calculate dates for specific holidays.
Install
npm install @date/holidays-us --save
Usage
var holidays = require('@date/holidays-us')
var date = new Date(2016, 0, 1)
holidays.isHoliday(date)
date.setDate(10)
holidays.isHoliday(date)
date = holidays.thanksgiving(2015)
date = holidays.thanksgiving(2016)
date = holidays.valentinesDay(2016)
holidays.isHoliday(date)
holidays.isHoliday(date, {
bank:true
})
Only Bank Holidays
var holidays = require('@date/holidays-us').bank()
holidays.isHoliday(new Date(2016, 1, 14))
holidays.isHoliday(new Date(2016, 0, 1))
Only Public Holidays
var holidays = require('@date/holidays-us').public()
holidays.isHoliday(new Date(2016, 1, 14))
holidays.isHoliday(new Date(2016, 0, 1))
API: Generators
Functions which generate a specific holiday based on a specified year:
- newYearsDay() - can calculate observed holiday as well
- valentinesDay()
- martinLutherKingDay()
- presidentsDay()
- easter()
- mothersDay()
- memorialDay()
- fathersDay()
- independenceDay() - can calculate observed holiday as well
- laborDay()
- columbusDay()
- halloween()
- veteransDay() - can calculate observed holiday as well
- thanksgiving()
- christmas() - can calculate observed holiday as well
API: Observed Holidays
Some holidays are "observed" on a different day than the holiday. The generate functions can calculate that as well.
var holidays = require('@date/holidays-us')
var christmasDay = holidays.christmas(2016)
var observedChristmas = date.observed
MIT License