
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@studio384/date-holidays-devtest
Advanced tools
world-wide holidays in gregorian calender
This module provides dates of holidays for various countries, states and regions by type while considering the applicable timezone.
The features are:
Happy holidays!
holidays.jsonIf you are missing holidays from your country, state, region please consider contributing.
Countries: 5
βββ BE: Belgique
β βββ BRU: Bruxelles
β βββ DE: Deutschsprachige Gemeinschaft
β βββ VLG: Vlaamse Gemeenschap
β βββ WAL: CommunautΓ© franΓ§aise
βββ DE: Deutschland
β βββ BB: Brandenburg
β βββ BE: Berlin
β βββ BW: Baden-WΓΌrttemberg
β βββ BY: Bayern
β β βββ A: Stadt Augsburg
β β βββ EVANG: Γberwiegend evangelische Gemeinden
β βββ HB: Hansestadt Bremen
β βββ HE: Hessen
β βββ HH: Hansestadt Hamburg
β βββ MV: Mecklenburg Vorpommern
β βββ NI: Niedersachsen
β βββ NW: Nordrhein-Westfalen
β βββ RP: Rheinland-Pfalz
β βββ SH: Schleswig-Holstein
β βββ SL: Saarland
β βββ SN: Sachsen
β β βββ BZ: Landkreis Bautzen
β βββ ST: Sachsen-Anhalt
β βββ TH: ThΓΌringen
β βββ EIC: Landkreis Eichfeld
β βββ UH: Unstrut-Hainich-Kreis
β βββ WAK: Wartburgkreis
βββ FR: France
β βββ 57: DΓ©partement Moselle
β βββ 67: DΓ©partement Bas-Rhin
β βββ 68: DΓ©partement Haut-Rhin
βββ NL: Nederland
βββ US: United States of America
βββ AL: Alabama
βββ AK: Alaska
βββ AZ: Arizona
βββ AR: Arkansas
βββ CA: California
β βββ LA: Los Angeles
βββ CO: Colorado
βββ CT: Connecticut
βββ DE: Delaware
βββ DC: District of Columbia
βββ FL: Florida
βββ GA: Georgia
βββ HI: Hawaii
βββ ID: Idaho
βββ IL: Illinois
βββ IN: Indiana
βββ IA: Iowa
βββ KS: Kansas
βββ KY: Kentucky
βββ LA: Louisiana
β βββ NO: New Orleans
βββ ME: Maine
βββ MD: Maryland
βββ MA: Massachusetts
βββ MI: Michigan
βββ MN: Minnesota
βββ MS: Mississippi
βββ MO: Missouri
βββ MT: Montana
βββ NE: Nebraska
βββ NV: Nevada
βββ NH: New Hampshire
βββ NJ: New Jersey
βββ NM: New Mexico
βββ NY: New York
βββ NC: North Carolina
βββ ND: North Dakota
βββ OH: Ohio
βββ OK: Oklahoma
βββ OR: Oregon
βββ PA: Pennsylvania
βββ RI: Rhode Island
βββ SC: South Carolina
βββ SD: South Dakota
βββ TN: Tennessee
βββ TX: Texas
βββ UT: Utah
βββ VT: Vermont
βββ VA: Virginia
βββ WA: Washington
βββ WV: West Virginia
βββ WI: Wisconsin
βββ WY: Wyoming
var Holidays = require('date-holidays')
var hd = new Holidays()
// get supported countries
hd.getCountries()
/*>
{ AD: 'Andorra',
...
US: 'United States' }
*/
// get supported states e.g. for US
hd.getStates('US')
/*>
{ al: 'Alabama',
...
wy: 'Wyoming' }
*/
// get supported regions e.g. for US, Lousiana
hd.getRegions('US', 'la')
/*>
{ no: 'New Orleans' }
*/
// initialize holidays for US, Lousiana, New Orleans
hd.init('US', 'la', 'no')
// or using a new instance
hd = new Holidays('US', 'la', 'no')
// get all holidays for the year 2016
hd.getHolidays(2016)
/*>
[ { date: '2016-01-01 00:00:00',
start: Fri Jan 01 2016 00:00:00 GMT-0600 (CST),
end: Sat Jan 02 2016 00:00:00 GMT-0600 (CST),
name: 'New Year\'s Day',
rule: '01-01 and if sunday then next monday if saturday then previous friday',
type: 'public' },
...
{ date: '2016-11-24 00:00:00',
start: Thu Nov 24 2016 00:00:00 GMT-0600 (CST),
end: Fri Nov 25 2016 00:00:00 GMT-0600 (CST),
name: 'Thanksgiving Day',
rule: '4th thursday in November',
type: 'public' },
...
{ date: '2016-12-26 00:00:00',
start: Mon Dec 26 2016 00:00:00 GMT-0600 (CST),
end: Tue Dec 27 2016 00:00:00 GMT-0600 (CST),
substitute: true,
name: 'Christmas Day (substitute day)',
rule: '12-25 and if sunday then next monday if saturday then previous friday',
type: 'public' } ]
*/
// check if date is a holiday while respecting timezones
hd.isHoliday(new Date('2016-02-09 00:00:00 GMT+0000'))
//> false
hd.isHoliday(new Date('2016-02-09 10:00:00 GMT-0600'))
/*>
[{ date: '2016-02-09 00:00:00',
start: Tue Feb 09 2016 00:00:00 GMT-0600 (CST),
end: Wed Feb 10 2016 00:00:00 GMT-0600 (CST),
name: 'Mardi Gras',
rule: 'easter -47',
type: 'public' }
]
*/
getHolidays() as well as a matching isHoliday() call return either a list or
a single holiday object which consists of:
language (if available)public|bank|school|optional|observanceThe date String represents the start date of the holiday in ISO format without
timezone. This string it intended for information only.
start and end are the start/end date of the holiday within the selected
timezone of the country, state, region.
The name names the holiday in the local language of the selected country,
state, region. The applied language(s) can be requested using getLanguages().
The language can be changed using the setLanguages() method. In case that not
translation is available a fall-back to the next given language will be made.
E.g. local language is "fr", setLanguages('nl') was called. For all holidays
where no dutch translation is available the French version will be used instead.
All holiday names should support an English translation.
Currently the following type with their meaning are supported
| type | meaning |
|---|---|
| public | public holiday |
| bank | bank holiday, banks and offices are closed |
| school | school holiday, schools are closed |
| optional | majority of people take a day off |
| observance | optional festivity, no paid day off |
Additionally a note field is sometimes available for further clarification.
See Holidays API for further information.
All data for the holidays of the different countries is contained in
./data/holidays.json. For changing holiday data edit the appropriate country in ./data/countries.
Any details on structure and
available grammar for holiday attribution is described in
holidays.yaml specification.
holidays.jsonIf only selected countries are required in data/holidays.json you can add the
following script to your npm scripts section. E.g. for picking just US, Canada,
Mexico do the following:
"scripts": {
"build": "holidays2json --pick US,CA,MX --min"
},
The --min switch removes dependencies which are not required for the countries selected. You may not be able to use the full set of rules in case you want to add custom rules.
Alternatively you may use the --omit option.
Manually use
npx holidays2json --pick US,CA,MX
NOTE: There are some countries which depend on data of others which might render the file useless. e.g. "GU" requires "US", so try to pick or omit both.
To minimize bundle sizes consider adding the following lines in your webpack config.
Please take a look at ./webpack.config.js. To further reduce size consider custom builds by only selecting required countries.
...
plugins: [
new webpack.IgnorePlugin({
checkResource (resource, context) {
// ---- do not bundle astronomia vsop planet data
if (/\/astronomia\/data$/.test(context)) {
return !['./deltat.js', './vsop87Bearth.js'].includes(resource)
}
// ---- do not bundle moment locales
if (/\/moment\/locale$/.test(context)) {
return true
}
return false
}
})
This project also runs in all modern browsers. See ./examples/browser
| Browser | Version | Notes |
|---|---|---|
| Chrome | >=45 | |
| Firefox | >=45 | |
| Safari | >=10 | |
| Edge | >=13 | |
| IE | >=11 | needs polyfill core-js/es6 |
Please do not forget to set the correct charset!
<html>
<head>
<!-- set page-wide -->
<meta charset="UTF-8">
...
</head>
<body>
...
<!-- or per script -->
<script src="your-bundle.js" charset="UTF-8"></script>
Minified distribution bundles are available via https://unpkg.com
NOTE: dist-bundles are quite huge in size ~1.5MByte so use custom builds instead.
See https://unpkg.com/date-holidays/dist/
index.min.js: commonjs2 bundleumd.min.js: umd bundleYou like to contribute please read CONTRIBUTING.md.
If you contribute code to this project, you are implicitly allowing your code to be distributed under the ISC license. You are also implicitly verifying that all code is your original work or correctly attributed with the source of its origin and license.
Copyright (c) 2016- commenthol (ISC License)
The data contained in holidays.json and ./data/countries/*.yaml is available under CC BY-SA 3.0
as the majority of data obtained relies on wikipedia articles. The required
attribution can be found inside the files ./data/countries/*.yaml.
See LICENSE for more information.
FAQs
worldwide holidays
We found that @studio384/date-holidays-devtest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authoritiesβ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socketβs new workflow scanning support.