holidays 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +22 -8
- data/Rakefile +26 -8
- data/bin/console +7 -0
- data/bin/setup +5 -0
- data/{data → definitions}/SYNTAX.rdoc +0 -0
- data/{data → definitions}/ar.yaml +0 -0
- data/{data → definitions}/at.yaml +1 -1
- data/{data → definitions}/au.yaml +80 -51
- data/{data → definitions}/be.yaml +0 -0
- data/{data → definitions}/br.yaml +0 -0
- data/{data → definitions}/ca.yaml +0 -0
- data/{data → definitions}/ch.yaml +0 -0
- data/{data → definitions}/cl.yaml +0 -0
- data/{data → definitions}/cr.yaml +0 -0
- data/{data → definitions}/cz.yaml +0 -0
- data/{data → definitions}/de.yaml +25 -34
- data/{data → definitions}/dk.yaml +0 -0
- data/{data → definitions}/ecb_target.yaml +2 -2
- data/{data → definitions}/el.yaml +0 -0
- data/{data → definitions}/es.yaml +37 -26
- data/{data → definitions}/federal_reserve.yaml +0 -0
- data/{data → definitions}/fedex.yaml +9 -3
- data/{data → definitions}/fi.yaml +0 -0
- data/{data → definitions}/fr.yaml +0 -0
- data/{data → definitions}/gb.yaml +19 -19
- data/{data → definitions}/hr.yaml +0 -0
- data/{data → definitions}/hu.yaml +1 -1
- data/{data → definitions}/ie.yaml +0 -0
- data/{data → definitions}/index.yaml +0 -0
- data/{data → definitions}/is.yaml +0 -0
- data/{data → definitions}/it.yaml +0 -0
- data/{data → definitions}/jp.yaml +3 -3
- data/{data → definitions}/li.yaml +3 -3
- data/{data → definitions}/lt.yaml +0 -0
- data/{data → definitions}/ma.yaml +0 -0
- data/{data → definitions}/mx.yaml +0 -0
- data/{data → definitions}/nerc.yaml +0 -0
- data/{data → definitions}/nl.yaml +0 -0
- data/{data → definitions}/no.yaml +0 -0
- data/{data → definitions}/north_america_informal.yaml +0 -0
- data/{data → definitions}/nyse.yaml +0 -0
- data/{data → definitions}/nz.yaml +21 -10
- data/{data → definitions}/ph.yaml +0 -0
- data/{data → definitions}/pl.yaml +0 -0
- data/{data → definitions}/pt.yaml +0 -0
- data/{data → definitions}/ro.yaml +1 -2
- data/{data → definitions}/se.yaml +0 -0
- data/{data → definitions}/sg.yaml +0 -0
- data/{data → definitions}/si.yaml +6 -6
- data/{data → definitions}/sk.yaml +0 -0
- data/{data → definitions}/united_nations.yaml +0 -0
- data/{data → definitions}/ups.yaml +17 -11
- data/{data → definitions}/us.yaml +20 -15
- data/{data → definitions}/ve.yaml +0 -0
- data/{data → definitions}/vi.yaml +0 -0
- data/{data → definitions}/za.yaml +0 -0
- data/holidays.gemspec +2 -1
- data/lib/generated_definitions/MANIFEST +56 -0
- data/lib/generated_definitions/REGIONS.rb +4 -0
- data/lib/{holidays → generated_definitions}/ar.rb +2 -2
- data/lib/{holidays → generated_definitions}/at.rb +2 -2
- data/lib/{holidays → generated_definitions}/au.rb +19 -10
- data/lib/{holidays → generated_definitions}/be.rb +2 -2
- data/lib/{holidays → generated_definitions}/br.rb +2 -2
- data/lib/{holidays → generated_definitions}/ca.rb +2 -2
- data/lib/{holidays → generated_definitions}/ch.rb +2 -2
- data/lib/{holidays → generated_definitions}/cl.rb +2 -2
- data/lib/{holidays → generated_definitions}/cr.rb +2 -2
- data/lib/{holidays → generated_definitions}/cz.rb +2 -2
- data/lib/{holidays → generated_definitions}/de.rb +5 -4
- data/lib/{holidays → generated_definitions}/dk.rb +2 -2
- data/lib/{holidays → generated_definitions}/ecb_target.rb +2 -2
- data/lib/{holidays → generated_definitions}/el.rb +2 -2
- data/lib/{holidays → generated_definitions}/es.rb +6 -6
- data/lib/{holidays → generated_definitions}/europe.rb +7 -6
- data/lib/{holidays → generated_definitions}/fed_ex.rb +8 -3
- data/lib/{holidays → generated_definitions}/federal_reserve.rb +2 -2
- data/lib/{holidays → generated_definitions}/fi.rb +2 -2
- data/lib/{holidays → generated_definitions}/fr.rb +2 -2
- data/lib/{holidays → generated_definitions}/gb.rb +2 -2
- data/lib/{holidays → generated_definitions}/hr.rb +2 -2
- data/lib/{holidays → generated_definitions}/hu.rb +2 -2
- data/lib/{holidays → generated_definitions}/ie.rb +2 -2
- data/lib/{holidays → generated_definitions}/is.rb +2 -2
- data/lib/{holidays → generated_definitions}/it.rb +2 -2
- data/lib/{holidays → generated_definitions}/jp.rb +5 -5
- data/lib/{holidays → generated_definitions}/li.rb +2 -2
- data/lib/{holidays → generated_definitions}/lt.rb +2 -2
- data/lib/{holidays → generated_definitions}/ma.rb +2 -2
- data/lib/{holidays → generated_definitions}/mx.rb +2 -2
- data/lib/{holidays → generated_definitions}/nerc.rb +2 -2
- data/lib/{holidays → generated_definitions}/nl.rb +2 -2
- data/lib/{holidays → generated_definitions}/no.rb +2 -2
- data/lib/{holidays → generated_definitions}/north_america.rb +8 -3
- data/lib/{holidays → generated_definitions}/nyse.rb +2 -2
- data/lib/{holidays → generated_definitions}/nz.rb +5 -5
- data/lib/{holidays → generated_definitions}/ph.rb +2 -2
- data/lib/{holidays → generated_definitions}/pl.rb +2 -2
- data/lib/{holidays → generated_definitions}/pt.rb +2 -2
- data/lib/{holidays → generated_definitions}/ro.rb +2 -2
- data/lib/{holidays → generated_definitions}/scandinavia.rb +2 -2
- data/lib/{holidays → generated_definitions}/se.rb +2 -2
- data/lib/{holidays → generated_definitions}/sg.rb +2 -2
- data/lib/{holidays → generated_definitions}/si.rb +2 -2
- data/lib/{holidays → generated_definitions}/sk.rb +2 -2
- data/lib/{holidays → generated_definitions}/united_nations.rb +2 -2
- data/lib/{holidays → generated_definitions}/ups.rb +8 -3
- data/lib/{holidays → generated_definitions}/us.rb +8 -3
- data/lib/{holidays → generated_definitions}/ve.rb +2 -2
- data/lib/{holidays → generated_definitions}/vi.rb +2 -2
- data/lib/{holidays → generated_definitions}/za.rb +2 -2
- data/lib/holidays.rb +120 -665
- data/lib/holidays/core_extensions/date.rb +39 -0
- data/lib/holidays/date_calculator/day_of_month.rb +68 -0
- data/lib/holidays/date_calculator/easter.rb +58 -0
- data/lib/holidays/date_calculator/weekend_modifier.rb +49 -0
- data/lib/holidays/date_calculator_factory.rb +21 -0
- data/lib/holidays/definition/context/generator.rb +216 -0
- data/lib/holidays/definition/context/merger.rb +26 -0
- data/lib/holidays/definition/repository/cache.rb +33 -0
- data/lib/holidays/definition/repository/holidays_by_month.rb +49 -0
- data/lib/holidays/definition/repository/proc_cache.rb +36 -0
- data/lib/holidays/definition/repository/regions.rb +36 -0
- data/lib/holidays/definition/validator/region.rb +45 -0
- data/lib/holidays/definition_factory.rb +50 -0
- data/lib/holidays/option/context/parse_options.rb +96 -0
- data/lib/holidays/option_factory.rb +14 -0
- data/lib/holidays/use_case/context/between.rb +105 -0
- data/lib/holidays/use_case/context/dates_driver_builder.rb +64 -0
- data/lib/holidays/use_case_factory.rb +20 -0
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_ar.rb +1 -1
- data/test/defs/test_defs_at.rb +2 -2
- data/test/defs/test_defs_au.rb +61 -43
- data/test/defs/test_defs_be.rb +1 -1
- data/test/defs/test_defs_br.rb +1 -1
- data/test/defs/test_defs_ca.rb +1 -1
- data/test/defs/test_defs_ch.rb +1 -1
- data/test/defs/test_defs_cl.rb +1 -1
- data/test/defs/test_defs_cr.rb +1 -1
- data/test/defs/test_defs_cz.rb +1 -1
- data/test/defs/test_defs_de.rb +18 -30
- data/test/defs/test_defs_dk.rb +1 -1
- data/test/defs/test_defs_ecb_target.rb +3 -3
- data/test/defs/test_defs_el.rb +1 -1
- data/test/defs/test_defs_es.rb +36 -25
- data/test/defs/test_defs_europe.rb +82 -84
- data/test/defs/test_defs_fed_ex.rb +4 -1
- data/test/defs/test_defs_federal_reserve.rb +1 -1
- data/test/defs/test_defs_fi.rb +1 -1
- data/test/defs/test_defs_fr.rb +1 -1
- data/test/defs/test_defs_gb.rb +20 -20
- data/test/defs/test_defs_hr.rb +1 -1
- data/test/defs/test_defs_hu.rb +2 -2
- data/test/defs/test_defs_ie.rb +1 -1
- data/test/defs/test_defs_is.rb +1 -1
- data/test/defs/test_defs_it.rb +1 -1
- data/test/defs/test_defs_jp.rb +1 -1
- data/test/defs/test_defs_li.rb +4 -4
- data/test/defs/test_defs_lt.rb +1 -1
- data/test/defs/test_defs_ma.rb +1 -1
- data/test/defs/test_defs_mx.rb +1 -1
- data/test/defs/test_defs_nerc.rb +1 -1
- data/test/defs/test_defs_nl.rb +1 -1
- data/test/defs/test_defs_no.rb +1 -1
- data/test/defs/test_defs_north_america.rb +5 -3
- data/test/defs/test_defs_nyse.rb +1 -1
- data/test/defs/test_defs_nz.rb +19 -9
- data/test/defs/test_defs_ph.rb +1 -1
- data/test/defs/test_defs_pl.rb +1 -1
- data/test/defs/test_defs_pt.rb +1 -1
- data/test/defs/test_defs_ro.rb +2 -3
- data/test/defs/test_defs_scandinavia.rb +1 -1
- data/test/defs/test_defs_se.rb +1 -1
- data/test/defs/test_defs_sg.rb +1 -1
- data/test/defs/test_defs_si.rb +7 -7
- data/test/defs/test_defs_sk.rb +1 -1
- data/test/defs/test_defs_united_nations.rb +1 -1
- data/test/defs/test_defs_ups.rb +5 -2
- data/test/defs/test_defs_us.rb +5 -3
- data/test/defs/test_defs_ve.rb +1 -1
- data/test/defs/test_defs_vi.rb +1 -1
- data/test/defs/test_defs_za.rb +1 -1
- data/test/{test_date.rb → holidays/core_extensions/test_date.rb} +8 -2
- data/test/holidays/date_calculator/test_day_of_month.rb +27 -0
- data/test/holidays/date_calculator/test_easter.rb +29 -0
- data/test/holidays/date_calculator/test_weekend_modifier.rb +33 -0
- data/test/holidays/definition/context/test_generator.rb +84 -0
- data/test/holidays/definition/context/test_merger.rb +22 -0
- data/test/holidays/definition/repository/test_cache.rb +82 -0
- data/test/holidays/definition/repository/test_holidays_by_month.rb +187 -0
- data/test/holidays/definition/repository/test_proc_cache.rb +29 -0
- data/test/holidays/definition/repository/test_regions.rb +86 -0
- data/test/holidays/definition/validator/test_region.rb +50 -0
- data/test/holidays/option/context/test_parse_options.rb +69 -0
- data/test/holidays/test_date_calculator_factory.rb +21 -0
- data/test/holidays/test_definition_factory.rb +34 -0
- data/test/holidays/test_option_factory.rb +9 -0
- data/test/holidays/test_use_case_factory.rb +13 -0
- data/test/holidays/use_case/context/test_between.rb +75 -0
- data/test/holidays/use_case/context/test_dates_driver_builder.rb +91 -0
- data/test/test_all_regions.rb +14 -3
- data/test/test_helper.rb +2 -1
- data/test/test_holidays.rb +19 -24
- data/test/test_holidays_between.rb +85 -0
- data/test/test_multiple_regions.rb +2 -2
- data/test/test_parse_definitions.rb +10 -4
- metadata +181 -111
- data/.coveralls.yml +0 -1
- data/lib/holidays/MANIFEST +0 -55
File without changes
|
@@ -38,5 +38,5 @@ tests: |
|
|
38
38
|
assert_equal name, (Holidays.on(date, :ecb_target)[0] || {})[:name]
|
39
39
|
end
|
40
40
|
|
41
|
-
assert_equal 'Good Friday', Date.civil(2013,3,29)
|
42
|
-
assert_equal 'Easter Monday', Date.civil(2013,4,1)
|
41
|
+
assert_equal 'Good Friday', Holidays.on(Date.civil(2013,3,29), :ecb_target)[0][:name]
|
42
|
+
assert_equal 'Easter Monday', Holidays.on(Date.civil(2013,4,1), :ecb_target)[0][:name]
|
File without changes
|
@@ -13,7 +13,7 @@
|
|
13
13
|
months:
|
14
14
|
0:
|
15
15
|
- name: Jueves Santo
|
16
|
-
regions: [es_pv,
|
16
|
+
regions: [es_pv, es_na, es_an, es_ib, es_cm, es_mu, es_m, es_ar, es_cl, es_cn, es_lo, es_ga, es_ce, es_o, es_ex]
|
17
17
|
function: easter(year)-3
|
18
18
|
- name: Viernes Santo
|
19
19
|
regions: [es]
|
@@ -45,11 +45,11 @@ months:
|
|
45
45
|
mday: 19
|
46
46
|
observed: to_monday_if_sunday
|
47
47
|
4:
|
48
|
-
- name:
|
49
|
-
regions: [
|
48
|
+
- name: Día de Castilla y León
|
49
|
+
regions: [es_cl]
|
50
50
|
mday: 23
|
51
51
|
observed: to_monday_if_sunday
|
52
|
-
- name: Día de Aragón
|
52
|
+
- name: San Jorge, Día de Aragón
|
53
53
|
regions: [es_ar]
|
54
54
|
mday: 23
|
55
55
|
observed: to_monday_if_sunday
|
@@ -150,40 +150,51 @@ tests: |
|
|
150
150
|
assert_equal name, (Holidays.on(date, :es, :informal)[0] || {})[:name]
|
151
151
|
end
|
152
152
|
|
153
|
+
[:es_pv, :es_na, :es_an, :es_ib, :es_cm, :es_mu, :es_m, :es_ar, :es_cl, :es_cn, :es_lo, :es_ga, :es_ce, :es_o, :es_ex, :es_].each do |r|
|
154
|
+
assert_equal 'Jueves Santo', Holidays.on(Date.civil(2009,4,9), r)[0][:name]
|
155
|
+
end
|
153
156
|
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
154
|
-
assert_equal '
|
155
|
-
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
157
|
+
assert_equal 'Lunes de Pascua', Holidays.on(Date.civil(2009,4,13), r)[0][:name]
|
156
158
|
end
|
157
159
|
|
158
|
-
assert_equal 'Jueves Santo', Date.civil(2009,4,9)
|
160
|
+
assert_equal 'Jueves Santo', Holidays.on(Date.civil(2009,4,9), :es_an)[0][:name]
|
159
161
|
|
160
162
|
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
161
|
-
assert_equal 'San José', Date.civil(2009,3,19)
|
163
|
+
assert_equal 'San José', Holidays.on(Date.civil(2009,3,19), r)[0][:name]
|
164
|
+
end
|
165
|
+
|
166
|
+
[:es_cl].each do |r|
|
167
|
+
assert_equal 'Día de Castilla y León', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
|
168
|
+
end
|
169
|
+
|
170
|
+
[:es_ar].each do |r|
|
171
|
+
assert_equal 'San Jorge, Día de Aragón', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
|
162
172
|
end
|
163
173
|
|
164
|
-
[:
|
165
|
-
assert_equal '
|
174
|
+
[:es_].each do |r|
|
175
|
+
assert_equal 'Día de Castilla y León', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
|
176
|
+
assert_equal 'San Jorge, Día de Aragón', Holidays.on(Date.civil(2009,4,23), r)[1][:name]
|
166
177
|
end
|
167
178
|
|
168
179
|
[:es_vc, :es_v, :es_].each do |r|
|
169
|
-
assert_equal 'Día de Valencia', Date.civil(2009,10,9)
|
180
|
+
assert_equal 'Día de Valencia', Holidays.on(Date.civil(2009,10,9), r)[0][:name]
|
170
181
|
end
|
171
182
|
|
172
183
|
[:es_ib, :es_ct, :es_].each do |r|
|
173
|
-
assert_equal 'San Esteban', Date.civil(2009,12,26)
|
184
|
+
assert_equal 'San Esteban', Holidays.on(Date.civil(2009,12,26), r)[0][:name]
|
174
185
|
end
|
175
186
|
|
176
|
-
assert_equal 'Año Nuevo', Date.civil(2012,1,1)
|
177
|
-
assert_equal 'Año Nuevo', Date.civil(2012,1,2)
|
178
|
-
assert_equal 'Día de Andalucía', Date.civil(2009,2,28)
|
179
|
-
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1)
|
180
|
-
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2)
|
181
|
-
assert_equal 'Día de las Canarias', Date.civil(2006,5,30)
|
182
|
-
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31)
|
183
|
-
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9)
|
184
|
-
assert_equal 'Día de La Rioja', Date.civil(2009,6,9)
|
185
|
-
assert_equal 'Santiago Apostol', Date.civil(2009,7,23)
|
186
|
-
assert_equal 'Día de Ceuta', Date.civil(2009,9,2)
|
187
|
-
assert_equal 'Día de Asturias', Date.civil(2009,9,8)
|
188
|
-
assert_equal 'Día de Extremadura', Date.civil(2009,9,8)
|
189
|
-
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11)
|
187
|
+
assert_equal 'Año Nuevo', Holidays.on(Date.civil(2012,1,1), :es)[0][:name]
|
188
|
+
assert_equal 'Año Nuevo', Holidays.on(Date.civil(2012,1,2), :es, :observed)[0][:name]
|
189
|
+
assert_equal 'Día de Andalucía', Holidays.on(Date.civil(2009,2,28), :es_an)[0][:name]
|
190
|
+
assert_equal 'Día de las Islas Baleares', Holidays.on(Date.civil(2009,3,1), :es_ib)[0][:name]
|
191
|
+
assert_equal 'Fiesta de la Comunidad', Holidays.on(Date.civil(2006,5,2), :es_m)[0][:name]
|
192
|
+
assert_equal 'Día de las Canarias', Holidays.on(Date.civil(2006,5,30), :es_cn)[0][:name]
|
193
|
+
assert_equal 'Día de la Región Castilla-La Mancha', Holidays.on(Date.civil(2009,5,31), :es_cm)[0][:name]
|
194
|
+
assert_equal 'Día de la Región de Murcia', Holidays.on(Date.civil(2009,6,9), :es_mu)[0][:name]
|
195
|
+
assert_equal 'Día de La Rioja', Holidays.on(Date.civil(2009,6,9), :es_lo)[0][:name]
|
196
|
+
assert_equal 'Santiago Apostol', Holidays.on(Date.civil(2009,7,23), :es_ga)[0][:name]
|
197
|
+
assert_equal 'Día de Ceuta', Holidays.on(Date.civil(2009,9,2), :es_ce)[0][:name]
|
198
|
+
assert_equal 'Día de Asturias', Holidays.on(Date.civil(2009,9,8), :es_o)[0][:name]
|
199
|
+
assert_equal 'Día de Extremadura', Holidays.on(Date.civil(2009,9,8), :es_ex)[0][:name]
|
200
|
+
assert_equal 'Fiesta Nacional de Cataluña', Holidays.on(Date.civil(2009,9,11), :es_ct)[0][:name]
|
File without changes
|
@@ -32,9 +32,8 @@ months:
|
|
32
32
|
regions: [fedex]
|
33
33
|
wday: 4
|
34
34
|
- name: Day After Thanksgiving
|
35
|
-
|
35
|
+
function: day_after_thanksgiving(year)
|
36
36
|
regions: [fedex]
|
37
|
-
wday: 5
|
38
37
|
12:
|
39
38
|
- name: Christmas Day
|
40
39
|
regions: [fedex]
|
@@ -43,6 +42,11 @@ months:
|
|
43
42
|
- name: New Year's Eve
|
44
43
|
regions: [fedex]
|
45
44
|
mday: 31
|
45
|
+
methods:
|
46
|
+
day_after_thanksgiving: |
|
47
|
+
def self.day_after_thanksgiving(year)
|
48
|
+
Date.calculate_mday(year, 11, 4, 4) + 1
|
49
|
+
end
|
46
50
|
tests: |
|
47
51
|
{Date.civil(2015,1,1) => 'New Year\'s Day',
|
48
52
|
Date.civil(2015,5,25) => 'Memorial Day',
|
@@ -50,7 +54,9 @@ tests: |
|
|
50
54
|
Date.civil(2015,9,7) => 'Labor Day',
|
51
55
|
Date.civil(2015,11,26) => 'Thanksgiving',
|
52
56
|
Date.civil(2015,11,27) => 'Day After Thanksgiving',
|
57
|
+
Date.civil(2013,11,28) => 'Thanksgiving',
|
58
|
+
Date.civil(2013,11,29) => 'Day After Thanksgiving',
|
53
59
|
Date.civil(2015,12,25) => 'Christmas Day',
|
54
60
|
Date.civil(2015,12,31) => 'New Year\'s Eve',}.each do |date, name|
|
55
61
|
assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
|
56
|
-
end
|
62
|
+
end
|
File without changes
|
File without changes
|
@@ -96,29 +96,29 @@ tests: |
|
|
96
96
|
assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
|
97
97
|
end
|
98
98
|
|
99
|
-
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17)
|
100
|
-
assert_equal 'St. Andrew\'s Day', Date.civil(2008,11,30)
|
99
|
+
assert_equal 'St. Patrick\'s Day', Holidays.on(Date.civil(2008,3,17), :gb_nir, :informal)[0][:name]
|
100
|
+
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2008,11,30), :gb_sct, :informal)[0][:name]
|
101
101
|
|
102
|
-
assert_equal 'Christmas Day', Date.civil(2008,12,25)
|
103
|
-
assert_equal 'Christmas Day', Date.civil(2009,12,25)
|
104
|
-
assert_equal 'Christmas Day', Date.civil(2010,12,27)
|
102
|
+
assert_equal 'Christmas Day', Holidays.on(Date.civil(2008,12,25), :gb_, :observed)[0][:name]
|
103
|
+
assert_equal 'Christmas Day', Holidays.on(Date.civil(2009,12,25), :gb_, :observed)[0][:name]
|
104
|
+
assert_equal 'Christmas Day', Holidays.on(Date.civil(2010,12,27), :gb_, :observed)[0][:name]
|
105
105
|
|
106
|
-
assert_equal 'Boxing Day', Date.civil(2008,12,26)
|
107
|
-
assert_equal 'Boxing Day', Date.civil(2009,12,28)
|
108
|
-
assert_equal 'Boxing Day', Date.civil(2010,12,28)
|
109
|
-
assert_equal 'Boxing Day', Date.civil(2011,12,27)
|
106
|
+
assert_equal 'Boxing Day', Holidays.on(Date.civil(2008,12,26), :gb_, :observed)[0][:name]
|
107
|
+
assert_equal 'Boxing Day', Holidays.on(Date.civil(2009,12,28), :gb_, :observed)[0][:name]
|
108
|
+
assert_equal 'Boxing Day', Holidays.on(Date.civil(2010,12,28), :gb_, :observed)[0][:name]
|
109
|
+
assert_equal 'Boxing Day', Holidays.on(Date.civil(2011,12,27), :gb_, :observed)[0][:name]
|
110
110
|
|
111
|
-
assert_equal 'New Year\'s Day', Date.civil(2010,1,1)
|
112
|
-
assert_equal 'New Year\'s Day', Date.civil(2011,1,3)
|
113
|
-
assert_equal 'New Year\'s Day', Date.civil(2012,1,2)
|
111
|
+
assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2010,1,1), :gb, :observed)[0][:name]
|
112
|
+
assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2011,1,3), :gb, :observed)[0][:name]
|
113
|
+
assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2012,1,2), :gb, :observed)[0][:name]
|
114
114
|
|
115
|
-
assert_equal '2nd January', Date.civil(2010,1,4)
|
116
|
-
assert_equal '2nd January', Date.civil(2011,1,4)
|
117
|
-
assert_equal '2nd January', Date.civil(2012,1,3)
|
118
|
-
assert_equal '2nd January', Date.civil(2013,1,2)
|
119
|
-
assert_equal '2nd January', Date.civil(2014,1,2)
|
115
|
+
assert_equal '2nd January', Holidays.on(Date.civil(2010,1,4), :gb_sct, :observed)[0][:name]
|
116
|
+
assert_equal '2nd January', Holidays.on(Date.civil(2011,1,4), :gb_sct, :observed)[0][:name]
|
117
|
+
assert_equal '2nd January', Holidays.on(Date.civil(2012,1,3), :gb_sct, :observed)[0][:name]
|
118
|
+
assert_equal '2nd January', Holidays.on(Date.civil(2013,1,2), :gb_sct, :observed)[0][:name]
|
119
|
+
assert_equal '2nd January', Holidays.on(Date.civil(2014,1,2), :gb_sct, :observed)[0][:name]
|
120
120
|
|
121
121
|
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
122
|
-
assert_equal 'Easter Monday', Date.civil(2008,3,24)
|
123
|
-
assert_equal 'Bank Holiday', Date.civil(2008,8,25)
|
122
|
+
assert_equal 'Easter Monday', Holidays.on(Date.civil(2008,3,24), r)[0][:name]
|
123
|
+
assert_equal 'Bank Holiday', Holidays.on(Date.civil(2008,8,25), r)[0][:name]
|
124
124
|
end
|
File without changes
|
@@ -58,4 +58,4 @@ tests: |
|
|
58
58
|
assert_equal name, (Holidays.on(date, :hu, :informal)[0] || {})[:name]
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
assert_equal [], Holidays.on(Date.civil(2012,3,14), :hu), '2012-03-14 is not a holiday in Hungary'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -71,7 +71,7 @@ months:
|
|
71
71
|
week: 3
|
72
72
|
- name: 振替休日
|
73
73
|
regions: [jp]
|
74
|
-
function: jp_substitute_holiday(year, 7,
|
74
|
+
function: jp_substitute_holiday(year, 7, Holidays.calculate_day_of_month(year, 7, 3, 1))
|
75
75
|
9:
|
76
76
|
- name: 敬老の日
|
77
77
|
regions: [jp]
|
@@ -79,7 +79,7 @@ months:
|
|
79
79
|
week: 3
|
80
80
|
- name: 振替休日
|
81
81
|
regions: [jp]
|
82
|
-
function: jp_substitute_holiday(year, 9,
|
82
|
+
function: jp_substitute_holiday(year, 9, Holidays.calculate_day_of_month(year, 9, 3, 1))
|
83
83
|
- name: 国民の休日
|
84
84
|
regions: [jp]
|
85
85
|
function: jp_citizons_holiday(year)
|
@@ -96,7 +96,7 @@ months:
|
|
96
96
|
week: 2
|
97
97
|
- name: 振替休日
|
98
98
|
regions: [jp]
|
99
|
-
function: jp_substitute_holiday(year, 10,
|
99
|
+
function: jp_substitute_holiday(year, 10, Holidays.calculate_day_of_month(year, 10, 2, 1))
|
100
100
|
11:
|
101
101
|
- name: 文化の日
|
102
102
|
regions: [jp]
|
@@ -89,14 +89,14 @@ tests: |
|
|
89
89
|
end
|
90
90
|
|
91
91
|
[:li].each do |r|
|
92
|
-
assert_equal 'Fronleichnam', Date.civil(2009,6,11)
|
92
|
+
assert_equal 'Fronleichnam', Holidays.on(Date.civil(2009,6,11), r)[0][:name]
|
93
93
|
end
|
94
94
|
|
95
95
|
[:li].each do |r|
|
96
|
-
assert_equal 'Staatsfeiertag', Date.civil(2009,8,15)
|
96
|
+
assert_equal 'Staatsfeiertag', Holidays.on(Date.civil(2009,8,15), r)[0][:name]
|
97
97
|
end
|
98
98
|
|
99
99
|
[:li].each do |r|
|
100
|
-
assert_equal 'Allerheiligen', Date.civil(2009,11,1)
|
100
|
+
assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009,11,1), r)[0][:name]
|
101
101
|
end
|
102
102
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -40,7 +40,7 @@ months:
|
|
40
40
|
observed: closest_monday
|
41
41
|
2:
|
42
42
|
- name: Nelson Anniversary Day
|
43
|
-
regions: [
|
43
|
+
regions: [nz_ne]
|
44
44
|
mday: 1
|
45
45
|
observed: closest_monday
|
46
46
|
- name: Waitangi Day
|
@@ -53,9 +53,10 @@ months:
|
|
53
53
|
mday: 23
|
54
54
|
observed: closest_monday
|
55
55
|
- name: Taranaki Anniversary Day
|
56
|
-
regions: [
|
56
|
+
regions: [nz_ta]
|
57
57
|
week: 2
|
58
58
|
wday: 1
|
59
|
+
observed: closest_monday
|
59
60
|
4:
|
60
61
|
- name: ANZAC Day
|
61
62
|
regions: [nz]
|
@@ -119,14 +120,24 @@ tests: |
|
|
119
120
|
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
120
121
|
assert_equal name, (Holidays.on(date, :nz, :informal)[0] || {})[:name]
|
121
122
|
end
|
122
|
-
assert_equal 'ANZAC Day', Date.civil(2015, 4, 25)
|
123
|
-
assert_equal 'ANZAC Day', Date.civil(2015, 4, 27)
|
124
|
-
assert_equal 'ANZAC Day', Date.civil(2016, 4, 25)
|
125
|
-
assert_equal 'ANZAC Day', Date.civil(2016, 4, 25)
|
126
|
-
assert_equal 'Waitangi Day', Date.civil(2015, 2, 6)
|
127
|
-
assert_equal 'Waitangi Day', Date.civil(2015, 2, 6)
|
128
|
-
assert_equal 'Waitangi Day', Date.civil(2016, 2, 6)
|
129
|
-
assert_equal 'Waitangi Day', Date.civil(2016, 2, 8)
|
123
|
+
assert_equal 'ANZAC Day', Holidays.on(Date.civil(2015, 4, 25), :nz)[0][:name]
|
124
|
+
assert_equal 'ANZAC Day', Holidays.on(Date.civil(2015, 4, 27), :nz, :observed)[0][:name]
|
125
|
+
assert_equal 'ANZAC Day', Holidays.on(Date.civil(2016, 4, 25), :nz)[0][:name]
|
126
|
+
assert_equal 'ANZAC Day', Holidays.on(Date.civil(2016, 4, 25), :nz, :observed)[0][:name]
|
127
|
+
assert_equal 'Waitangi Day', Holidays.on(Date.civil(2015, 2, 6), :nz)[0][:name]
|
128
|
+
assert_equal 'Waitangi Day', Holidays.on(Date.civil(2015, 2, 6), :nz, :observed)[0][:name]
|
129
|
+
assert_equal 'Waitangi Day', Holidays.on(Date.civil(2016, 2, 6), :nz)[0][:name]
|
130
|
+
assert_equal 'Waitangi Day', Holidays.on(Date.civil(2016, 2, 8), :nz, :observed)[0][:name]
|
131
|
+
|
132
|
+
assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2016, 2, 1), :nz_ne, :observed)[0][:name]
|
133
|
+
assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2017, 1, 30), :nz_ne, :observed)[0][:name]
|
134
|
+
assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2018, 1, 29), :nz_ne, :observed)[0][:name]
|
135
|
+
assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2019, 2, 4), :nz_ne, :observed)[0][:name]
|
136
|
+
|
137
|
+
assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2016, 3, 14), :nz_ta, :observed)[0][:name]
|
138
|
+
assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2017, 3, 13), :nz_ta, :observed)[0][:name]
|
139
|
+
assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2018, 3, 12), :nz_ta, :observed)[0][:name]
|
140
|
+
assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2019, 3, 11), :nz_ta, :observed)[0][:name]
|
130
141
|
methods:
|
131
142
|
closest_monday: |
|
132
143
|
def self.closest_monday(date)
|
File without changes
|
File without changes
|
File without changes
|
@@ -72,5 +72,4 @@ tests: |
|
|
72
72
|
assert_equal name, (Holidays.on(date, :ro, :informal)[0] || {})[:name]
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
assert !Date.civil(2013,7,23).holiday?(:ro), '2010-07-23 is not a holiday in Romania'
|
75
|
+
assert_equal [], Holidays.on(Date.civil(2013,7,23), :ro), '2013-07-23 is not a holiday in Romania'
|
File without changes
|
File without changes
|
@@ -58,14 +58,14 @@ months:
|
|
58
58
|
regions: [si]
|
59
59
|
mday: 26
|
60
60
|
tests: |
|
61
|
-
assert_equal 'velikonočna nedelja', Date.civil(2015,4,5)
|
62
|
-
assert_equal 'velikonočna nedelja', Date.civil(2016,3,27)
|
61
|
+
assert_equal 'velikonočna nedelja', Holidays.on(Date.civil(2015,4,5), :si)[0][:name]
|
62
|
+
assert_equal 'velikonočna nedelja', Holidays.on(Date.civil(2016,3,27), :si)[0][:name]
|
63
63
|
|
64
|
-
assert_equal 'velikonočni ponedeljek', Date.civil(2015,4,6)
|
65
|
-
assert_equal 'velikonočni ponedeljek', Date.civil(2016,3,28)
|
64
|
+
assert_equal 'velikonočni ponedeljek', Holidays.on(Date.civil(2015,4,6), :si)[0][:name]
|
65
|
+
assert_equal 'velikonočni ponedeljek', Holidays.on(Date.civil(2016,3,28), :si)[0][:name]
|
66
66
|
|
67
|
-
assert_equal 'binkošti', Date.civil(2015,5,24)
|
68
|
-
assert_equal 'binkošti', Date.civil(2016,5,15)
|
67
|
+
assert_equal 'binkošti', Holidays.on(Date.civil(2015,5,24), :si)[0][:name]
|
68
|
+
assert_equal 'binkošti', Holidays.on(Date.civil(2016,5,15), :si)[0][:name]
|
69
69
|
|
70
70
|
(2014..2020).each do |year|
|
71
71
|
{Date.civil(year,1,1) => 'novo leto',
|
File without changes
|
File without changes
|
@@ -4,38 +4,37 @@
|
|
4
4
|
#
|
5
5
|
# Updated: 2008-09-23.
|
6
6
|
# Source: http://www.ups.com/content/us/en/resources/ship/imp_exp/operation.html
|
7
|
-
---
|
7
|
+
---
|
8
8
|
months:
|
9
|
-
1:
|
9
|
+
1:
|
10
10
|
- name: New Year's Day
|
11
11
|
regions: [ups]
|
12
12
|
mday: 1
|
13
13
|
observed: to_weekday_if_weekend
|
14
|
-
5:
|
14
|
+
5:
|
15
15
|
- name: Memorial Day
|
16
16
|
week: -1
|
17
17
|
regions: [ups]
|
18
18
|
wday: 1
|
19
|
-
7:
|
19
|
+
7:
|
20
20
|
- name: Independence Day
|
21
21
|
regions: [ups]
|
22
22
|
mday: 4
|
23
23
|
observed: to_weekday_if_weekend
|
24
|
-
9:
|
24
|
+
9:
|
25
25
|
- name: Labor Day
|
26
26
|
week: 1
|
27
27
|
regions: [ups]
|
28
28
|
wday: 1
|
29
|
-
11:
|
29
|
+
11:
|
30
30
|
- name: Thanksgiving
|
31
31
|
week: 4
|
32
32
|
regions: [ups]
|
33
33
|
wday: 4
|
34
34
|
- name: Day After Thanksgiving
|
35
|
-
|
35
|
+
function: day_after_thanksgiving(year)
|
36
36
|
regions: [ups]
|
37
|
-
|
38
|
-
12:
|
37
|
+
12:
|
39
38
|
- name: Christmas Day
|
40
39
|
regions: [ups]
|
41
40
|
mday: 25
|
@@ -43,14 +42,21 @@ months:
|
|
43
42
|
- name: New Year's Eve
|
44
43
|
regions: [ups]
|
45
44
|
mday: 31
|
45
|
+
methods:
|
46
|
+
day_after_thanksgiving: |
|
47
|
+
def self.day_after_thanksgiving(year)
|
48
|
+
Date.calculate_mday(year, 11, 4, 4) + 1
|
49
|
+
end
|
46
50
|
tests: |
|
47
|
-
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
51
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
48
52
|
Date.civil(2008,5,26) => 'Memorial Day',
|
49
53
|
Date.civil(2008,7,4) => 'Independence Day',
|
50
54
|
Date.civil(2008,9,1) => 'Labor Day',
|
51
55
|
Date.civil(2008,11,27) => 'Thanksgiving',
|
52
56
|
Date.civil(2008,11,28) => 'Day After Thanksgiving',
|
57
|
+
Date.civil(2013,11,28) => 'Thanksgiving',
|
58
|
+
Date.civil(2013,11,29) => 'Day After Thanksgiving',
|
53
59
|
Date.civil(2008,12,25) => 'Christmas Day',
|
54
60
|
Date.civil(2008,12,31) => 'New Year\'s Eve',}.each do |date, name|
|
55
61
|
assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
|
56
|
-
end
|
62
|
+
end
|