Skip to content

Commit

Permalink
Proof of concept to avoid redundancy in holiday_definitions. Related to
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid committed Oct 17, 2015
1 parent 2b39262 commit 947dab1
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions opening_hours.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
* Fixed spacing in parenthesis:
* :%s/\[\zs\([^ ]\)/ \1/e | %s/\([^ ]\)\]/\1 \]/e | %s/,\([^ ]\)/, \1/e
*/
var holiday_definitions_PH_de = { // https://de.wikipedia.org/wiki/Feiertage_in_Deutschland
'Neujahrstag' : [ 1, 1 ], // month 1, day 1, whole Germany
'Heilige Drei Könige' : [ 1, 6, [ 'Baden-Württemberg', 'Bayern', 'Sachsen-Anhalt'] ], // only in the specified states
'Tag der Arbeit' : [ 5, 1 ], // whole Germany
'Karfreitag' : [ 'easter', -2 ], // two days before easter
'Ostersonntag' : [ 'easter', 0, [ 'Brandenburg'] ],
'Ostermontag' : [ 'easter', 1 ],
'Christi Himmelfahrt' : [ 'easter', 39 ],
'Pfingstsonntag' : [ 'easter', 49, [ 'Brandenburg'] ],
'Pfingstmontag' : [ 'easter', 50 ],
'Fronleichnam' : [ 'easter', 60, [ 'Baden-Württemberg', 'Bayern', 'Hessen', 'Nordrhein-Westfalen', 'Rheinland-Pfalz', 'Saarland' ] ],
'Mariä Himmelfahrt' : [ 8, 15, [ 'Saarland'] ],
'Tag der Deutschen Einheit' : [ 10, 3 ],
'Reformationstag' : [ 10, 31, [ 'Brandenburg', 'Mecklenburg-Vorpommern', 'Sachsen', 'Sachsen-Anhalt', 'Thüringen'] ],
'Allerheiligen' : [ 11, 1, [ 'Baden-Württemberg', 'Bayern', 'Nordrhein-Westfalen', 'Rheinland-Pfalz', 'Saarland' ] ],
'1. Weihnachtstag' : [ 12, 25 ],
'2. Weihnachtstag' : [ 12, 26 ],
// 'Silvester' : [ 12, 31 ], // for testing
};
var holiday_definitions = {
'fr': { // {{{
'PH': { // https://fr.wikipedia.org/wiki/F%C3%AAtes_et_jours_f%C3%A9ri%C3%A9s_en_France
Expand Down Expand Up @@ -45,25 +64,7 @@
},
}, // }}}
'de': { // {{{
'PH': { // https://de.wikipedia.org/wiki/Feiertage_in_Deutschland
'Neujahrstag' : [ 1, 1 ], // month 1, day 1, whole Germany
'Heilige Drei Könige' : [ 1, 6, [ 'Baden-Württemberg', 'Bayern', 'Sachsen-Anhalt'] ], // only in the specified states
'Tag der Arbeit' : [ 5, 1 ], // whole Germany
'Karfreitag' : [ 'easter', -2 ], // two days before easter
'Ostersonntag' : [ 'easter', 0, [ 'Brandenburg'] ],
'Ostermontag' : [ 'easter', 1 ],
'Christi Himmelfahrt' : [ 'easter', 39 ],
'Pfingstsonntag' : [ 'easter', 49, [ 'Brandenburg'] ],
'Pfingstmontag' : [ 'easter', 50 ],
'Fronleichnam' : [ 'easter', 60, [ 'Baden-Württemberg', 'Bayern', 'Hessen', 'Nordrhein-Westfalen', 'Rheinland-Pfalz', 'Saarland' ] ],
'Mariä Himmelfahrt' : [ 8, 15, [ 'Saarland'] ],
'Tag der Deutschen Einheit' : [ 10, 3 ],
'Reformationstag' : [ 10, 31, [ 'Brandenburg', 'Mecklenburg-Vorpommern', 'Sachsen', 'Sachsen-Anhalt', 'Thüringen'] ],
'Allerheiligen' : [ 11, 1, [ 'Baden-Württemberg', 'Bayern', 'Nordrhein-Westfalen', 'Rheinland-Pfalz', 'Saarland' ] ],
'1. Weihnachtstag' : [ 12, 25 ],
'2. Weihnachtstag' : [ 12, 26 ],
// 'Silvester' : [ 12, 31 ], // for testing
},
'PH': holiday_definitions_PH_de,
'Baden-Württemberg': { // does only apply in Baden-Württemberg
// This more specific rule set overwrites the country wide one (they are just ignored).
// You may use this instead of the country wide with some
Expand Down

0 comments on commit 947dab1

Please sign in to comment.