holidays 4.7.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +21 -11
- data/Makefile +9 -6
- data/holidays.gemspec +1 -1
- data/lib/generated_definitions/MANIFEST +1 -0
- data/lib/generated_definitions/REGIONS.rb +1 -1
- data/lib/generated_definitions/hk.rb +112 -0
- data/lib/generated_definitions/kr.rb +4 -4
- data/lib/holidays/errors.rb +1 -0
- data/lib/holidays/finder/context/parse_options.rb +8 -3
- data/lib/holidays/load_all_definitions.rb +0 -11
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_hk.rb +38 -0
- data/test/defs/test_defs_jp.rb +1 -0
- data/test/defs/test_defs_kr.rb +1 -1
- data/test/holidays/definition/validator/test_region.rb +4 -0
- data/test/holidays/finder/context/test_parse_options.rb +9 -1
- data/test/integration/test_all_regions.rb +4 -4
- data/test/integration/test_custom_holidays.rb +4 -4
- data/test/integration/test_holidays.rb +6 -6
- metadata +6 -60
- data/definitions/README.md +0 -353
- data/definitions/ar.yaml +0 -93
- data/definitions/at.yaml +0 -72
- data/definitions/au.yaml +0 -378
- data/definitions/be_fr.yaml +0 -69
- data/definitions/be_nl.yaml +0 -69
- data/definitions/bg.yaml +0 -127
- data/definitions/br.yaml +0 -77
- data/definitions/ca.yaml +0 -317
- data/definitions/ch.yaml +0 -193
- data/definitions/cl.yaml +0 -94
- data/definitions/cr.yaml +0 -65
- data/definitions/cz.yaml +0 -73
- data/definitions/de.yaml +0 -209
- data/definitions/dk.yaml +0 -130
- data/definitions/ecb_target.yaml +0 -44
- data/definitions/el.yaml +0 -84
- data/definitions/es.yaml +0 -203
- data/definitions/federal_reserve.yaml +0 -114
- data/definitions/fedex.yaml +0 -62
- data/definitions/fi.yaml +0 -115
- data/definitions/fr.yaml +0 -79
- data/definitions/gb.yaml +0 -151
- data/definitions/hr.yaml +0 -79
- data/definitions/hu.yaml +0 -63
- data/definitions/ie.yaml +0 -89
- data/definitions/index.yaml +0 -61
- data/definitions/is.yaml +0 -146
- data/definitions/it.yaml +0 -67
- data/definitions/jp.yaml +0 -321
- data/definitions/kr.yaml +0 -282
- data/definitions/li.yaml +0 -107
- data/definitions/lt.yaml +0 -89
- data/definitions/lu.yaml +0 -56
- data/definitions/ma.yaml +0 -52
- data/definitions/mx.yaml +0 -106
- data/definitions/my.yaml +0 -51
- data/definitions/nerc.yaml +0 -51
- data/definitions/nl.yaml +0 -73
- data/definitions/no.yaml +0 -90
- data/definitions/north_america_informal.yaml +0 -61
- data/definitions/nyse.yaml +0 -64
- data/definitions/nz.yaml +0 -163
- data/definitions/pe.yaml +0 -119
- data/definitions/ph.yaml +0 -94
- data/definitions/pl.yaml +0 -320
- data/definitions/pt.yaml +0 -89
- data/definitions/ro.yaml +0 -78
- data/definitions/se.yaml +0 -120
- data/definitions/sg.yaml +0 -56
- data/definitions/si.yaml +0 -86
- data/definitions/sk.yaml +0 -80
- data/definitions/united_nations.yaml +0 -189
- data/definitions/ups.yaml +0 -62
- data/definitions/us.yaml +0 -103
- data/definitions/ve.yaml +0 -74
- data/definitions/vi.yaml +0 -29
- data/definitions/za.yaml +0 -80
data/definitions/ar.yaml
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
# Argentinian holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Updated: 2016-02-26.
|
4
|
-
#
|
5
|
-
# Sources:
|
6
|
-
# - http://en.wikipedia.org/wiki/Public_holidays_in_Argentina
|
7
|
-
# - http://servicios.lanacion.com.ar/feriados/2016
|
8
|
-
---
|
9
|
-
months:
|
10
|
-
0:
|
11
|
-
- name: Viernes Santo
|
12
|
-
regions: [ar]
|
13
|
-
function: easter(year)
|
14
|
-
function_modifier: -2
|
15
|
-
1:
|
16
|
-
- name: Año Nuevo
|
17
|
-
regions: [ar]
|
18
|
-
mday: 1
|
19
|
-
2:
|
20
|
-
- name: Carnaval
|
21
|
-
regions: [ar]
|
22
|
-
mday: 8
|
23
|
-
- name: Carnaval
|
24
|
-
regions: [ar]
|
25
|
-
mday: 9
|
26
|
-
3:
|
27
|
-
- name: Día Nacional de la Memoria por la Verdad y la Justicia
|
28
|
-
regions: [ar]
|
29
|
-
mday: 24
|
30
|
-
4:
|
31
|
-
- name: Día del Veterano y de los Caídos en la Guerra de Malvinas
|
32
|
-
regions: [ar]
|
33
|
-
mday: 2
|
34
|
-
5:
|
35
|
-
- name: Día del Trabajador
|
36
|
-
regions: [ar]
|
37
|
-
mday: 1
|
38
|
-
- name: Día de la Revolución de Mayo
|
39
|
-
regions: [ar]
|
40
|
-
mday: 25
|
41
|
-
6:
|
42
|
-
- name: Día de la Bandera
|
43
|
-
regions: [ar]
|
44
|
-
mday: 20
|
45
|
-
7:
|
46
|
-
- name: Feriado puente turístico
|
47
|
-
regions: [ar]
|
48
|
-
mday: 8
|
49
|
-
- name: Día de la Independencia
|
50
|
-
regions: [ar]
|
51
|
-
mday: 9
|
52
|
-
8:
|
53
|
-
- name: Paso a la Inmortalidad del General José de San Martín
|
54
|
-
regions: [ar]
|
55
|
-
mday: 15
|
56
|
-
10:
|
57
|
-
- name: Día del Respeto a la Diversidad Cultural
|
58
|
-
regions: [ar]
|
59
|
-
mday: 12
|
60
|
-
11:
|
61
|
-
- name: Día de la Soberanía Nacional
|
62
|
-
regions: [ar]
|
63
|
-
mday: 20
|
64
|
-
12:
|
65
|
-
- name: Inmaculada Concepción de María
|
66
|
-
regions: [ar]
|
67
|
-
mday: 8
|
68
|
-
- name: Feriado puente turístico
|
69
|
-
regions: [ar]
|
70
|
-
mday: 9
|
71
|
-
- name: Navidad
|
72
|
-
regions: [ar]
|
73
|
-
mday: 25
|
74
|
-
tests: |
|
75
|
-
{Date.civil(2016,1,1) => 'Año Nuevo',
|
76
|
-
Date.civil(2016,2,8) => 'Carnaval',
|
77
|
-
Date.civil(2016,2,9) => 'Carnaval',
|
78
|
-
Date.civil(2016,3,24) => 'Día Nacional de la Memoria por la Verdad y la Justicia',
|
79
|
-
Date.civil(2016,3,25) => 'Viernes Santo',
|
80
|
-
Date.civil(2016,4,2) => 'Día del Veterano y de los Caídos en la Guerra de Malvinas',
|
81
|
-
Date.civil(2016,5,1) => 'Día del Trabajador',
|
82
|
-
Date.civil(2016,5,25) => 'Día de la Revolución de Mayo',
|
83
|
-
Date.civil(2016,6,20) => 'Día de la Bandera',
|
84
|
-
Date.civil(2016,7,8) => 'Feriado puente turístico',
|
85
|
-
Date.civil(2016,7,9) => 'Día de la Independencia',
|
86
|
-
Date.civil(2016,8,15) => 'Paso a la Inmortalidad del General José de San Martín',
|
87
|
-
Date.civil(2016,10,12) => 'Día del Respeto a la Diversidad Cultural',
|
88
|
-
Date.civil(2016,11,20) => 'Día de la Soberanía Nacional',
|
89
|
-
Date.civil(2016,12,8) => 'Inmaculada Concepción de María',
|
90
|
-
Date.civil(2016,12,9) => 'Feriado puente turístico',
|
91
|
-
Date.civil(2016,12,25) => 'Navidad'}.each do |date, name|
|
92
|
-
assert_equal name, (Holidays.on(date, :ar, :informal)[0] || {})[:name]
|
93
|
-
end
|
data/definitions/at.yaml
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
# Austrian holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Updated: 2011-08-31 by VGSG
|
4
|
-
# Sources:
|
5
|
-
# - http://de.wikipedia.org/wiki/Feiertage_in_%C3%96sterreich
|
6
|
-
# - http://www.timeanddate.com/calendar/index.html?country=8
|
7
|
-
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
|
8
|
-
---
|
9
|
-
months:
|
10
|
-
0:
|
11
|
-
- name: Ostermontag
|
12
|
-
regions: [at]
|
13
|
-
function: easter(year)
|
14
|
-
function_modifier: 1
|
15
|
-
- name: Christi Himmelfahrt
|
16
|
-
regions: [at]
|
17
|
-
function: easter(year)
|
18
|
-
function_modifier: 39
|
19
|
-
- name: Pfingstmontag
|
20
|
-
regions: [at]
|
21
|
-
function: easter(year)
|
22
|
-
function_modifier: 50
|
23
|
-
- name: Fronleichnam
|
24
|
-
regions: [at]
|
25
|
-
function: easter(year)
|
26
|
-
function_modifier: 60
|
27
|
-
1:
|
28
|
-
- name: Neujahrstag
|
29
|
-
regions: [at]
|
30
|
-
mday: 1
|
31
|
-
- name: Heilige Drei Könige
|
32
|
-
regions: [at]
|
33
|
-
mday: 6
|
34
|
-
5:
|
35
|
-
- name: Staatsfeiertag
|
36
|
-
regions: [at]
|
37
|
-
mday: 1
|
38
|
-
8:
|
39
|
-
- name: Mariä Himmelfahrt
|
40
|
-
regions: [at]
|
41
|
-
mday: 15
|
42
|
-
10:
|
43
|
-
- name: Nationalfeiertag
|
44
|
-
regions: [at]
|
45
|
-
mday: 26
|
46
|
-
11:
|
47
|
-
- name: Allerheiligen
|
48
|
-
regions: [at]
|
49
|
-
mday: 1
|
50
|
-
12:
|
51
|
-
- name: Mariä Empfägnis
|
52
|
-
regions: [at]
|
53
|
-
mday: 8
|
54
|
-
- name: 1. Weihnachtstag
|
55
|
-
regions: [at]
|
56
|
-
mday: 25
|
57
|
-
- name: 2. Weihnachtstag
|
58
|
-
regions: [at]
|
59
|
-
mday: 26
|
60
|
-
tests: |
|
61
|
-
{Date.civil(2009,1,1) => 'Neujahrstag',
|
62
|
-
Date.civil(2009,4,13) => 'Ostermontag',
|
63
|
-
Date.civil(2009,5,1) => 'Staatsfeiertag',
|
64
|
-
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
|
65
|
-
Date.civil(2009,6,1) => 'Pfingstmontag',
|
66
|
-
Date.civil(2009,10,26) => 'Nationalfeiertag',
|
67
|
-
Date.civil(2009,12,25) => '1. Weihnachtstag',
|
68
|
-
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
|
69
|
-
assert_equal name, (Holidays.on(date, :at, :informal)[0] || {})[:name]
|
70
|
-
end
|
71
|
-
|
72
|
-
assert_equal [], Holidays.on(Date.civil(2010,5,8), :at), '2010-05-08 is not a holiday in Austria'
|
data/definitions/au.yaml
DELETED
@@ -1,378 +0,0 @@
|
|
1
|
-
# Australian holiday definitions for the Ruby Holiday gem.
|
2
|
-
# Updated: 2008-11-29.
|
3
|
-
# Sources:
|
4
|
-
# - http://en.wikipedia.org/wiki/Australian_public_holidays
|
5
|
-
# - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
|
6
|
-
# - http://www.wst.tas.gov.au/employment_info/public_holidays
|
7
|
-
# - https://www.fairwork.gov.au/leave/public-holidays/list-of-public-holidays
|
8
|
-
---
|
9
|
-
months:
|
10
|
-
0:
|
11
|
-
- name: Good Friday
|
12
|
-
regions: [au]
|
13
|
-
function: easter(year)
|
14
|
-
function_modifier: -2
|
15
|
-
- name: Easter Saturday
|
16
|
-
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa]
|
17
|
-
function: easter(year)
|
18
|
-
function_modifier: -1
|
19
|
-
- name: Easter Sunday
|
20
|
-
regions: [au_nsw, au_vic]
|
21
|
-
function: easter(year)
|
22
|
-
- name: Easter Monday
|
23
|
-
regions: [au]
|
24
|
-
function: easter(year)
|
25
|
-
function_modifier: 1
|
26
|
-
1:
|
27
|
-
- name: New Year's Day
|
28
|
-
regions: [au]
|
29
|
-
mday: 1
|
30
|
-
observed: to_monday_if_weekend(date)
|
31
|
-
- name: Australia Day
|
32
|
-
regions: [au]
|
33
|
-
mday: 26
|
34
|
-
observed: to_monday_if_weekend(date)
|
35
|
-
2:
|
36
|
-
- name: Royal Hobart Regatta
|
37
|
-
regions: [au_tas_south]
|
38
|
-
week: 2
|
39
|
-
wday: 1
|
40
|
-
3:
|
41
|
-
- name: Labour Day
|
42
|
-
regions: [au_wa]
|
43
|
-
week: 1
|
44
|
-
wday: 1
|
45
|
-
- name: Eight Hours Day
|
46
|
-
regions: [au_tas]
|
47
|
-
week: 2
|
48
|
-
wday: 1
|
49
|
-
- name: Labour Day
|
50
|
-
regions: [au_vic]
|
51
|
-
week: 2
|
52
|
-
wday: 1
|
53
|
-
- name: March Public Holiday
|
54
|
-
regions: [au_sa]
|
55
|
-
function: march_pub_hol_sa(year)
|
56
|
-
4:
|
57
|
-
- name: ANZAC Day
|
58
|
-
regions: [au]
|
59
|
-
mday: 25
|
60
|
-
- name: ANZAC Day
|
61
|
-
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa, au_tas]
|
62
|
-
mday: 25
|
63
|
-
observed: to_monday_if_sunday(date)
|
64
|
-
- name: ANZAC Day
|
65
|
-
regions: [au_wa]
|
66
|
-
mday: 25
|
67
|
-
observed: to_monday_if_weekend(date)
|
68
|
-
5:
|
69
|
-
- name: Labour Day
|
70
|
-
regions: [au_qld]
|
71
|
-
function: qld_labour_day_may(year)
|
72
|
-
- name: May Day
|
73
|
-
regions: [au_nt]
|
74
|
-
week: 1
|
75
|
-
wday: 1
|
76
|
-
- name: May Public Holiday
|
77
|
-
regions: [au_sa]
|
78
|
-
function: may_pub_hol_sa(year)
|
79
|
-
6:
|
80
|
-
- name: Foundation Day
|
81
|
-
regions: [au_wa]
|
82
|
-
week: 1
|
83
|
-
wday: 1
|
84
|
-
- name: Queen's Birthday
|
85
|
-
regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_vic]
|
86
|
-
week: 2
|
87
|
-
wday: 1
|
88
|
-
- name: Queen's Birthday
|
89
|
-
regions: [au_qld]
|
90
|
-
function: qld_queens_birthday_june(year)
|
91
|
-
- name: Queensland Day
|
92
|
-
regions: [au_qld]
|
93
|
-
mday: 6
|
94
|
-
type: informal
|
95
|
-
7:
|
96
|
-
- name: Cairns Show
|
97
|
-
regions: [au_qld_cairns]
|
98
|
-
week: 3
|
99
|
-
wday: 5
|
100
|
-
8:
|
101
|
-
- name: Ekka
|
102
|
-
regions: [au_qld_brisbane]
|
103
|
-
week: -3
|
104
|
-
wday: 3
|
105
|
-
9:
|
106
|
-
- name: Queen's Birthday
|
107
|
-
regions: [au_wa]
|
108
|
-
week: -1
|
109
|
-
wday: 1
|
110
|
-
- name: "Family & Community Day"
|
111
|
-
regions: [au_act]
|
112
|
-
week: -1
|
113
|
-
wday: 1
|
114
|
-
10:
|
115
|
-
- name: Friday before the AFL Grand Final
|
116
|
-
regions: [au_vic]
|
117
|
-
function: afl_grand_final(year)
|
118
|
-
- name: Labour Day
|
119
|
-
regions: [au_act, au_nsw, au_sa]
|
120
|
-
week: 1
|
121
|
-
wday: 1
|
122
|
-
- name: Labour Day
|
123
|
-
regions: [au_qld]
|
124
|
-
function: qld_labour_day_october(year)
|
125
|
-
observed: to_monday_if_weekend(date)
|
126
|
-
- name: Queen's Birthday
|
127
|
-
regions: [au_qld]
|
128
|
-
function: qld_queens_bday_october(year)
|
129
|
-
observed: to_monday_if_weekend(date)
|
130
|
-
- name: Royal Hobart Show
|
131
|
-
regions: [au_tas_south]
|
132
|
-
function: hobart_show_day(year)
|
133
|
-
11:
|
134
|
-
- name: G20 Day
|
135
|
-
regions: [au_qld_brisbane]
|
136
|
-
function: g20_day_2014_only(year)
|
137
|
-
- name: Recreation Day # http://www.timeanddate.com/holidays/australia/recreation-day
|
138
|
-
regions: [au_tas_north]
|
139
|
-
wday: 1
|
140
|
-
week: 1
|
141
|
-
- name: Melbourne Cup Day
|
142
|
-
regions: [au_vic_melbourne]
|
143
|
-
week: 1
|
144
|
-
wday: 2
|
145
|
-
12:
|
146
|
-
- name: Christmas Day # CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
|
147
|
-
regions: [au_qld, au_nsw, au_act, au_tas, au_wa]
|
148
|
-
mday: 25
|
149
|
-
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
|
150
|
-
- name: Christmas Day # CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
|
151
|
-
regions: [au_sa]
|
152
|
-
mday: 25
|
153
|
-
observed: to_monday_if_weekend(date)
|
154
|
-
- name: Christmas Day # CHRISTMAS DAY - Victoria and NT don't observe 25th if weekend - xmas is on the 27th
|
155
|
-
regions: [au_vic, au_nt]
|
156
|
-
function: xmas_to_weekday_if_weekend(year)
|
157
|
-
- name: Boxing Day
|
158
|
-
regions: [au_nsw, au_vic, au_qld, au_act, au_wa]
|
159
|
-
mday: 26
|
160
|
-
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
|
161
|
-
- name: Boxing Day
|
162
|
-
regions: [au_sa]
|
163
|
-
function: to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)
|
164
|
-
- name: Boxing Day
|
165
|
-
regions: [au_tas, au_nt]
|
166
|
-
function: to_weekday_if_boxing_weekend_from_year(year)
|
167
|
-
|
168
|
-
methods:
|
169
|
-
afl_grand_final:
|
170
|
-
arguments: year
|
171
|
-
source: |
|
172
|
-
case year
|
173
|
-
when 2015
|
174
|
-
Date.civil(2015, 10, 2)
|
175
|
-
when 2016
|
176
|
-
Date.civil(2017, 9, 30)
|
177
|
-
end
|
178
|
-
qld_queens_bday_october:
|
179
|
-
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
|
180
|
-
# celebrated twice in 2012
|
181
|
-
# in october again from 2016
|
182
|
-
arguments: year
|
183
|
-
source: |
|
184
|
-
if year >= 2016
|
185
|
-
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
|
186
|
-
elsif year == 2012
|
187
|
-
1
|
188
|
-
else
|
189
|
-
nil
|
190
|
-
end
|
191
|
-
qld_queens_birthday_june:
|
192
|
-
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
|
193
|
-
# in june until 2015
|
194
|
-
arguments: year
|
195
|
-
source: |
|
196
|
-
if year <= 2015
|
197
|
-
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 6, 2, 1)
|
198
|
-
end
|
199
|
-
qld_labour_day_may:
|
200
|
-
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
|
201
|
-
# for 2013 to 2016 it was in October, otherwise it's in May
|
202
|
-
arguments: year
|
203
|
-
source: |
|
204
|
-
if year < 2013 || year >= 2016
|
205
|
-
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, 1, 1)
|
206
|
-
end
|
207
|
-
qld_labour_day_october:
|
208
|
-
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
|
209
|
-
# for 2013 to 2016 it was in October, otherwise it's in May
|
210
|
-
arguments: year
|
211
|
-
source: |
|
212
|
-
if year >= 2013 && year < 2016
|
213
|
-
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
|
214
|
-
end
|
215
|
-
g20_day_2014_only:
|
216
|
-
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
|
217
|
-
# G20 day in brisbane, in 2014, on november 14
|
218
|
-
arguments: year
|
219
|
-
source: |
|
220
|
-
year == 2014 ? 14 : nil
|
221
|
-
hobart_show_day:
|
222
|
-
# http://worksafe.tas.gov.au/__data/assets/pdf_file/0008/287036/Public_Holidays_2014.pdf
|
223
|
-
# The Thursday before the fourth Saturday in October.
|
224
|
-
arguments: year
|
225
|
-
source: |
|
226
|
-
fourth_sat_in_oct = Date.civil(year, 10, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 4, :saturday))
|
227
|
-
fourth_sat_in_oct - 2 # the thursday before
|
228
|
-
march_pub_hol_sa:
|
229
|
-
# http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
|
230
|
-
# 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.
|
231
|
-
arguments: year
|
232
|
-
source: |
|
233
|
-
if year < 2006
|
234
|
-
nil
|
235
|
-
else
|
236
|
-
Date.civil(year, 3, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 3, :second, :monday))
|
237
|
-
end
|
238
|
-
may_pub_hol_sa:
|
239
|
-
# http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
|
240
|
-
# 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.
|
241
|
-
arguments: year
|
242
|
-
source: |
|
243
|
-
if year >= 2006
|
244
|
-
nil
|
245
|
-
else
|
246
|
-
Date.civil(year, 5, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, :third, :monday))
|
247
|
-
end
|
248
|
-
|
249
|
-
tests: |
|
250
|
-
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
251
|
-
Date.civil(2007,1,26) => 'Australia Day',
|
252
|
-
Date.civil(2007,4,6) => 'Good Friday',
|
253
|
-
Date.civil(2007,4,9) => 'Easter Monday',
|
254
|
-
Date.civil(2007,4,25) => 'ANZAC Day'}.each do |date, name|
|
255
|
-
assert_equal name, (Holidays.on(date, :au, :informal)[0] || {})[:name]
|
256
|
-
end
|
257
|
-
|
258
|
-
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
259
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,10,1), r)[0][:name]
|
260
|
-
end
|
261
|
-
|
262
|
-
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
263
|
-
assert_equal 'Queen\'s Birthday', Holidays.on(Date.civil(2007,6,11), r)[0][:name]
|
264
|
-
end
|
265
|
-
|
266
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,3,5), :au_wa)[0][:name]
|
267
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,3,12), :au_vic)[0][:name]
|
268
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2007,5,7), :au_qld)[0][:name]
|
269
|
-
|
270
|
-
assert_equal 'Easter Sunday', Holidays.on(Date.civil(2007,4,8), :au_nsw)[0][:name]
|
271
|
-
|
272
|
-
assert_equal 'May Day', Holidays.on(Date.civil(2007,5,7), :au_nt)[0][:name]
|
273
|
-
|
274
|
-
assert_equal 'Eight Hours Day', Holidays.on(Date.civil(2007,3,12), :au_tas)[0][:name]
|
275
|
-
|
276
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2013,10,7), :au_qld)[0][:name]
|
277
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2012,5,7), :au_qld)[0][:name]
|
278
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2015,10,5), :au_qld)[0][:name]
|
279
|
-
assert_equal 'Labour Day', Holidays.on(Date.civil(2016,5,2), :au_qld)[0][:name]
|
280
|
-
|
281
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,6,11), :au_qld)[0][:name]
|
282
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,10,1), :au_qld)[0][:name]
|
283
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2013,6,10), :au_qld)[0][:name]
|
284
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015,6,8), :au_qld)[0][:name]
|
285
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016,10,3), :au_qld)[0][:name]
|
286
|
-
|
287
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2014, 9, 29), :au_wa)[0][:name]
|
288
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015, 9, 28), :au_wa)[0][:name]
|
289
|
-
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016, 9, 26), :au_wa)[0][:name]
|
290
|
-
|
291
|
-
assert_equal "Family & Community Day", Holidays.on(Date.civil(2014, 9, 29), :au_act)[0][:name]
|
292
|
-
assert_equal "Family & Community Day", Holidays.on(Date.civil(2015, 9, 28), :au_act)[0][:name]
|
293
|
-
assert_equal "Family & Community Day", Holidays.on(Date.civil(2016, 9, 26), :au_act)[0][:name]
|
294
|
-
|
295
|
-
assert_equal 'Australia Day', Holidays.on(Date.civil(2014,1,26), :au_qld)[0][:name]
|
296
|
-
assert_equal 'Australia Day', Holidays.on(Date.civil(2014,1,27), :au_qld, :observed)[0][:name]
|
297
|
-
|
298
|
-
assert_equal 'Cairns Show', Holidays.on(Date.civil(2014,7,18), :au_qld_cairns)[0][:name]
|
299
|
-
assert_equal 'Cairns Show', Holidays.on(Date.civil(2013,7,19), :au_qld_cairns)[0][:name]
|
300
|
-
|
301
|
-
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2013, 10, 24), :au_tas_south)[0][:name]
|
302
|
-
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2014, 10, 23), :au_tas_south)[0][:name]
|
303
|
-
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2015, 10, 22), :au_tas_south)[0][:name]
|
304
|
-
assert_equal 'Royal Hobart Show', Holidays.on(Date.civil(2016, 10, 20), :au_tas_south)[0][:name]
|
305
|
-
|
306
|
-
assert_equal 'Recreation Day', Holidays.on(Date.civil(2013, 11, 4), :au_tas_north)[0][:name]
|
307
|
-
assert_equal 'Recreation Day', Holidays.on(Date.civil(2014, 11, 3), :au_tas_north)[0][:name]
|
308
|
-
assert_equal 'Recreation Day', Holidays.on(Date.civil(2015, 11, 2), :au_tas_north)[0][:name]
|
309
|
-
assert_equal 'Recreation Day', Holidays.on(Date.civil(2016, 11, 7), :au_tas_north)[0][:name]
|
310
|
-
|
311
|
-
assert_nil Date.civil(2014,11,4).holidays(:au_vic)[0]
|
312
|
-
assert_nil Date.civil(2015,11,3).holidays(:au_vic)[0]
|
313
|
-
|
314
|
-
assert_equal 'Melbourne Cup Day', Holidays.on(Date.civil(2014,11,4), :au_vic_melbourne)[0][:name]
|
315
|
-
assert_equal 'Melbourne Cup Day', Holidays.on(Date.civil(2015,11,3), :au_vic_melbourne)[0][:name]
|
316
|
-
|
317
|
-
assert_equal 'Friday before the AFL Grand Final', Date.civil(2015,10,2).holidays(:au_vic)[0][:name]
|
318
|
-
assert_equal 'Friday before the AFL Grand Final', Date.civil(2016,9, 30).holidays(:au_vic)[0][:name]
|
319
|
-
|
320
|
-
assert_equal "May Public Holiday", Date.civil(2005, 5, 16).holidays(:au_sa)[0][:name]
|
321
|
-
assert_equal [], Date.civil(2014, 5, 19).holidays(:au_sa)
|
322
|
-
|
323
|
-
assert_equal [], Date.civil(2005, 3, 14).holidays(:au_sa)
|
324
|
-
assert_equal "March Public Holiday", Date.civil(2014, 3, 10).holidays(:au_sa)[0][:name]
|
325
|
-
assert_equal "March Public Holiday", Date.civil(2015, 3, 9).holidays(:au_sa)[0][:name]
|
326
|
-
assert_equal "March Public Holiday", Date.civil(2016, 3, 14).holidays(:au_sa)[0][:name]
|
327
|
-
assert_equal "March Public Holiday", Date.civil(2017, 3, 13).holidays(:au_sa)[0][:name]
|
328
|
-
|
329
|
-
assert_equal "ANZAC Day", Date.civil(2015, 4, 25).holidays(:au_qld)[0][:name]
|
330
|
-
assert_equal "ANZAC Day", Date.civil(2015, 4, 25).holidays(:au_wa)[0][:name]
|
331
|
-
assert_equal [], Date.civil(2015, 4, 27).holidays(:au_qld, :observed)
|
332
|
-
assert_equal "ANZAC Day", Date.civil(2015, 4, 27).holidays(:au_wa, :observed)[0][:name]
|
333
|
-
|
334
|
-
# BOXING DAY - QLD observes weekend and monday
|
335
|
-
assert_equal "Boxing Day", Date.civil(2015, 12, 26).holidays(:au_qld)[0][:name]
|
336
|
-
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_qld, :observed)[0][:name]
|
337
|
-
|
338
|
-
# BOXING DAY - SA gets monday only. same for TAS and NT.
|
339
|
-
assert_nil Date.civil(2015, 12, 26).holidays(:au_sa)[0]
|
340
|
-
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_sa)[0][:name]
|
341
|
-
assert_nil Date.civil(2015, 12, 26).holidays(:au_tas)[0]
|
342
|
-
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_tas)[0][:name]
|
343
|
-
assert_nil Date.civil(2015, 12, 26).holidays(:au_nt)[0]
|
344
|
-
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_nt)[0][:name]
|
345
|
-
|
346
|
-
assert_equal 'G20 Day', Holidays.on(Date.civil(2014,11,14), :au_qld_brisbane)[0][:name]
|
347
|
-
assert_equal [], Holidays.on(Date.civil(2014,11,14), :au_qld)
|
348
|
-
assert_equal [], Holidays.on(Date.civil(2015,11,14), :au_qld_brisbane)
|
349
|
-
|
350
|
-
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2012, 2, 13), :au_tas_south)[0][:name]
|
351
|
-
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2014, 2, 10), :au_tas_south)[0][:name]
|
352
|
-
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2015, 2, 9), :au_tas_south)[0][:name]
|
353
|
-
assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2016, 2, 8), :au_tas_south)[0][:name]
|
354
|
-
|
355
|
-
# CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
|
356
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_qld)[0][:name]
|
357
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_qld, :observed)[0][:name]
|
358
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_nsw)[0][:name]
|
359
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nsw, :observed)[0][:name]
|
360
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_act)[0][:name]
|
361
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_act, :observed)[0][:name]
|
362
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_tas)[0][:name]
|
363
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_tas, :observed)[0][:name]
|
364
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_wa)[0][:name]
|
365
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_wa, :observed)[0][:name]
|
366
|
-
|
367
|
-
# CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
|
368
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_sa)[0][:name]
|
369
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 26).holidays(:au_sa, :observed)[0][:name]
|
370
|
-
assert_equal "Boxing Day", Date.civil(2016, 12, 27).holidays(:au_sa)[0][:name]
|
371
|
-
|
372
|
-
# CHRISTMAS DAY - Victoria and NT don't observe 25th if weekend - xmas is on the 27th
|
373
|
-
assert_nil Date.civil(2016, 12, 25).holidays(:au_vic)[0]
|
374
|
-
assert_nil Date.civil(2016, 12, 25).holidays(:au_nt)[0]
|
375
|
-
assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_vic)[0][:name]
|
376
|
-
assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_nt)[0][:name]
|
377
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_vic)[0][:name]
|
378
|
-
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nt)[0][:name]
|