UNPKG

25.5 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: 195
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│ ├── MD: Comunidad de Madrid
263│ ├── AN: Andalucía
264│ ├── AR: Aragón
265│ ├── CT: Catalonia
266│ └── CN: Islas Canarias
267│ ├── EH: El Hierro
268│ ├── FU: Fuerteventura
269│ ├── GC: Gran Canaria
270│ ├── LG: La Gomera
271│ ├── LP: La Palma
272│ ├── LA: Lanzarote
273│ └── TE: Tenerife
274├── ET: ኢትዮጵያ
275├── FI: Suomi
276├── FJ: Matanitu Tugalala o Viti
277├── FO: Føroyar
278├── FR: France
279│ ├── 57: Département Moselle
280│ ├── 67: Département Bas-Rhin
281│ ├── 68: Département Haut-Rhin
282│ ├── YT: Département et région d'outre-mer Mayotte
283│ ├── MQ: Département et région d'outre-mer Martinique
284│ ├── GP: Département et région d'outre-mer Guadeloupe
285│ ├── GF: Département et région d'outre-mer Guyane
286│ ├── RE: Département et région d'outre-mer La Réunion
287│ ├── MF: Département et région d'outre-mer Saint Martin
288│ └── BL: Département et région d'outre-mer Saint Barthélemy
289├── GA: Gabon
290├── GB: United Kingdom
291│ ├── ALD: Alderney
292│ ├── ENG: England
293│ ├── NIR: Northern Ireland
294│ ├── SCT: Scotland
295│ └── WLS: Wales
296├── GD: Grenada
297├── GE: საქართველო
298├── GF: Guyane
299├── GG: Guernsey
300├── GH: Ghana
301├── GI: Gibraltar
302├── GL: Kalaallit Nunaat
303├── GM: The Gambia
304├── GN: Guinée
305├── GP: Guadeloupe
306├── GQ: República de Guinea Ecuatorial
307├── GR: Ελλάδα
308├── GT: Guatemala
309├── GU: Guam
310├── GW: Guiné-Bissau
311├── GY: Guyana
312├── HK: 香港
313├── HN: Honduras
314├── HR: Hrvatska
315│ ├── 17: Split-Dalmatia
316│ └── 19: Dubrovnik-Neretva
317├── HT: Haïti
318├── HU: Magyarország
319├── IC: Islas Canarias
320│ ├── EH: El Hierro
321│ ├── FU: Fuerteventura
322│ ├── GC: Gran Canaria
323│ ├── LG: La Gomera
324│ ├── LP: La Palma
325│ ├── LA: Lanzarote
326│ └── TE: Tenerife
327├── ID: Indonesia
328├── IE: Ireland
329├── IL: מְדִינַת יִשְׂרָאֵל
330├── IM: Isle of Man
331├── IS: Ísland
332├── IT: Italia
333│ └── 32: Südtirol, Alto Adige
334├── JE: Jersey
335├── JM: Jamaica
336├── JP: 日本
337├── KE: Kenya
338├── KM: Union des Comores
339├── KN: St. Kitts & Nevis
340├── KR: 대한민국
341├── KY: Cayman Islands
342├── LC: St. Lucia
343├── LI: Lichtenstein
344├── LR: Liberia
345├── LS: \'Muso oa Lesotho
346├── LT: Lietuva
347├── LU: Luxembourg
348├── LV: Latvija
349├── LY: دولة ليبيا
350├── MA: المملكة المغربية
351├── MC: Monaco
352├── MD: Republica Moldova
353│ ├── CA: Cahul
354│ └── CU: Chișinău
355├── ME: Crna Gora
356├── MF: Saint Martin
357├── MG: Repoblikan'i Madagasikara
358├── MK: Република Македонија
359├── ML: République du Mali
360├── MQ: Martinique
361├── MR: الجمهورية الإسلامية الموريتانية
362├── MS: Montserrat
363├── MT: Malta
364├── MW: Malawi
365├── MX: México
366├── MY: Malaysia
367│ ├── 10: Selangor
368│ ├── 11: Terengganu
369│ ├── 12: Sabah
370│ ├── 13: Sarawak
371│ ├── 14: Kuala Lumpur
372│ ├── 15: Labuan
373│ ├── 16: Putrajaya
374│ ├── 01: Johor
375│ ├── 02: Kedah
376│ ├── 03: Kelantan
377│ ├── 04: Malacca
378│ ├── 05: Negeri Sembilan
379│ ├── 06: Pahang
380│ ├── 07: Penang
381│ ├── 08: Perak
382│ └── 09: Perlis
383├── MZ: Moçambique
384├── NA: Namibia
385├── NC: Nouvelle-Calédonie
386├── NE: République du Niger
387├── NG: Nigeria
388├── NI: Nicaragua
389├── NL: Nederland
390├── NO: Norge
391├── NZ: New Zealand
392│ ├── AUK: Auckland Province
393│ ├── BOP: Bay of Plenty
394│ ├── CAN: Canterbury
395│ │ └── Timaru: Timaru District
396│ ├── CIT: Chatham Islands
397│ ├── GIS: Gisborne
398│ ├── HKB: Hawke's Bay
399│ ├── MBH: Marlborough
400│ ├── MWT: Manawatu-Wanganui
401│ ├── NSN: Nelson
402│ ├── NTL: Northland
403│ ├── OTA: Otago Province
404│ ├── STL: Southland
405│ ├── TAS: Tasman
406│ ├── TKI: Taranaki
407│ ├── WKO: Waikato
408│ ├── WGN: Wellington Province
409│ └── WTC: Westland
410│ └── Buller: Buller district
411├── PA: Panamá
412├── PE: Perú
413│ └── CUS: Cuzco
414├── PH: Philippines
415├── PL: Polska
416├── PM: St. Pierre & Miquelon
417├── PR: Puerto Rico
418├── PT: Portugal
419├── PY: Paraguay
420├── RE: Réunion
421├── RO: Romania
422├── RS: Република Србија
423├── RU: Россия
424├── RW: Rwanda
425├── SC: Seychelles
426├── SD: جمهورية السودان
427├── SE: Sverige
428├── SG: Singapore
429├── SH: St. Helena
430│ ├── AC: Ascension Island
431│ ├── HL: Saint Helena
432│ └── TA: Tristan da Cunha
433├── SI: Republika Slovenija
434├── SJ: Svalbard & Jan Mayen
435├── SK: Slovenská republika
436├── SL: Sierra Leone
437├── SM: San Marino
438├── SN: République du Sénégal
439├── SO: Jamhuuriyadda Federaalka Soomaaliya
440│ ├── AW: Awdal
441│ ├── SA: Sanaag
442│ ├── SO: Sool
443│ ├── TO: Togdheer
444│ └── WO: Woqooyi Galbeed
445├── SR: Suriname
446├── SS: South Sudan
447├── ST: São Tomé & Príncipe
448├── SV: El Salvador
449│ └── SS: San Salvador
450├── SX: Sint Maarten
451├── SZ: Eswatini
452├── TC: Turks & Caicos Islands
453├── TD: جمهورية تشاد
454├── TG: République togolaise
455├── TN: الجمهورية التونسية
456├── TO: Puleʻanga Fakatuʻi ʻo Tonga
457├── TR: Türkiye
458├── TT: Trinidad & Tobago
459├── TW: 中華民國
460├── TZ: Tanzania
461├── UA: Україна
462├── UG: Uganda
463├── US: United States of America
464│ ├── AL: Alabama
465│ ├── AK: Alaska
466│ ├── AZ: Arizona
467│ ├── AR: Arkansas
468│ ├── CA: California
469│ │ └── LA: Los Angeles
470│ ├── CO: Colorado
471│ ├── CT: Connecticut
472│ ├── DE: Delaware
473│ ├── DC: District of Columbia
474│ ├── FL: Florida
475│ ├── GA: Georgia
476│ ├── HI: Hawaii
477│ ├── ID: Idaho
478│ ├── IL: Illinois
479│ ├── IN: Indiana
480│ ├── IA: Iowa
481│ ├── KS: Kansas
482│ ├── KY: Kentucky
483│ ├── LA: Louisiana
484│ │ └── NO: New Orleans
485│ ├── ME: Maine
486│ ├── MD: Maryland
487│ ├── MA: Massachusetts
488│ ├── MI: Michigan
489│ ├── MN: Minnesota
490│ ├── MS: Mississippi
491│ ├── MO: Missouri
492│ ├── MT: Montana
493│ ├── NE: Nebraska
494│ ├── NV: Nevada
495│ ├── NH: New Hampshire
496│ ├── NJ: New Jersey
497│ ├── NM: New Mexico
498│ ├── NY: New York
499│ ├── NC: North Carolina
500│ ├── ND: North Dakota
501│ ├── OH: Ohio
502│ ├── OK: Oklahoma
503│ ├── OR: Oregon
504│ ├── PA: Pennsylvania
505│ ├── RI: Rhode Island
506│ ├── SC: South Carolina
507│ ├── SD: South Dakota
508│ ├── TN: Tennessee
509│ ├── TX: Texas
510│ ├── UT: Utah
511│ ├── VT: Vermont
512│ ├── VA: Virginia
513│ ├── WA: Washington
514│ ├── WV: West Virginia
515│ ├── WI: Wisconsin
516│ └── WY: Wyoming
517├── UY: Uruguay
518├── VA: Stato della Città del Vaticano
519├── VC: St. Vincent & Grenadines
520├── VE: Venezuela
521│ ├── B: Anzoátegui
522│ ├── G: Carabobo
523│ ├── K: Lara
524│ │ └── BA: Barquisimeto
525│ ├── M: Miranda
526│ ├── N: Monagas
527│ ├── S: Táchira
528│ └── V: Zulia
529├── VG: British Virgin Islands
530├── VI: U.S. Virgin Islands
531├── VN: Cộng hòa Xã hội chủ nghĩa Việt Nam
532├── VU: République de Vanuatu
533├── XK: Republika e Kosovës
534├── YT: Mayotte
535├── ZA: South Africa
536├── ZM: Zambia
537└── ZW: Zimbabwe
538```
539<!-- tree! -->
540
541## Usage
542
543```js
544var Holidays = require('date-holidays')
545var hd = new Holidays()
546
547// get supported countries
548hd.getCountries()
549/*>
550{ AD: 'Andorra',
551 ...
552 US: 'United States' }
553*/
554
555// get supported states e.g. for US
556hd.getStates('US')
557/*>
558{ al: 'Alabama',
559 ...
560 wy: 'Wyoming' }
561*/
562
563// get supported regions e.g. for US, Lousiana
564hd.getRegions('US', 'la')
565/*>
566{ no: 'New Orleans' }
567*/
568
569// initialize holidays for US, Lousiana, New Orleans
570hd.init('US', 'la', 'no')
571// or using a new instance
572hd = new Holidays('US', 'la', 'no')
573
574// get all holidays for the year 2016
575hd.getHolidays(2016)
576/*>
577[ { date: '2016-01-01 00:00:00',
578 start: Fri Jan 01 2016 00:00:00 GMT-0600 (CST),
579 end: Sat Jan 02 2016 00:00:00 GMT-0600 (CST),
580 name: 'New Year\'s Day',
581 rule: '01-01 and if sunday then next monday if saturday then previous friday',
582 type: 'public' },
583 ...
584 { date: '2016-11-24 00:00:00',
585 start: Thu Nov 24 2016 00:00:00 GMT-0600 (CST),
586 end: Fri Nov 25 2016 00:00:00 GMT-0600 (CST),
587 name: 'Thanksgiving Day',
588 rule: '4th thursday in November',
589 type: 'public' },
590 ...
591 { date: '2016-12-26 00:00:00',
592 start: Mon Dec 26 2016 00:00:00 GMT-0600 (CST),
593 end: Tue Dec 27 2016 00:00:00 GMT-0600 (CST),
594 substitute: true,
595 name: 'Christmas Day (substitute day)',
596 rule: '12-25 and if sunday then next monday if saturday then previous friday',
597 type: 'public' } ]
598*/
599
600// check if date is a holiday while respecting timezones
601hd.isHoliday(new Date('2016-02-09 00:00:00 GMT+0000'))
602//> false
603hd.isHoliday(new Date('2016-02-09 10:00:00 GMT-0600'))
604/*>
605[{ date: '2016-02-09 00:00:00',
606 start: Tue Feb 09 2016 00:00:00 GMT-0600 (CST),
607 end: Wed Feb 10 2016 00:00:00 GMT-0600 (CST),
608 name: 'Mardi Gras',
609 rule: 'easter -47',
610 type: 'public' }
611]
612*/
613```
614
615## Holiday object
616
617`getHolidays()` as well as a matching `isHoliday()` call return either a list or
618a single holiday object which consists of:
619
620* {String} date - ISO Date String of (start)-date in local format
621* {Date} start - start date of holiday
622* {Date} end - end date of holiday
623* {String} name - name of holiday using `language` (if available)
624* {String} type - type of holiday `public|bank|school|optional|observance`
625* {Boolean} substitute - (optional) if true holiday substitutes another holiday`
626* {String} note - (optional) note`
627
628### Dates
629
630The `date` String represents the start date of the holiday in ISO format without
631timezone. This string it intended for information only.
632
633`start` and `end` are the start/end date of the holiday within the selected
634timezone of the country, state, region.
635
636### Name
637
638The `name` names the holiday in the local language of the selected country,
639state, region. The applied language(s) can be requested using `getLanguages()`.
640
641The language can be changed using the `setLanguages()` method. In case that not
642translation is available a fall-back to the next given language will be made.
643E.g. local language is "fr", `setLanguages('nl')` was called. For all holidays
644where no dutch translation is available the French version will be used instead.
645
646All holiday names should support an English translation.
647
648### Types of holidays
649
650Currently the following type with their meaning are supported
651
652| type | meaning |
653| ----------- | ------------------------------------------ |
654| public | public holiday |
655| bank | bank holiday, banks and offices are closed |
656| school | school holiday, schools are closed |
657| optional | majority of people take a day off |
658| observance | optional festivity, no paid day off |
659
660Additionally a `note` field is sometimes available for further clarification.
661
662## API
663
664See [Holidays API][] for further information.
665
666## Data
667
668All data for the holidays of the different countries is contained in
669[`./data/holidays.json`](./data/holidays.json). For changing holiday data edit the appropriate country in `./data/countries`.
670Any details on structure and
671available grammar for holiday attribution is described in
672[holidays.yaml specification][].
673
674<a name="custom"></a>
675
676## Custom builds of `holidays.json`
677
678If only selected countries are required in `data/holidays.json` you can add the
679following script to your npm scripts section. E.g. for picking just US, Canada,
680Mexico do the following:
681
682```js
683"scripts": {
684 "build": "holidays2json --pick US,CA,MX --min"
685},
686```
687
688The `--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.
689
690Alternatively you may use the `--omit` option.
691
692Manually use
693
694```bash
695npx holidays2json --pick US,CA,MX
696```
697
698> **NOTE:** There are some countries which depend on data of others which
699> might render the file useless. e.g. "GU" requires "US", so try
700> to pick or omit both.
701
702## Bundling with webpack
703
704To minimize bundle sizes consider adding the following lines in your webpack config.
705Please take a look at `./webpack.config.js`. To further reduce size consider custom builds by only selecting required countries.
706
707```js
708...
709 plugins: [
710 new webpack.IgnorePlugin({
711 checkResource (resource, context) {
712 // ---- do not bundle astronomia vsop planet data
713 if (/\/astronomia\/data$/.test(context)) {
714 return !['./deltat.js', './vsop87Bearth.js'].includes(resource)
715 }
716 // ---- do not bundle moment locales
717 if (/\/moment\/locale$/.test(context)) {
718 return true
719 }
720 return false
721 }
722 })
723```
724
725## Browser
726
727This project also runs in all modern browsers. See `./examples/browser`
728
729| Browser | Version | Notes |
730| ------- | :-----: | ---------------------------- |
731| Chrome | >=45 | |
732| Firefox | >=45 | |
733| Safari | >=10 | |
734| Edge | >=13 | |
735| IE | >=11 | needs polyfill `core-js/es6` |
736
737Please do not forget to set the correct charset!
738
739```html
740<html>
741<head>
742 <!-- set page-wide -->
743 <meta charset="UTF-8">
744 ...
745</head>
746<body>
747 ...
748 <!-- or per script -->
749 <script src="your-bundle.js" charset="UTF-8"></script>
750```
751
752## CDN
753
754Minified distribution bundles are available via https://unpkg.com
755
756> **NOTE:** dist-bundles are quite huge in size ~1.5MByte so use [custom](#custom) builds instead.
757
758See https://unpkg.com/date-holidays/dist/
759
760- `index.min.js`: commonjs2 bundle
761- `umd.min.js`: umd bundle
762
763<a name="contribution"></a>
764
765## Contribution and License Agreement
766
767You like to contribute please read [CONTRIBUTING.md][].
768
769If you contribute code to this project, you are implicitly allowing your
770code to be distributed under the ISC license. You are also implicitly
771verifying that all code is your original work or correctly attributed
772with the source of its origin and license.
773
774## License
775
776Copyright (c) 2016- commenthol ([ISC License](http://opensource.org/licenses/ISC))
777
778The 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/)
779as the majority of data obtained relies on wikipedia articles. The required
780attribution can be found inside the files `./data/countries/*.yaml`.
781
782See [LICENSE][] for more information.
783
784## References
785
786<!-- !ref -->
787
788* [CONTRIBUTING.md][CONTRIBUTING.md]
789* [date-holidays-ical][date-holidays-ical]
790* [date-holidays-parser][date-holidays-parser]
791* [Holidays API][Holidays API]
792* [holidays.yaml specification][holidays.yaml specification]
793* [LICENSE][LICENSE]
794
795<!-- ref! -->
796
797[LICENSE]: ./LICENSE
798[CONTRIBUTING.md]: ./CONTRIBUTING.md
799[holidays.yaml specification]: https://github.com/commenthol/date-holidays/blob/master/docs/specification.md
800[Holidays API]: https://github.com/commenthol/date-holidays-parser/blob/master/docs/Holidays.md
801[date-holidays-parser]: https://github.com/commenthol/date-holidays-parser
802[date-holidays-ical]: https://github.com/commenthol/date-holidays-ical