Skip to content

vwong/date-holidays

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

113 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

date-holidays

world-wide holidays in gregorian calender

NPM version Build Status

This module provides dates of holidays for various countries, states and regions by type while considering the applicable timezone.

The features are:

  • calculation of public, bank and observance holidays for different countries, state, region
  • consideration of timezones for holiday checks
  • substitute days
  • multi-language support for all holiday names
  • setting of custom holidays
  • uses own grammar for calculation of days
  • support for islamic calendar from 1970 to 2080 (*islamic dates might not be correct as they are subject to the sighting of the moon)
  • support for hebrew calendar from 1970 to 2100
  • for generation of iCal calendar check out date-holidays-ical

Happy holidays!

Table of Contents

Supported Countries, States, Regions

If you are missing holidays from your country, state, region please consider contributing.

Countries: 89
โ”œโ”€โ”€ AD: Andorra
โ”‚   โ””โ”€โ”€ vella: Andorra la Vella
โ”œโ”€โ”€ AM: ี€ีกีตีกีฝีฟีกีถ
โ”œโ”€โ”€ AO: Angola
โ”œโ”€โ”€ AR: Argentina
โ”œโ”€โ”€ AT: ร–sterreich
โ”‚   โ”œโ”€โ”€ b: Burgenland
โ”‚   โ”œโ”€โ”€ k: Kรคrnten
โ”‚   โ”œโ”€โ”€ n: Niederรถsterreich
โ”‚   โ”œโ”€โ”€ o: Oberรถsterreich
โ”‚   โ”œโ”€โ”€ s: Land Salzburg
โ”‚   โ”œโ”€โ”€ st: Steiermark
โ”‚   โ”œโ”€โ”€ t: Tirol
โ”‚   โ”œโ”€โ”€ v: Vorarlberg
โ”‚   โ””โ”€โ”€ w: Wien
โ”œโ”€โ”€ AU: Australia
โ”‚   โ”œโ”€โ”€ act: Australian Capital Territory
โ”‚   โ”œโ”€โ”€ nsw: New South Wales
โ”‚   โ”œโ”€โ”€ nt: Northern Territory
โ”‚   โ”œโ”€โ”€ qld: Queensland
โ”‚   โ”œโ”€โ”€ sa: South Australia
โ”‚   โ”œโ”€โ”€ tas: Tasmania
โ”‚   โ”‚   โ”œโ”€โ”€ h: Hobart
โ”‚   โ”‚   โ””โ”€โ”€ nh: Non-Hobart
โ”‚   โ”œโ”€โ”€ vic: Victoria
โ”‚   โ”‚   โ””โ”€โ”€ m: Melbourne
โ”‚   โ””โ”€โ”€ wa: Western Australia
โ”œโ”€โ”€ BE: Belgique
โ”‚   โ”œโ”€โ”€ de: Deutschsprachige Gemeinschaft
โ”‚   โ”œโ”€โ”€ fr: Communautรฉ franรงaise
โ”‚   โ”‚   โ””โ”€โ”€ br: Bruxelles
โ”‚   โ””โ”€โ”€ vl: Vlaamse Gemeenschap
โ”œโ”€โ”€ BG: ะ‘ัŠะปะณะฐั€ะธั
โ”œโ”€โ”€ BI: Rรฉpublique du Burundi
โ”œโ”€โ”€ BO: Bolivia
โ”œโ”€โ”€ BR: Brasil
โ”œโ”€โ”€ BS: Bahamas
โ”œโ”€โ”€ BW: Botswana
โ”œโ”€โ”€ BZ: Belize
โ”œโ”€โ”€ CA: Canada
โ”‚   โ”œโ”€โ”€ ab: Alberta
โ”‚   โ”œโ”€โ”€ bc: British Columbia
โ”‚   โ”œโ”€โ”€ mb: Manitoba
โ”‚   โ”œโ”€โ”€ nb: New Brunswick
โ”‚   โ”œโ”€โ”€ nl: Newfoundland and Labrador
โ”‚   โ”œโ”€โ”€ ns: Nova Scotia
โ”‚   โ”œโ”€โ”€ nt: Northwest Territories
โ”‚   โ”œโ”€โ”€ nu: Nunavut
โ”‚   โ”œโ”€โ”€ on: Ontario
โ”‚   โ”œโ”€โ”€ pe: Prince Edward Island
โ”‚   โ”œโ”€โ”€ qc: Quebec
โ”‚   โ”œโ”€โ”€ sk: Saskatchewan
โ”‚   โ””โ”€โ”€ yt: Yukon
โ”œโ”€โ”€ CD: Rรฉpublique dรฉmocratique du Congo
โ”œโ”€โ”€ CF: Rรฉpublique centrafricaine
โ”œโ”€โ”€ CG: Rรฉpublique du Congo
โ”œโ”€โ”€ CH: Schweiz
โ”‚   โ”œโ”€โ”€ zh: Kanton Zรผrich
โ”‚   โ”œโ”€โ”€ be: Kanton Bern
โ”‚   โ”œโ”€โ”€ lu: Kanton Luzern
โ”‚   โ”œโ”€โ”€ ur: Kanton Uri
โ”‚   โ”œโ”€โ”€ sz: Kanton Schwyz
โ”‚   โ”œโ”€โ”€ ow: Kanton Obwalden
โ”‚   โ”œโ”€โ”€ nw: Kanton Nidwalden
โ”‚   โ”œโ”€โ”€ gl: Kanton Glarus
โ”‚   โ”œโ”€โ”€ zg: Kanton Zug
โ”‚   โ”œโ”€โ”€ fr: Kanton Freiburg
โ”‚   โ”œโ”€โ”€ so: Kanton Solothurn
โ”‚   โ”œโ”€โ”€ bs: Kanton Basel-Stadt
โ”‚   โ”œโ”€โ”€ bl: Kanton Basel-Landschaft
โ”‚   โ”œโ”€โ”€ sh: Kanton Schaffhausen
โ”‚   โ”œโ”€โ”€ ar: Kanton Appenzell Ausserrhoden
โ”‚   โ”œโ”€โ”€ ai: Kanton Appenzell Innerrhoden
โ”‚   โ”œโ”€โ”€ sg: Kanton St. Gallen
โ”‚   โ”œโ”€โ”€ gr: Kanton Graubรผnden
โ”‚   โ”œโ”€โ”€ ag: Kanton Aargau
โ”‚   โ”œโ”€โ”€ tg: Kanton Thurgau
โ”‚   โ”œโ”€โ”€ ti: Kanton Tessin
โ”‚   โ”œโ”€โ”€ vd: Kanton Waadt
โ”‚   โ”œโ”€โ”€ vs: Kanton Wallis
โ”‚   โ”œโ”€โ”€ ne: Kanton Neuenburg
โ”‚   โ”œโ”€โ”€ ge: Kanton Genf
โ”‚   โ””โ”€โ”€ ju: Kanton Jura
โ”œโ”€โ”€ CL: Chile
โ”‚   โ”œโ”€โ”€ ar: Arica
โ”‚   โ”œโ”€โ”€ ch: Chillรกn y Chillรกn Viejo
โ”‚   โ”œโ”€โ”€ pa: Parinacota
โ”‚   โ””โ”€โ”€ ta: Tarapacรก
โ”œโ”€โ”€ CM: Cameroun
โ”œโ”€โ”€ CO: Colombia
โ”œโ”€โ”€ CR: Costa Rica
โ”œโ”€โ”€ CU: Cuba
โ”œโ”€โ”€ CY: ฮšฯฯ€ฯฮฟฯ‚
โ”œโ”€โ”€ CZ: ฤŒeskรก republika
โ”œโ”€โ”€ DE: Deutschland
โ”‚   โ”œโ”€โ”€ bb: Brandenburg
โ”‚   โ”œโ”€โ”€ bw: Baden Wรผrtemberg
โ”‚   โ”œโ”€โ”€ 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
โ”œโ”€โ”€ DK: Danmark
โ”œโ”€โ”€ DO: Repรบblica Dominicana
โ”œโ”€โ”€ EC: Ecuador
โ”‚   โ””โ”€โ”€ qu: Quito
โ”œโ”€โ”€ EE: Eesti
โ”œโ”€โ”€ ES: Espaรฑa
โ”‚   โ””โ”€โ”€ madrid: Comunidad de Madrid
โ”œโ”€โ”€ ET: แŠขแ‰ตแ‹ฎแŒตแ‹ซ
โ”œโ”€โ”€ FI: Suomi
โ”œโ”€โ”€ FR: France
โ”‚   โ”œโ”€โ”€ basrhin: Dรฉpartement Bas-Rhin
โ”‚   โ”œโ”€โ”€ hautrhin: Dรฉpartement Haut-Rhin
โ”‚   โ”œโ”€โ”€ moselle: Dรฉpartement Moselle
โ”‚   โ”œโ”€โ”€ mayotte: Dรฉpartement et rรฉgion d'outre-mer Mayotte
โ”‚   โ”œโ”€โ”€ martinique: Dรฉpartement et rรฉgion d'outre-mer Martinique
โ”‚   โ”œโ”€โ”€ guadeloupe: Dรฉpartement et rรฉgion d'outre-mer Guadeloupe
โ”‚   โ”œโ”€โ”€ guyane: Dรฉpartement et rรฉgion d'outre-mer Guyane
โ”‚   โ””โ”€โ”€ reunion: Dรฉpartement et rรฉgion d'outre-mer La Rรฉunion
โ”œโ”€โ”€ GA: Gabon
โ”œโ”€โ”€ GB: Britain
โ”‚   โ”œโ”€โ”€ al: Alderney
โ”‚   โ”œโ”€โ”€ en: England
โ”‚   โ”œโ”€โ”€ gu: Guernsey
โ”‚   โ”œโ”€โ”€ im: Isle of Man
โ”‚   โ”œโ”€โ”€ je: Jersey
โ”‚   โ”œโ”€โ”€ ni: Northern Ireland
โ”‚   โ”œโ”€โ”€ sc: Scottland
โ”‚   โ””โ”€โ”€ wa: Wales
โ”œโ”€โ”€ GD: Grenada
โ”œโ”€โ”€ GQ: Repรบblica de Guinea Ecuatorial
โ”œโ”€โ”€ GR: ฮ•ฮปฮปฮฌฮดฮฑ
โ”œโ”€โ”€ GT: Guatemala
โ”œโ”€โ”€ GU: Guam
โ”œโ”€โ”€ HN: Honduras
โ”œโ”€โ”€ HR: Hrvatska
โ”‚   โ”œโ”€โ”€ split: Split
โ”‚   โ””โ”€โ”€ dubrovnik: Dubrovnik
โ”œโ”€โ”€ HT: Haรฏti
โ”œโ”€โ”€ HU: Magyarorszรกg
โ”œโ”€โ”€ IE: Ireland
โ”œโ”€โ”€ IS: รsland
โ”œโ”€โ”€ IT: Italia
โ”‚   โ””โ”€โ”€ suedtirol: Sรผdtirol, Alto Adige
โ”œโ”€โ”€ JM: Jamaica
โ”œโ”€โ”€ JP: ๆ—ฅๆœฌ
โ”œโ”€โ”€ KE: Kenia
โ”œโ”€โ”€ LI: Lichtenstein
โ”œโ”€โ”€ LT: Lietuva
โ”œโ”€โ”€ LU: Luxembourg
โ”œโ”€โ”€ LV: Latvija
โ”œโ”€โ”€ MC: Monaco
โ”œโ”€โ”€ ME: Crna Gora
โ”œโ”€โ”€ MG: Repoblikan'i Madagasikara
โ”œโ”€โ”€ MT: Malta
โ”œโ”€โ”€ MW: Malawi
โ”œโ”€โ”€ MX: Mรฉxico
โ”œโ”€โ”€ MZ: Moรงambique
โ”œโ”€โ”€ NA: Namibia
โ”œโ”€โ”€ NI: Nicaragua
โ”œโ”€โ”€ NL: Nederland
โ”œโ”€โ”€ NO: Norge
โ”œโ”€โ”€ NZ: New Zealand
โ”‚   โ”œโ”€โ”€ au: Auckland Province
โ”‚   โ”œโ”€โ”€ ca: Canterbury
โ”‚   โ”œโ”€โ”€ ch: Chatham Islands
โ”‚   โ”œโ”€โ”€ ha: Hawke's Bay
โ”‚   โ”œโ”€โ”€ ma: Marlborough
โ”‚   โ”œโ”€โ”€ ne: Nelson
โ”‚   โ”œโ”€โ”€ no: Northland
โ”‚   โ”œโ”€โ”€ ot: Otago Province
โ”‚   โ”œโ”€โ”€ sc: South Canterbury
โ”‚   โ”œโ”€โ”€ so: Southland
โ”‚   โ”œโ”€โ”€ ta: Taranaki
โ”‚   โ”œโ”€โ”€ we: Wellington Province
โ”‚   โ””โ”€โ”€ wd: Westland
โ”œโ”€โ”€ PA: Panamรก
โ”œโ”€โ”€ PE: Perรบ
โ”‚   โ””โ”€โ”€ cu: Cuzco
โ”œโ”€โ”€ PL: Polska
โ”œโ”€โ”€ PT: Portugal
โ”œโ”€โ”€ PY: Paraguay
โ”œโ”€โ”€ RO: Romania
โ”œโ”€โ”€ RU: ะ ะพััะธั
โ”œโ”€โ”€ RW: Repubulika y'u Rwanda
โ”œโ”€โ”€ SE: Sverige
โ”œโ”€โ”€ SS: South Sudan
โ”œโ”€โ”€ SV: El Salvador
โ”‚   โ””โ”€โ”€ san: San Salvador
โ”œโ”€โ”€ TG: Rรฉpublique togolaise
โ”œโ”€โ”€ TR: Tรผrkiye
โ”œโ”€โ”€ TZ: Tanzania
โ”œโ”€โ”€ UG: Uganda
โ”œโ”€โ”€ US: United States of America
โ”‚   โ”œโ”€โ”€ al: Alabama
โ”‚   โ”œโ”€โ”€ ak: Alaska
โ”‚   โ”œโ”€โ”€ az: Arizona
โ”‚   โ”œโ”€โ”€ ar: Arkansas
โ”‚   โ”œโ”€โ”€ ca: California
โ”‚   โ”œโ”€โ”€ 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
โ”œโ”€โ”€ UY: Uruguay
โ”œโ”€โ”€ VE: Venezuela
โ”‚   โ”œโ”€โ”€ an: Anzoรกtegui
โ”‚   โ”œโ”€โ”€ ca: Carabobo
โ”‚   โ”œโ”€โ”€ la: Lara
โ”‚   โ”‚   โ””โ”€โ”€ ba: Barquisimeto
โ”‚   โ”œโ”€โ”€ mi: Miranda
โ”‚   โ”œโ”€โ”€ mo: Monagas
โ”‚   โ”œโ”€โ”€ ta: Tรกchira
โ”‚   โ””โ”€โ”€ zu: Zulia
โ”œโ”€โ”€ ZA: South Africa
โ”œโ”€โ”€ ZM: Zambia
โ””โ”€โ”€ ZW: Zimbabwe

