From 1978219e697b66d769b7d7029f1b93d81f12a8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20M=C3=BCller?= Date: Tue, 3 Apr 2018 16:50:25 +0200 Subject: [PATCH 1/2] Added Austrian holidays Includes public and non-public holidays --- README.md | 10 ++++ locale/austria.js | 137 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 locale/austria.js diff --git a/README.md b/README.md index d5407e1..8212b7a 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,16 @@ moment('2017-01-01').holidaysBetween(); ### Available Locales/Regions * [Argentina](locale/argentina.js) +* [Austria](locale/austria.js) + * `Austria/B` - Burgenland + * `Austria/K` - Kärnten + * `Austria/NOE` - Niederösterreich + * `Austria/OOE` - Oberösterreich + * `Austria/S` - Salzburg + * `Austria/ST` - Steiermark + * `Austria/T` - Tirol + * `Austria/V` - Vorarlberl + * `Austria/W` - Wien * [Canada](locale/canada.js) * `Canada/AB` - Alberta * `Canada/BC` - British Columbia diff --git a/locale/austria.js b/locale/austria.js new file mode 100644 index 0000000..a1bdb41 --- /dev/null +++ b/locale/austria.js @@ -0,0 +1,137 @@ +//! moment-holiday.js locale configuration +//! locale : Austria +//! author : Nick Müller : https://github.com/MorpheusXAUT +/* regions : + B : Burgenland + K : Kärnten + NOE : Niederösterreich + OOE : Oberösterreich + S : Salzburg + ST : Steiermark + T : Tirol + V : Vorarlberl + W : Wien +*/ + +(function() { + var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment; + + // Holiday data taken from https://www.feiertage-oesterreich.at, including non-public holidays + moment.holidays.austria = { + "Neujahrstag": { + date: '1/1', + keywords: ['new', 'year'] + }, + "Heilige Drei Könige": { + date: '1/6', + keywords: ['konige'] + }, + "St. Josef": { + date: '3/19', + keywords: ['josef'], + keywords_n: ['public'], + regions: ['k', 'st', 't', 'v'] + }, + "Karfreitag": { + date: 'easter-2', + keywords: ['good', 'friday'], + keywords_n: ['public'] + }, + "Ostersonntag": { + date: 'easter', + keywords: ['easter'], + keywords_n: ['monday'] + }, + "Ostermontag": { + date: 'easter+1', + keywords: ['easter', 'monday'] + }, + "Staatsfeiertag": { + date: '5/1', + keywords: ['national'] + }, + "St. Florian": { + date: '4/5', + keywords: ['florian'], + keywords_n: ['public'], + regions: ['k', 'st', 't', 'v'] + }, + "Christi Himmelfahrt": { + date: 'easter+39', + kaywords: ['ascension'] + }, + "Pfingstsonntag": { + date: 'easter+49', + keywords: ['pentecost'] + }, + "Pfingstmontag": { + date: 'easter+50', + keywords: ['whit', 'monday'] + }, + "Fronleichnam": { + date: 'easter+60', + keywords: ['corpus', 'christi'] + }, + "Mariä Himmelfahrt": { + date: '8/15', + keywords: ['assumption', 'mary'] + }, + "St. Rupert": { + date: '9/24', + keywords: ['rupert'], + keywords_n: ['public'], + regions: ['s'] + }, + "Tag der Volksabstimmung": { + date: '10/10', + keywords: ['referendum'], + keywords_n: ['public'], + regions: ['s'] + }, + "Nationalfeiertag": { + date: '10/26', + keywords: ['national'] + }, + "Allerheiligen": { + date: '11/1', + keywords: ['all', 'saints'] + }, + "St. Martin": { + date: '11/11', + keywords: ['martin'], + keywords_n: ['public'], + regions: ['b'] + }, + "St. Leopold": { + date: '11/15', + keywords: ['leopold'], + keywords_n: ['public'], + regions: ['noe'] + }, + "Mariä Empfängnis": { + date: '8/15', + keywords: ['immaculate', 'conception'] + }, + "Heiliger Abend": { + date: '12/24', + keywords: ['christmas'], + keywords_n: ['public'], + keywords_y: ['eve'] + }, + "Christtag": { + date: '12/25', + keywords: ['christmas'], + keywords_n: ['eve'] + }, + "Stefanitag": { + date: '12/25', + keywords: ['stephen'] + }, + "Silvester": { + date: '12/31', + keywords: ['new', 'year', 'eve'] + } + }; + + if ((typeof module !== 'undefined' && module !== null ? module.exports : void 0) != null) { module.exports = moment; } +}).call(this); From c477fef85c1519b8cfe90a7e77c1a2e4dc8114ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20M=C3=BCller?= Date: Wed, 4 Apr 2018 11:47:18 +0200 Subject: [PATCH 2/2] Fixed "Stefanitag" date and "public" filter not working properly Fixed typo in `keywords` entry for "Christi Himmelfahrt" --- locale/austria.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/locale/austria.js b/locale/austria.js index a1bdb41..14e8a5c 100644 --- a/locale/austria.js +++ b/locale/austria.js @@ -17,14 +17,16 @@ var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment; // Holiday data taken from https://www.feiertage-oesterreich.at, including non-public holidays + // Public holidays can be "filtered" by passing `public` as a value for `.holidays()` and `.isHoliday()` calls moment.holidays.austria = { "Neujahrstag": { date: '1/1', - keywords: ['new', 'year'] + keywords: ['new', 'year', 'public'], + keywords_n: ['eve'] }, "Heilige Drei Könige": { date: '1/6', - keywords: ['konige'] + keywords: ['konige', 'public'] }, "St. Josef": { date: '3/19', @@ -39,16 +41,16 @@ }, "Ostersonntag": { date: 'easter', - keywords: ['easter'], + keywords: ['easter', 'public'], keywords_n: ['monday'] }, "Ostermontag": { date: 'easter+1', - keywords: ['easter', 'monday'] + keywords: ['easter', 'monday', 'public'] }, "Staatsfeiertag": { date: '5/1', - keywords: ['national'] + keywords: ['national', 'public'] }, "St. Florian": { date: '4/5', @@ -58,23 +60,23 @@ }, "Christi Himmelfahrt": { date: 'easter+39', - kaywords: ['ascension'] + keywords: ['ascension', 'public'] }, "Pfingstsonntag": { date: 'easter+49', - keywords: ['pentecost'] + keywords: ['pentecost', 'public'] }, "Pfingstmontag": { date: 'easter+50', - keywords: ['whit', 'monday'] + keywords: ['whit', 'monday', 'public'] }, "Fronleichnam": { date: 'easter+60', - keywords: ['corpus', 'christi'] + keywords: ['corpus', 'christi', 'public'] }, "Mariä Himmelfahrt": { date: '8/15', - keywords: ['assumption', 'mary'] + keywords: ['assumption', 'mary', 'public'] }, "St. Rupert": { date: '9/24', @@ -90,11 +92,11 @@ }, "Nationalfeiertag": { date: '10/26', - keywords: ['national'] + keywords: ['national', 'public'] }, "Allerheiligen": { date: '11/1', - keywords: ['all', 'saints'] + keywords: ['all', 'saints', 'public'] }, "St. Martin": { date: '11/11', @@ -110,7 +112,7 @@ }, "Mariä Empfängnis": { date: '8/15', - keywords: ['immaculate', 'conception'] + keywords: ['immaculate', 'conception', 'public'] }, "Heiliger Abend": { date: '12/24', @@ -120,16 +122,18 @@ }, "Christtag": { date: '12/25', - keywords: ['christmas'], + keywords: ['christmas', 'public'], keywords_n: ['eve'] }, "Stefanitag": { - date: '12/25', - keywords: ['stephen'] + date: '12/26', + keywords: ['stephen', 'public'] }, "Silvester": { date: '12/31', - keywords: ['new', 'year', 'eve'] + keywords: ['new', 'year'], + keywords_n: ['public'], + keywords_y: ['eve'] } };