UNPKG

26 kBMarkdownView Raw
1# date-holidays
2
3> world-wide holidays in gregorian calender
4
5[![NPM version](https://badge.fury.io/js/date-holidays.svg)](https://www.npmjs.com/package/date-holidays/)
6[![Build Status](https://github.com/commenthol/date-holidays/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/commenthol/date-holidays/actions/workflows/ci.yml?query=branch%3Amaster)
7
8This module provides dates of holidays for various countries, states and regions
9by type while considering the applicable timezone.
10
11The features are:
12
13- calculation of public, bank and observance holidays for different countries,
14 state, region, following ISO 3166-2
15- consideration of timezones for holiday checks
16- consideration of start and end time dependent on timezone
17- substitute days
18- multi-language support for all holiday names
19- setting of custom holidays
20- uses own grammar for calculation of days
21- support for islamic calendar from 1970 to 2080 (*islamic dates might not be
22 correct as they are subject to the sighting of the moon*)
23- support for hebrew calendar from 1970 to 2100
24- support for chinese calendar
25- for generation of iCal calendar check out [date-holidays-ical][]
26
27Happy holidays!
28
29## Table of Contents
30
31<!-- !toc (minlevel=2 omit="Table of Contents") -->
32
33* [Supported Countries, States, Regions](#supported-countries-states-regions)
34* [Usage](#usage)
35* [Holiday object](#holiday-object)
36 * [Dates](#dates)
37 * [Name](#name)
38 * [Types of holidays](#types-of-holidays)
39* [API](#api)
40* [Data](#data)
41* [Custom builds of `holidays.json`](#custom)
42* [Bundling with webpack](#bundling-with-webpack)
43* [Browser](#browser)
44* [CDN](#cdn)
45* [Contribution and License Agreement](#contribution)
46* [License](#license)
47* [References](#references)
48
49<!-- toc! -->
50
51## Supported Countries, States, Regions
52
53If you are missing holidays from your country, state, region please consider
54[contributing](#contribution).
55
56<!-- !tree -->
57
58```
59Countries: 196
60├── AD: Andorra
61│ └── 07: Andorra la Vella
62├── AE: دولة الإمارات العربية المتحدة
63├── AG: Antigua & Barbuda
64│ └── 10: Barbuda
65├── AI: Anguilla
66├── AL: Shqipëri
67├── AM: Հայաստան
68├── AO: Angola
69├── AR: Argentina
70├── AS: American Samoa
71├── AT: Österreich
72│ ├── 1: Burgenland
73│ ├── 2: Kärnten
74│ ├── 3: Niederösterreich
75│ ├── 4: Oberösterreich
76│ ├── 5: Land Salzburg
77│ ├── 6: Steiermark
78│ ├── 7: Tirol
79│ ├── 8: Vorarlberg
80│ └── 9: Wien
81├── AU: Australia
82│ ├── ACT: Australian Capital Territory
83│ ├── NSW: New South Wales
84│ ├── NT: Northern Territory
85│ ├── QLD: Queensland
86│ ├── SA: South Australia
87│ ├── TAS: Tasmania
88│ ├── VIC: Victoria
89│ └── WA: Western Australia
90├── AW: Aruba
91├── AX: Landskapet Åland
92├── AZ: Azərbaycan Respublikası
93├── BA: Bosna i Hercegovina
94│ ├── BIH: Federation of Bosnia and Herzegovina
95│ │ └── W: Western Herzegovina
96│ ├── BRC: Brčko District
97│ └── SRP: Republika Srpska
98├── BB: Barbados
99├── BD: গণপ্রজাতন্ত্রী বাংলাদেশ
100├── BE: Belgique
101│ ├── BRU: Bruxelles
102│ ├── DE: Deutschsprachige Gemeinschaft
103│ ├── VLG: Vlaamse Gemeenschap
104│ └── WAL: Communauté française
105├── BF: Burkina Faso
106├── BG: България
107├── BH: مملكة البحرين
108├── BI: République du Burundi
109├── BJ: République du Bénin
110├── BL: St. Barthélemy
111├── BM: Bermuda
112├── BN: Negara Brunei Darussalam
113├── BO: Bolivia
114├── BQ: Caribisch Nederland
115│ ├── BO: Bonaire
116│ ├── SA: Saba
117│ └── SE: Sint Eustatius
118├── BR: Brasil
119│ ├── AC: Acre
120│ ├── AL: Alagoas
121│ ├── AM: Amazonas
122│ ├── AP: Amapá
123│ ├── BA: Bahia
124│ ├── CE: Ceará
125│ ├── DF: Distrito Federal
126│ ├── MA: Maranhão
127│ ├── MG: Minas Gerais
128│ │ └── BH: Belo Horizonte
129│ ├── MS: Mato Grosso do Sul
130│ ├── MT: Mato Grosso
131│ ├── PA: Pará
132│ ├── PB: Paraíba
133│ ├── PE: Pernambuco
134│ │ └── RE: Recife
135│ ├── PI: Piauí
136│ ├── PR: Paraná
137│ │ └── CU: Curitiba
138│ ├── RJ: Rio de Janeiro
139│ ├── RN: Rio Grande do Norte
140│ ├── RO: Rondônia
141│ ├── RR: Roraima
142│ ├── RS: Rio Grande do Sul
143│ ├── SC: Santa Catarina
144│ ├── SE: Sergipe
145│ ├── SP: São Paulo
146│ │ └── SP: São Paulo
147│ └── TO: Tocantins
148├── BS: Bahamas
149├── BW: Botswana
150├── BY: Рэспубліка Беларусь
151├── BZ: Belize
152├── CA: Canada
153│ ├── AB: Alberta
154│ ├── BC: British Columbia
155│ ├── MB: Manitoba
156│ ├── NB: New Brunswick
157│ ├── NL: Newfoundland and Labrador
158│ ├── NS: Nova Scotia
159│ ├── NT: Northwest Territories
160│ ├── NU: Nunavut
161│ ├── ON: Ontario
162│ ├── PE: Prince Edward Island
163│ ├── QC: Quebec
164│ ├── SK: Saskatchewan
165│ └── YT: Yukon
166├── CC: Cocos (Keeling) Islands
167├── CD: République démocratique du Congo
168├── CF: République centrafricaine
169├── CG: République du Congo
170├── CH: Schweiz
171│ ├── ZH: Kanton Zürich
172│ ├── BE: Kanton Bern
173│ ├── LU: Kanton Luzern
174│ ├── UR: Kanton Uri
175│ ├── SZ: Kanton Schwyz
176│ ├── OW: Kanton Obwalden
177│ ├── NW: Kanton Nidwalden
178│ ├── GL: Kanton Glarus
179│ ├── ZG: Kanton Zug
180│ ├── FR: Canton de Fribourg
181│ ├── SO: Kanton Solothurn
182│ ├── BS: Kanton Basel-Stadt
183│ ├── BL: Kanton Basel-Landschaft
184│ ├── SH: Kanton Schaffhausen
185│ ├── AR: Kanton Appenzell Ausserrhoden
186│ ├── AI: Kanton Appenzell Innerrhoden
187│ ├── SG: Kanton St. Gallen
188│ ├── GR: Kanton Graubünden
189│ ├── AG: Kanton Aargau
190│ ├── TG: Kanton Thurgau
191│ ├── TI: Canton Ticino
192│ ├── VD: Canton de Vaud
193│ ├── VS: Canton du Valais
194│ ├── NE: Canton de Neuchâtel
195│ ├── GE: Canton de Genève
196│ └── JU: Canton du Jura
197├── CI: République de Côte d'Ivoire
198├── CK: Cook Islands
199│ ├── Aitutaki: Aitutaki
200│ ├── Atiu: Atiu
201│ ├── Mangaia: Mangaia
202│ ├── Manihiki: Manihiki
203│ ├── Mitiaro: Mitiaro
204│ ├── Palmerston: Palmerston
205│ ├── Penrhyn: Penrhyn
206│ ├── Pukapuka: Pukapuka
207│ ├── Rakahanga: Rakahanga
208│ └── Rarotonga: Rarotonga
209├── CL: Chile
210│ ├── AP: Arica y Parinacota
211│ ├── BI: Biobío
212│ │ └── CH: Chillán y Chillán Viejo
213│ └── TA: Tarapacá
214├── CM: Cameroun
215├── CN: 中华人民共和国
216├── CO: Colombia
217├── CR: Costa Rica
218├── CU: Cuba
219├── CV: República de Cabo Verde
220│ └── S: Sotavento Islands
221│ └── PR: Praia
222├── CW: Curaçao
223├── CX: Christmas Island
224├── CY: Κύπρος
225├── CZ: Česká republika
226├── DE: Deutschland
227│ ├── BB: Brandenburg
228│ ├── BE: Berlin
229│ ├── BW: Baden-Württemberg
230│ ├── BY: Bayern
231│ │ ├── A: Stadt Augsburg
232│ │ └── EVANG: Überwiegend evangelische Gemeinden
233│ ├── HB: Hansestadt Bremen
234│ ├── HE: Hessen
235│ ├── HH: Hansestadt Hamburg
236│ ├── MV: Mecklenburg Vorpommern
237│ ├── NI: Niedersachsen
238│ ├── NW: Nordrhein-Westfalen
239│ ├── RP: Rheinland-Pfalz
240│ ├── SH: Schleswig-Holstein
241│ ├── SL: Saarland
242│ ├── SN: Sachsen
243│ │ └── BZ: Landkreis Bautzen
244│ ├── ST: Sachsen-Anhalt
245│ └── TH: Thüringen
246│ ├── EIC: Landkreis Eichfeld
247│ ├── UH: Unstrut-Hainich-Kreis
248│ └── WAK: Wartburgkreis
249├── DJ: République de Djibouti
250├── DK: Danmark
251├── DM: Dominica
252├── DO: República Dominicana
253├── DZ: الجمهورية الجزائرية الديمقراطية الشعبية
254├── EC: Ecuador
255│ └── P: Pichincha
256│ └── QU: Quito
257├── EE: Eesti
258├── EG: جمهورية مصر العربية
259├── EH: الجمهورية العربية الصحراوية الديمقراطية
260├── ER: Eritrea
261├── ES: España
262│ ├── AN: Andalucía
263│ ├── AR: Aragón
264│ ├── AS: Asturias
265│ ├── CB: Cantabria
266│ ├── CE: Ciudad de Ceuta
267│ ├── CL: Castilla y León
268│ ├── CM: Castile-La Mancha
269│ ├── CN: Islas Canarias
270│ │ ├── EH: El Hierro
271│ │ ├── FU: Fuerteventura
272│ │ ├── GC: Gran Canaria
273│ │ ├── LG: La Gomera
274│ │ ├── LP: La Palma
275│ │ ├── LA: Lanzarote
276│ │ └── TE: Tenerife
277│ ├── CT: Cataluña
278│ ├── EX: Extremadura
279│ ├── GA: Galicia
280│ ├── IB: Illes Balears
281│ ├── MC: Murcia Region
282│ ├── MD: Comunidad de Madrid
283│ ├── ML: Ciudad de Melilla
284│ ├── NC: Comunidad Foral de Navarra
285│ ├── PV: País Vasco
286│ ├── RI: La Rioja
287│ └── VC: Comunitat Valenciana
288├── ET: ኢትዮጵያ
289├── FI: Suomi
290├── FJ: Matanitu Tugalala o Viti
291├── FO: Føroyar
292├── FR: France
293│ ├── 57: Département Moselle
294│ ├── 67: Département Bas-Rhin
295│ ├── 68: Département Haut-Rhin
296│ ├── YT: Département et région d'outre-mer Mayotte
297│ ├── MQ: Département et région d'outre-mer Martinique
298│ ├── GP: Département et région d'outre-mer Guadeloupe
299│ ├── GF: Département et région d'outre-mer Guyane
300│ ├── RE: Département et région d'outre-mer La Réunion
301│ ├── MF: Département et région d'outre-mer Saint Martin
302│ └── BL: Département et région d'outre-mer Saint Barthélemy
303├── GA: Gabon
304├── GB: United Kingdom
305│ ├── ALD: Alderney
306│ ├── ENG: England
307│ ├── NIR: Northern Ireland
308│ ├── SCT: Scotland
309│ └── WLS: Wales
310├── GD: Grenada
311├── GE: საქართველო
312├── GF: Guyane
313├── GG: Guernsey
314├── GH: Ghana
315├── GI: Gibraltar
316├── GL: Kalaallit Nunaat
317├── GM: The Gambia
318├── GN: Guinée
319├── GP: Guadeloupe
320├── GQ: República de Guinea Ecuatorial
321├── GR: Ελλάδα
322├── GT: Guatemala
323├── GU: Guam
324├── GW: Guiné-Bissau
325├── GY: Guyana
326├── HK: 香港
327├── HN: Honduras
328├── HR: Hrvatska
329│ ├── 17: Split-Dalmatia
330│ └── 19: Dubrovnik-Neretva
331├── HT: Haïti
332├── HU: Magyarország
333├── IC: Islas Canarias
334│ ├── EH: El Hierro
335│ ├── FU: Fuerteventura
336│ ├── GC: Gran Canaria
337│ ├── LG: La Gomera
338│ ├── LP: La Palma
339│ ├── LA: Lanzarote
340│ └── TE: Tenerife
341├── ID: Indonesia
342├── IE: Ireland
343├── IL: מְדִינַת יִשְׂרָאֵל
344├── IM: Isle of Man
345├── IR: جمهوری اسلامی ایران
346├── IS: Ísland
347├── IT: Italia
348│ └── 32: Südtirol, Alto Adige
349├── JE: Jersey
350├── JM: Jamaica
351├── JP: 日本
352├── KE: Kenya
353├── KM: Union des Comores
354├── KN: St. Kitts & Nevis
355├── KR: 대한민국
356├── KY: Cayman Islands
357├── LC: St. Lucia
358├── LI: Lichtenstein
359├── LR: Liberia
360├── LS: \'Muso oa Lesotho
361├── LT: Lietuva
362├── LU: Luxembourg
363├── LV: Latvija
364├── LY: دولة ليبيا
365├── MA: المملكة المغربية
366├── MC: Monaco
367├── MD: Republica Moldova
368│ ├── CA: Cahul
369│ └── CU: Chișinău
370├── ME: Crna Gora
371├── MF: Saint Martin
372├── MG: Repoblikan'i Madagasikara
373├── MK: Република Македонија
374├── ML: République du Mali
375├── MQ: Martinique
376├── MR: الجمهورية الإسلامية الموريتانية
377├── MS: Montserrat
378├── MT: Malta
379├── MW: Malawi
380├── MX: México
381├── MY: Malaysia
382│ ├── 10: Selangor
383│ ├── 11: Terengganu
384│ ├── 12: Sabah
385│ ├── 13: Sarawak
386│ ├── 14: Kuala Lumpur
387│ ├── 15: Labuan
388│ ├── 16: Putrajaya
389│ ├── 01: Johor
390│ ├── 02: Kedah
391│ ├── 03: Kelantan
392│ ├── 04: Malacca
393│ ├── 05: Negeri Sembilan
394│ ├── 06: Pahang
395│ ├── 07: Penang
396│ ├── 08: Perak
397│ └── 09: Perlis
398├── MZ: Moçambique
399├── NA: Namibia
400├── NC: Nouvelle-Calédonie
401├── NE: République du Niger
402├── NG: Nigeria
403├── NI: Nicaragua
404├── NL: Nederland
405├── NO: Norge
406├── NZ: New Zealand
407│ ├── AUK: Auckland Province
408│ ├── BOP: Bay of Plenty
409│ ├── CAN: Canterbury
410│ │ └── Timaru: Timaru District
411│ ├── CIT: Chatham Islands
412│ ├── GIS: Gisborne
413│ ├── HKB: Hawke's Bay
414│ ├── MBH: Marlborough
415│ ├── MWT: Manawatu-Wanganui
416│ ├── NSN: Nelson
417│ ├── NTL: Northland
418│ ├── OTA: Otago Province
419│ ├── STL: Southland
420│ ├── TAS: Tasman
421│ ├── TKI: Taranaki
422│ ├── WKO: Waikato
423│ ├── WGN: Wellington Province
424│ └── WTC: Westland
425│ └── Buller: Buller district
426├── PA: Panamá
427├── PE: Perú
428│ └── CUS: Cuzco
429├── PH: Philippines
430├── PL: Polska
431├── PM: St. Pierre & Miquelon
432├── PR: Puerto Rico
433├── PT: Portugal
434├── PY: Paraguay
435├── RE: Réunion
436├── RO: Romania
437├── RS: Република Србија
438├── RU: Россия
439├── RW: Rwanda
440├── SC: Seychelles
441├── SD: جمهورية السودان
442├── SE: Sverige
443├── SG: Singapore
444├── SH: St. Helena
445│ ├── AC: Ascension Island
446│ ├── HL: Saint Helena
447│ └── TA: Tristan da Cunha
448├── SI: Republika Slovenija
449├── SJ: Svalbard & Jan Mayen
450├── SK: Slovenská republika
451├── SL: Sierra Leone
452├── SM: San Marino
453├── SN: République du Sénégal
454├── SO: Jamhuuriyadda Federaalka Soomaaliya
455│ ├── AW: Awdal
456│ ├── SA: Sanaag
457│ ├── SO: Sool
458│ ├── TO: Togdheer
459│ └── WO: Woqooyi Galbeed
460├── SR: Suriname
461├── SS: South Sudan
462├── ST: São Tomé & Príncipe
463├── SV: El Salvador
464│ └── SS: San Salvador
465├── SX: Sint Maarten
466├── SZ: Eswatini
467├── TC: Turks & Caicos Islands
468├── TD: جمهورية تشاد
469├── TG: République togolaise
470├── TN: الجمهورية التونسية
471├── TO: Puleʻanga Fakatuʻi ʻo Tonga
472├── TR: Türkiye
473├── TT: Trinidad & Tobago
474├── TW: 中華民國
475├── TZ: Tanzania
476├── UA: Україна
477├── UG: Uganda
478├── US: United States of America
479│ ├── AL: Alabama
480│ ├── AK: Alaska
481│ ├── AZ: Arizona
482│ ├── AR: Arkansas
483│ ├── CA: California
484│ │ └── LA: Los Angeles
485│ ├── CO: Colorado
486│ ├── CT: Connecticut
487│ ├── DE: Delaware
488│ ├── DC: District of Columbia
489│ ├── FL: Florida
490│ ├── GA: Georgia
491│ ├── HI: Hawaii
492│ ├── ID: Idaho
493│ ├── IL: Illinois
494│ ├── IN: Indiana
495│ ├── IA: Iowa
496│ ├── KS: Kansas
497│ ├── KY: Kentucky
498│ ├── LA: Louisiana
499│ │ └── NO: New Orleans
500│ ├── ME: Maine
501│ ├── MD: Maryland
502│ ├── MA: Massachusetts
503│ ├── MI: Michigan
504│ ├── MN: Minnesota
505│ ├── MS: Mississippi
506│ ├── MO: Missouri
507│ ├── MT: Montana
508│ ├── NE: Nebraska
509│ ├── NV: Nevada
510│ ├── NH: New Hampshire
511│ ├── NJ: New Jersey
512│ ├── NM: New Mexico
513│ ├── NY: New York
514│ ├── NC: North Carolina
515│ ├── ND: North Dakota
516│ ├── OH: Ohio
517│ ├── OK: Oklahoma
518│ ├── OR: Oregon
519│ ├── PA: Pennsylvania
520│ ├── RI: Rhode Island
521│ ├── SC: South Carolina
522│ ├── SD: South Dakota
523│ ├── TN: Tennessee
524│ ├── TX: Texas
525│ ├── UT: Utah
526│ ├── VT: Vermont
527│ ├── VA: Virginia
528│ ├── WA: Washington
529│ ├── WV: West Virginia
530│ ├── WI: Wisconsin
531│ └── WY: Wyoming
532├── UY: Uruguay
533├── VA: Stato della Città del Vaticano
534├── VC: St. Vincent & Grenadines
535├── VE: Venezuela
536│ ├── B: Anzoátegui
537│ ├── G: Carabobo
538│ ├── K: Lara
539│ │ └── BA: Barquisimeto
540│ ├── M: Miranda
541│ ├── N: Monagas
542│ ├── S: Táchira
543│ └── V: Zulia
544├── VG: British Virgin Islands
545├── VI: U.S. Virgin Islands
546├── VN: Cộng hòa Xã hội chủ nghĩa Việt Nam
547├── VU: République de Vanuatu
548├── XK: Republika e Kosovës
549├── YT: Mayotte
550├── ZA: South Africa
551├── ZM: Zambia
552└── ZW: Zimbabwe
553```
554<!-- tree! -->
555
556## Usage
557
558```js
559var Holidays = require('date-holidays')
560var hd = new Holidays()
561
562// get supported countries
563hd.getCountries()
564/*>
565{ AD: 'Andorra',
566 ...
567 US: 'United States' }
568*/
569
570// get supported states e.g. for US
571hd.getStates('US')
572/*>
573{ al: 'Alabama',
574 ...
575 wy: 'Wyoming' }
576*/
577
578// get supported regions e.g. for US, Lousiana
579hd.getRegions('US', 'la')
580/*>
581{ no: 'New Orleans' }
582*/
583
584// initialize holidays for US, Lousiana, New Orleans
585hd.init('US', 'la', 'no')
586// or using a new instance
587hd = new Holidays('US', 'la', 'no')
588
589// get all holidays for the year 2016
590hd.getHolidays(2016)
591/*>
592[ { date: '2016-01-01 00:00:00',
593 start: Fri Jan 01 2016 00:00:00 GMT-0600 (CST),
594 end: Sat Jan 02 2016 00:00:00 GMT-0600 (CST),
595 name: 'New Year\'s Day',
596 rule: '01-01 and if sunday then next monday if saturday then previous friday',
597 type: 'public' },
598 ...
599 { date: '2016-11-24 00:00:00',
600 start: Thu Nov 24 2016 00:00:00 GMT-0600 (CST),
601 end: Fri Nov 25 2016 00:00:00 GMT-0600 (CST),
602 name: 'Thanksgiving Day',
603 rule: '4th thursday in November',
604 type: 'public' },
605 ...
606 { date: '2016-12-26 00:00:00',
607 start: Mon Dec 26 2016 00:00:00 GMT-0600 (CST),
608 end: Tue Dec 27 2016 00:00:00 GMT-0600 (CST),
609 substitute: true,
610 name: 'Christmas Day (substitute day)',
611 rule: '12-25 and if sunday then next monday if saturday then previous friday',
612 type: 'public' } ]
613*/
614
615// check if date is a holiday while respecting timezones
616hd.isHoliday(new Date('2016-02-09 00:00:00 GMT+0000'))
617//> false
618hd.isHoliday(new Date('2016-02-09 10:00:00 GMT-0600'))
619/*>
620[{ date: '2016-02-09 00:00:00',
621 start: Tue Feb 09 2016 00:00:00 GMT-0600 (CST),
622 end: Wed Feb 10 2016 00:00:00 GMT-0600 (CST),
623 name: 'Mardi Gras',
624 rule: 'easter -47',
625 type: 'public' }
626]
627*/
628```
629
630## Holiday object
631
632`getHolidays()` as well as a matching `isHoliday()` call return either a list or
633a single holiday object which consists of:
634
635* {String} date - ISO Date String of (start)-date in local format
636* {Date} start - start date of holiday
637* {Date} end - end date of holiday
638* {String} name - name of holiday using `language` (if available)
639* {String} type - type of holiday `public|bank|school|optional|observance`
640* {Boolean} substitute - (optional) if true holiday substitutes another holiday`
641* {String} note - (optional) note`
642
643### Dates
644
645The `date` String represents the start date of the holiday in ISO format without
646timezone. This string it intended for information only.
647
648`start` and `end` are the start/end date of the holiday within the selected
649timezone of the country, state, region.
650
651### Name
652
653The `name` names the holiday in the local language of the selected country,
654state, region. The applied language(s) can be requested using `getLanguages()`.
655
656The language can be changed using the `setLanguages()` method. In case that not
657translation is available a fall-back to the next given language will be made.
658E.g. local language is "fr", `setLanguages('nl')` was called. For all holidays
659where no dutch translation is available the French version will be used instead.
660
661All holiday names should support an English translation.
662
663### Types of holidays
664
665Currently the following type with their meaning are supported
666
667| type | meaning |
668| ----------- | ------------------------------------------ |
669| public | public holiday |
670| bank | bank holiday, banks and offices are closed |
671| school | school holiday, schools are closed |
672| optional | majority of people take a day off |
673| observance | optional festivity, no paid day off |
674
675Additionally a `note` field is sometimes available for further clarification.
676
677## API
678
679See [Holidays API][] for further information.
680
681## Data
682
683All data for the holidays of the different countries is contained in
684[`./data/holidays.json`](./data/holidays.json). For changing holiday data edit the appropriate country in `./data/countries`.
685Any details on structure and
686available grammar for holiday attribution is described in
687[holidays.yaml specification][].
688
689<a name="custom"></a>
690
691## Custom builds of `holidays.json`
692
693If only selected countries are required in `data/holidays.json` you can add the
694following script to your npm scripts section. E.g. for picking just US, Canada,
695Mexico do the following:
696
697```js
698"scripts": {
699 "build": "holidays2json --pick US,CA,MX --min"
700},
701```
702
703The `--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.
704
705Alternatively you may use the `--omit` option.
706
707Manually use
708
709```bash
710npx holidays2json --pick US,CA,MX
711```
712
713> **NOTE:** There are some countries which depend on data of others which
714> might render the file useless. e.g. "GU" requires "US", so try
715> to pick or omit both.
716
717## Bundling with webpack
718
719To minimize bundle sizes consider adding the following lines in your webpack config.
720Please take a look at `./webpack.config.js`. To further reduce size consider custom builds by only selecting required countries.
721
722```js
723...
724 plugins: [
725 new webpack.IgnorePlugin({
726 checkResource (resource, context) {
727 // ---- do not bundle astronomia vsop planet data
728 if (/\/astronomia\/data$/.test(context)) {
729 return !['./deltat.js', './vsop87Bearth.js'].includes(resource)
730 }
731 // ---- do not bundle moment locales
732 if (/\/moment\/locale$/.test(context)) {
733 return true
734 }
735 return false
736 }
737 })
738```
739
740## Browser
741
742This project also runs in all modern browsers. See `./examples/browser`
743
744| Browser | Version | Notes |
745| ------- | :-----: | ---------------------------- |
746| Chrome | >=45 | |
747| Firefox | >=45 | |
748| Safari | >=10 | |
749| Edge | >=13 | |
750| IE | >=11 | needs polyfill `core-js/es6` |
751
752Please do not forget to set the correct charset!
753
754```html
755<html>
756<head>
757 <!-- set page-wide -->
758 <meta charset="UTF-8">
759 ...
760</head>
761<body>
762 ...
763 <!-- or per script -->
764 <script src="your-bundle.js" charset="UTF-8"></script>
765```
766
767## CDN
768
769Minified distribution bundles are available via https://unpkg.com
770
771> **NOTE:** dist-bundles are quite huge in size ~1.5MByte so use [custom](#custom) builds instead.
772
773See https://unpkg.com/date-holidays/dist/
774
775- `index.min.js`: commonjs2 bundle
776- `umd.min.js`: umd bundle
777
778<a name="contribution"></a>
779
780## Contribution and License Agreement
781
782You like to contribute please read [CONTRIBUTING.md][].
783
784If you contribute code to this project, you are implicitly allowing your
785code to be distributed under the ISC license. You are also implicitly
786verifying that all code is your original work or correctly attributed
787with the source of its origin and license.
788
789## License
790
791Copyright (c) 2016- commenthol ([ISC License](http://opensource.org/licenses/ISC))
792
793The data contained in `holidays.json` and `./data/countries/*.yaml` is available under [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
794as the majority of data obtained relies on wikipedia articles. The required
795attribution can be found inside the files `./data/countries/*.yaml`.
796
797See [LICENSE][] for more information.
798
799## References
800
801<!-- !ref -->
802
803* [CONTRIBUTING.md][CONTRIBUTING.md]
804* [date-holidays-ical][date-holidays-ical]
805* [date-holidays-parser][date-holidays-parser]
806* [Holidays API][Holidays API]
807* [holidays.yaml specification][holidays.yaml specification]
808* [LICENSE][LICENSE]
809
810<!-- ref! -->
811
812[LICENSE]: ./LICENSE
813[CONTRIBUTING.md]: ./CONTRIBUTING.md
814[holidays.yaml specification]: https://github.com/commenthol/date-holidays/blob/master/docs/specification.md
815[Holidays API]: https://github.com/commenthol/date-holidays-parser/blob/master/docs/Holidays.md
816[date-holidays-parser]: https://github.com/commenthol/date-holidays-parser
817[date-holidays-ical]: https://github.com/commenthol/date-holidays-ical