Usage

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',
    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',
    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)',
    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',
  type: 'public' }
*/

Holiday object

getHolidays() as well as a matching isHoliday() call return either a list or a single holiday object which consists of:

  • {String} date - ISO Date String of (start)-date in local format
  • {Date} start - start date of holiday
  • {Date} end - end date of holiday
  • {String} name - name of holiday using language (if available)
  • {String} type - type of holiday public|bank|school|observance
  • {Boolean} substitute - (optional) if true holiday substitutes another holiday`

Dates

The date String represents the start date of the holiday in ISO format without timezone. This string it intented for information only.

start and end are the start/end date of the holiday within the selected timezone of the country, state, region.

Name

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 fallback 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.

Types of holidays

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.

API

See Holidays API for further information.

Data

All data for the holidays of the different countries is contained in ./data/holidays.yaml. Any details on structure and available grammar for holiday attribution is described in holidays.yaml specification.

Custom builds of holidays.json

If 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"
},

Alternatively you may use the --omit option.

Manually use

$(npm bin)/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.

Contribution and License Agreement

You 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 licence.

License

Copyright (c) 2016 commenthol (ISC License)

The data contained in holidays.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 file ./data/holidays.yaml.

See LICENSE for more information.

References

About

worldwide holidays

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.5%
  • Makefile 0.5%