-
Notifications
You must be signed in to change notification settings - Fork 137
/
au.yaml
404 lines (373 loc) · 16.8 KB
/
au.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# Australian holiday definitions for the Ruby Holiday gem.
# Updated: 2008-11-29.
# Sources:
# - http://en.wikipedia.org/wiki/Australian_public_holidays
# - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
# - http://www.wst.tas.gov.au/employment_info/public_holidays
# - https://www.fairwork.gov.au/leave/public-holidays/list-of-public-holidays
---
months:
0:
- name: Good Friday
regions: [au]
function: easter(year)
function_modifier: -2
- name: Easter Saturday
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa]
function: easter(year)
function_modifier: -1
- name: Easter Sunday
regions: [au_nsw, au_vic]
function: easter(year)
- name: Easter Sunday
regions: [au_qld]
function: easter(year)
year_ranges:
- after: 2017
- name: Easter Monday
regions: [au]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [au_nsw, au_vic, au_act, au_sa, au_wa, au_nt, au_qld]
mday: 1
observed: to_monday_if_weekend(date)
- name: New Year's Day
regions: [au_tas]
mday: 1
function: to_monday_if_weekend(date)
- name: Australia Day
regions: [au]
mday: 26
observed: to_monday_if_weekend(date)
2:
- name: Royal Hobart Regatta
regions: [au_tas_south]
week: 2
wday: 1
3:
- name: Labour Day
regions: [au_wa]
week: 1
wday: 1
- name: Eight Hours Day
regions: [au_tas]
week: 2
wday: 1
- name: Labour Day
regions: [au_vic]
week: 2
wday: 1
- name: March Public Holiday
regions: [au_sa]
function: march_pub_hol_sa(year)
- name: Canberra Day
regions: [au_act]
week: 2
wday: 1
4:
- name: ANZAC Day
regions: [au]
mday: 25
- name: ANZAC Day
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa, au_tas]
mday: 25
observed: to_monday_if_sunday(date)
- name: ANZAC Day
regions: [au_wa]
mday: 25
observed: to_monday_if_weekend(date)
5:
- name: Labour Day
regions: [au_qld]
function: qld_labour_day_may(year)
- name: May Day
regions: [au_nt]
week: 1
wday: 1
- name: May Public Holiday
regions: [au_sa]
function: may_pub_hol_sa(year)
6:
- name: Foundation Day
regions: [au_wa]
week: 1
wday: 1
- name: Queen's Birthday
regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_vic]
week: 2
wday: 1
- name: Queen's Birthday
regions: [au_qld]
function: qld_queens_birthday_june(year)
- name: Queensland Day
regions: [au_qld]
mday: 6
type: informal
7:
- name: Cairns Show
regions: [au_qld_cairns]
week: 3
wday: 5
8:
- name: Ekka
regions: [au_qld_brisbane]
week: -3
wday: 3
9:
- name: Queen's Birthday
regions: [au_wa]
week: -1
wday: 1
- name: "Family & Community Day"
regions: [au_act]
week: -1
wday: 1
10:
- name: Friday before the AFL Grand Final
regions: [au_vic]
function: afl_grand_final(year)
- name: Labour Day
regions: [au_act, au_nsw, au_sa]
week: 1
wday: 1
- name: Labour Day
regions: [au_qld]
function: qld_labour_day_october(year)
observed: to_monday_if_weekend(date)
- name: Queen's Birthday
regions: [au_qld]
function: qld_queens_bday_october(year)
observed: to_monday_if_weekend(date)
- name: Royal Hobart Show
regions: [au_tas_south]
function: hobart_show_day(year)
11:
- name: G20 Day
regions: [au_qld_brisbane]
function: g20_day_2014_only(year)
- name: Recreation Day # http://www.timeanddate.com/holidays/australia/recreation-day
regions: [au_tas_north]
wday: 1
week: 1
- name: Melbourne Cup Day
regions: [au_vic_melbourne]
week: 1
wday: 2
12:
- name: Christmas Day # CHRISTMAS DAY - All states except SA observe on 27th (and 25th) if 25th is a Sunday
regions: [au_qld, au_nsw, au_act, au_tas, au_wa, au_vic, au_nt]
mday: 25
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
- name: Boxing Day
regions: [au_nsw, au_vic, au_qld, au_act, au_wa]
mday: 26
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
- name: Boxing Day
regions: [au_tas, au_nt]
function: to_weekday_if_boxing_weekend_from_year(year)
- name: Boxing Day
regions: [au_sa]
function: to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)
- name: Christmas Day # CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
regions: [au_sa]
mday: 25
observed: to_monday_if_weekend(date)
methods:
afl_grand_final:
arguments: year
source: |
case year
when 2015
Date.civil(2015, 10, 2)
when 2016
Date.civil(2016, 9, 30)
when 2017
Date.civil(2017, 9, 29)
end
qld_queens_bday_october:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# celebrated twice in 2012
# in october again from 2016
arguments: year
source: |
if year >= 2016
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
elsif year == 2012
1
else
nil
end
qld_queens_birthday_june:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# in june until 2015
arguments: year
source: |
if year <= 2015
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 6, 2, 1)
end
qld_labour_day_may:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# for 2013 to 2016 it was in October, otherwise it's in May
arguments: year
source: |
if year < 2013 || year >= 2016
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, 1, 1)
end
qld_labour_day_october:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# for 2013 to 2016 it was in October, otherwise it's in May
arguments: year
source: |
if year >= 2013 && year < 2016
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
end
g20_day_2014_only:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# G20 day in brisbane, in 2014, on november 14
arguments: year
source: |
year == 2014 ? 14 : nil
hobart_show_day:
# http://worksafe.tas.gov.au/__data/assets/pdf_file/0008/287036/Public_Holidays_2014.pdf
# The Thursday before the fourth Saturday in October.
arguments: year
source: |
fourth_sat_in_oct = Date.civil(year, 10, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 4, :saturday))
fourth_sat_in_oct - 2 # the thursday before
march_pub_hol_sa:
# http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
# The Holidays Act 1910 provides for the third Monday in May to be a public holiday. Since 2006 this public holiday has been observed on the second Monday in March through the issuing of a special Proclamation by the Governor.
arguments: year
source: |
if year < 2006
nil
else
Date.civil(year, 3, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 3, :second, :monday))
end
may_pub_hol_sa:
# http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
# The Holidays Act 1910 provides for the third Monday in May to be a public holiday. Since 2006 this public holiday has been observed on the second Monday in March through the issuing of a special Proclamation by the Governor.
arguments: year
source: |
if year >= 2006
nil
else
Date.civil(year, 5, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, :third, :monday))
end
tests: |
{Date.civil(2007,1,1) => 'New Year\'s Day',
Date.civil(2007,1,26) => 'Australia Day',
Date.civil(2007,4,6) => 'Good Friday',
Date.civil(2007,4,9) => 'Easter Monday',
Date.civil(2007,4,25) => 'ANZAC Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :au, :informal)[0] || {})[:name]
end
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,10,1), r)[0][:name]
end
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
assert_equal 'Queen\'s Birthday', Holidays.on(Date.civil(2007,6,11), r)[0][:name]
end
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,3,5), :au_wa)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,3,12), :au_vic)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,5,7), :au_qld)[0][:name]
assert_equal 'Easter Sunday', Holidays.on(Date.civil(2007,4,8), :au_nsw)[0][:name]
assert_equal 'May Day', Holidays.on(Date.civil(2007,5,7), :au_nt)[0][:name]
assert_equal 'Eight Hours Day', Holidays.on(Date.civil(2007,3,12), :au_tas)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2013,10,7), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2012,5,7), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2015,10,5), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2016,5,2), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,6,11), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,10,1), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2013,6,10), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015,6,8), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016,10,3), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2014, 9, 29), :au_wa)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015, 9, 28), :au_wa)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016, 9, 26), :au_wa)[0][:name]
assert_equal "Family & Community Day", Holidays.on(Date.civil(2014, 9, 29), :au_act)[0][:name]
assert_equal "Family & Community Day", Holidays.on(Date.civil(2015, 9, 28), :au_act)[0][:name]
assert_equal "Family & Community Day", Holidays.on(Date.civil(2016, 9, 26), :au_act)[0][:name]
assert_equal 'Australia Day', Holidays.on(Date.civil(2014,1,26), :au_qld)[0][:name]
assert_equal 'Australia Day', Holidays.on(Date.civil(2014,1,27), :au_qld, :observed)[0][:name]
assert_equal 'Cairns Show', Holidays.on(Date.civil(2014,7,18), :au_qld_cairns)[0][:name]
assert_equal 'Cairns Show', Holidays.on(Date.civil(2013,7,19), :au_qld_cairns)[0][:name]
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2013, 10, 24), :au_tas_south)[0][:name]
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2014, 10, 23), :au_tas_south)[0][:name]
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2015, 10, 22), :au_tas_south)[0][:name]
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2016, 10, 20), :au_tas_south)[0][:name]
assert_equal 'Recreation Day', Holidays.on(Date.civil(2013, 11, 4), :au_tas_north)[0][:name]
assert_equal 'Recreation Day', Holidays.on(Date.civil(2014, 11, 3), :au_tas_north)[0][:name]
assert_equal 'Recreation Day', Holidays.on(Date.civil(2015, 11, 2), :au_tas_north)[0][:name]
assert_equal 'Recreation Day', Holidays.on(Date.civil(2016, 11, 7), :au_tas_north)[0][:name]
assert_nil Date.civil(2014,11,4).holidays(:au_vic)[0]
assert_nil Date.civil(2015,11,3).holidays(:au_vic)[0]
assert_equal 'Melbourne Cup Day', Holidays.on(Date.civil(2014,11,4), :au_vic_melbourne)[0][:name]
assert_equal 'Melbourne Cup Day', Holidays.on(Date.civil(2015,11,3), :au_vic_melbourne)[0][:name]
assert_equal 'Friday before the AFL Grand Final', Date.civil(2015,10,2).holidays(:au_vic)[0][:name]
assert_equal 'Friday before the AFL Grand Final', Date.civil(2016,9,30).holidays(:au_vic)[0][:name]
assert_equal 'Friday before the AFL Grand Final', Date.civil(2017,9,29).holidays(:au_vic)[0][:name]
assert_equal "May Public Holiday", Date.civil(2005, 5, 16).holidays(:au_sa)[0][:name]
assert_equal [], Date.civil(2014, 5, 19).holidays(:au_sa)
assert_equal [], Date.civil(2005, 3, 14).holidays(:au_sa)
assert_equal "March Public Holiday", Date.civil(2014, 3, 10).holidays(:au_sa)[0][:name]
assert_equal "March Public Holiday", Date.civil(2015, 3, 9).holidays(:au_sa)[0][:name]
assert_equal "March Public Holiday", Date.civil(2016, 3, 14).holidays(:au_sa)[0][:name]
assert_equal "March Public Holiday", Date.civil(2017, 3, 13).holidays(:au_sa)[0][:name]
assert_equal "ANZAC Day", Date.civil(2015, 4, 25).holidays(:au_qld)[0][:name]
assert_equal "ANZAC Day", Date.civil(2015, 4, 25).holidays(:au_wa)[0][:name]
assert_equal [], Date.civil(2015, 4, 27).holidays(:au_qld, :observed)
assert_equal "ANZAC Day", Date.civil(2015, 4, 27).holidays(:au_wa, :observed)[0][:name]
# BOXING DAY - QLD observes weekend and monday
assert_equal "Boxing Day", Date.civil(2015, 12, 26).holidays(:au_qld)[0][:name]
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_qld, :observed)[0][:name]
# BOXING DAY - SA gets monday only. same for TAS and NT.
assert_nil Date.civil(2015, 12, 26).holidays(:au_sa)[0]
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_sa)[0][:name]
assert_nil Date.civil(2015, 12, 26).holidays(:au_tas)[0]
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_tas)[0][:name]
assert_nil Date.civil(2015, 12, 26).holidays(:au_nt)[0]
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_nt)[0][:name]
assert_equal 'G20 Day', Holidays.on(Date.civil(2014,11,14), :au_qld_brisbane)[0][:name]
assert_equal [], Holidays.on(Date.civil(2014,11,14), :au_qld)
assert_equal [], Holidays.on(Date.civil(2015,11,14), :au_qld_brisbane)
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2012, 2, 13), :au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2014, 2, 10), :au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2015, 2, 9), :au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2016, 2, 8), :au_tas_south)[0][:name]
# CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_qld)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_qld, :observed)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_nsw)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nsw, :observed)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_act)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_act, :observed)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_tas)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_tas, :observed)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_wa)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_wa, :observed)[0][:name]
# CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_sa)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 26).holidays(:au_sa, :observed)[0][:name]
assert_equal "Boxing Day", Date.civil(2016, 12, 27).holidays(:au_sa)[0][:name]
# CHRISTMAS DAY - Victoria and NT now observe both 25th and 27th if weekend
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_vic)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_nt)[0][:name]
assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_vic)[0][:name]
assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_nt)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_vic, :observed)[0][:name]
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nt, :observed)[0][:name]
# NEW YEAR'S DAY - observed on both 1st and 2nd of Jan for 2017
regions = [:au_qld, :au_nsw, :au_act, :au_vic, :au_sa, :au_wa, :au_nt]
regions.each do |r|
assert_equal "New Year's Day", Date.civil(2017, 1, 1).holidays(r)[0][:name]
assert_equal "New Year's Day", Date.civil(2017, 1, 2).holidays(r, :observed)[0][:name]
end
# Tasmania is different
assert_equal [], Date.civil(2017,1,1).holidays(:au_tas)
assert_equal "New Year's Day", Date.civil(2017, 1, 2).holidays(:au_tas)[0][:name]
#QLD now celebrates Easter Sunday
assert_equal "Easter Sunday", Date.civil(2017, 4, 16).holidays(:au_qld)[0][:name]