forked from holidays/definitions
-
Notifications
You must be signed in to change notification settings - Fork 5
/
ch.yaml
252 lines (250 loc) · 7.87 KB
/
ch.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# Swiss holiday definitions for the Ruby Holiday gem.
#
# Updated: 2012-03-16.
# Sources:
# http://www.bj.admin.ch/content/dam/data/staat_buerger/zivilprozessrecht/kant-feiertage.pdf
#
# Word of warning:
# ================
# As the holidays are defined on a state level and sometimes even on a district / village level,
# this holiday definition is an approximation of the reality. It should be accurate for most of the cases but
# no guarantee is given that it is correct for all the special cases :-).
# Considers both official holidays and holidays that are handled as if they were official holidays.
#
# Holiday names are in German in case they are celebrated in the German speaking area and in French / Italian otherwise.
#
# Known Issues:
# * ch_ur: 26th of December is not celebrated in case the 25th is a Monday or a Friday.
# * ch_fr: Fronleichnam, Maria Himmelfahrt, Allerheiligen, Maria Empfaengnis is celebrated in all villages except
# some villages of the district of See.
# * ch_so: - There are a lot of village holidays not included here.
# - 1st of May is holiday only starting at noon; not included here.
# - 19th of March is celebrated only in a couple of villages
# * ch_ar: 26th of December is not celebrated in case the 25th is a Monday or a Friday.
# * ch_ai: - 22nd of September is celebrated only in part of the state.
# - 26th of December is not celebrated in case the 25th is a Monday or a Friday.
# * ch_ne: 26th of December and 2nd of January are only celebrated in case 25th of December and 1st of January are Sundays
#
#
#
# all regions [ch_zh, ch_be, ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_bs, ch_bl,
# ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_ti, ch_vd, ch_vs, ch_ne, ch_ge, ch_ju]
#
---
months:
0:
- name: Karfreitag
regions: [ch_zh, ch_be, ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_bs, ch_bl, ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_ti, ch_vd, ch_ne, ch_ge, ch_ju]
function: easter(year)
function_modifier: -2
- name: Ostermontag
regions: [ch_zh, ch_be, ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_bs, ch_bl, ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_ti, ch_vd, ch_vs, ch_ge, ch_ju]
function: easter(year)
function_modifier: 1
# State holiday but observed in all the states
- name: Auffahrt
regions: [ch]
function: easter(year)
function_modifier: 39
- name: Pfingstmontag
regions: [ch_zh, ch_be, ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_bs, ch_bl, ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_ti, ch_vd, ch_vs, ch_ge, ch_ju]
function: easter(year)
function_modifier: 50
- name: Fronleichnam
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_zg, ch_fr, ch_so, ch_ai, ch_ag, ch_ti, ch_vs, ch_ne, ch_ju]
function: easter(year)
function_modifier: 60
- name: Lundi du Jeûne fédéral
regions: [ch_vd]
function: ch_vd_lundi_du_jeune_federal(year)
- name: Jeûne genevois
regions: [ch_ge]
function: ch_ge_jeune_genevois(year)
1:
- name: Neujahrstag
regions: [ch_zh, ch_be, ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_bs, ch_bl, ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_vd, ch_vs, ch_ne, ch_ge, ch_ju, ch_ti]
mday: 1
- name: Berchtoldstag
regions: [ch_zh, ch_be, ch_lu, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_sh, ch_sg, ch_ag, ch_tg, ch_vd, ch_vs, ch_ne, ch_ju]
mday: 2
- name: Dreikönigstag
regions: [ch_ur, ch_sz, ch_ti]
mday: 6
3:
- name: Instauration de la République
regions: [ch_ne]
mday: 1
- name: Josephstag
regions: [ch_ur, ch_sz, ch_nw, ch_ti, ch_vs]
mday: 19
4:
- name: Näfelser Fahrt
regions: [ch_gl]
function: ch_gl_naefelser_fahrt(year)
5:
- name: Tag der Arbeit
regions: [ch_zh, ch_bs, ch_bl, ch_sh, ch_ag, ch_tg, ch_ti, ch_ne, ch_ju]
mday: 1
6:
- name: Commémoration du plébiscite jurassien
regions: [ch_ju]
mday: 23
- name: San Pietro e Paolo
regions: [ch_ti]
mday: 29
8:
# Federal holiday
- name: Bundesfeiertag
regions: [ch]
mday: 1
- name: Mariä Himmelfahrt
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_zg, ch_fr, ch_so, ch_ai, ch_ag, ch_ti, ch_vs, ch_ju]
mday: 15
9:
- name: Mauritiustag
regions: [ch_ai]
mday: 22
- name: Bruderklausenfest
regions: [ch_ow]
mday: 25
11:
- name: Allerheiligen
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_ai, ch_sg, ch_ag, ch_ti, ch_vs, ch_ju]
mday: 1
12:
- name: Maria Empfängnis
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_zg, ch_fr, ch_ai, ch_ag, ch_ti, ch_vs]
mday: 8
# State holiday but observed in all the states
- name: Weihnachten
regions: [ch]
mday: 25
- name: Stefanstag
regions: [ch_zh, ch_be, ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_bs, ch_bl, ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_ti, ch_vs, ch_ne]
mday: 26
- name: Restauration de la République
regions: [ch_ge]
mday: 31
methods:
ch_vd_lundi_du_jeune_federal:
# Monday after the third Sunday of September
arguments: year
source: |
date = Date.civil(year,9,1)
# Find the first Sunday of September
until date.wday.eql? 0 do
date += 1
end
# There are 15 days between the first Sunday
# and the Monday after the third Sunday
date + 15
ch_ge_jeune_genevois:
# Thursday after the first Sunday of September
arguments: year
source: |
date = Date.civil(year,9,1)
# Find the first Sunday of September
until date.wday.eql? 0 do
date += 1
end
# Thursday is four days after Sunday
date + 4
ch_gl_naefelser_fahrt:
# First Thursday of April. If the first Thursday of April is in the week before easter, then a week later.
arguments: year
source: |
date = Date.civil(year,4,1)
# Find the first Thursday of April
until date.wday.eql? 4 do
date += 1
end
if date.eql?(Holidays::Factory::DateCalculator::Easter::Gregorian.easter_calculator.calculate_easter_for(year)-3)
date += 7
end
date
tests:
- given:
date: '2012-08-01'
regions: ["ch"]
expect:
name: "Bundesfeiertag"
- given:
date: '2012-12-25'
regions: ["ch"]
expect:
name: "Weihnachten"
- given:
date: '2012-05-17'
regions: ["ch"]
expect:
name: "Auffahrt"
- given:
date: '2012-08-01'
regions: ["ch_zh"]
expect:
name: "Bundesfeiertag"
- given:
date: '2012-12-25'
regions: ["ch_zh"]
expect:
name: "Weihnachten"
- given:
date: '2012-05-17'
regions: ["ch_zh"]
expect:
name: "Auffahrt"
- given:
date: '2012-05-01'
regions: ["ch_zh"]
expect:
name: "Tag der Arbeit"
- given:
date: '2012-12-26'
regions: ["ch_zh"]
expect:
name: "Stefanstag"
- given:
date: '2012-09-17'
regions: ["ch_vd"]
expect:
name: "Lundi du Jeûne fédéral"
- given:
date: '2013-09-16'
regions: ["ch_vd"]
expect:
name: "Lundi du Jeûne fédéral"
- given:
date: '2014-09-22'
regions: ["ch_vd"]
expect:
name: "Lundi du Jeûne fédéral"
- given:
date: '2012-09-06'
regions: ["ch_ge"]
expect:
name: "Jeûne genevois"
- given:
date: '2013-09-05'
regions: ["ch_ge"]
expect:
name: "Jeûne genevois"
- given:
date: '2014-09-11'
regions: ["ch_ge"]
expect:
name: "Jeûne genevois"
- given:
date: '2012-04-12'
regions: ["ch_gl"]
expect:
name: "Näfelser Fahrt"
- given:
date: '2013-04-04'
regions: ["ch_gl"]
expect:
name: "Näfelser Fahrt"
- given:
date: '2014-04-03'
regions: ["ch_gl"]
expect:
name: "Näfelser Fahrt"