holidays 3.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/CONTRIBUTING.md +37 -0
  4. data/README.md +16 -25
  5. data/REFERENCES +4 -1
  6. data/Rakefile +38 -8
  7. data/benchmark.rb +8 -0
  8. data/definitions/README.md +187 -8
  9. data/definitions/ar.yaml +2 -1
  10. data/definitions/at.yaml +17 -13
  11. data/definitions/au.yaml +65 -60
  12. data/definitions/be_fr.yaml +14 -10
  13. data/definitions/be_nl.yaml +8 -4
  14. data/definitions/bg.yaml +12 -6
  15. data/definitions/br.yaml +6 -3
  16. data/definitions/ca.yaml +8 -6
  17. data/definitions/ch.yaml +21 -15
  18. data/definitions/cl.yaml +4 -2
  19. data/definitions/cr.yaml +5 -3
  20. data/definitions/cz.yaml +4 -2
  21. data/definitions/de.yaml +25 -14
  22. data/definitions/dk.yaml +26 -17
  23. data/definitions/ecb_target.yaml +4 -2
  24. data/definitions/el.yaml +23 -18
  25. data/definitions/es.yaml +31 -28
  26. data/definitions/federal_reserve.yaml +12 -12
  27. data/definitions/fedex.yaml +6 -6
  28. data/definitions/fi.yaml +26 -25
  29. data/definitions/fr.yaml +8 -4
  30. data/definitions/gb.yaml +9 -7
  31. data/definitions/hr.yaml +8 -6
  32. data/definitions/hu.yaml +8 -6
  33. data/definitions/ie.yaml +17 -16
  34. data/definitions/index.yaml +1 -1
  35. data/definitions/is.yaml +29 -19
  36. data/definitions/it.yaml +10 -9
  37. data/definitions/jp.yaml +92 -44
  38. data/definitions/li.yaml +25 -20
  39. data/definitions/lt.yaml +2 -1
  40. data/definitions/ma.yaml +7 -7
  41. data/definitions/mx.yaml +11 -11
  42. data/definitions/nerc.yaml +6 -6
  43. data/definitions/nl.yaml +22 -18
  44. data/definitions/no.yaml +19 -11
  45. data/definitions/north_america_informal.yaml +6 -6
  46. data/definitions/nyse.yaml +9 -8
  47. data/definitions/nz.yaml +33 -29
  48. data/definitions/ph.yaml +15 -8
  49. data/definitions/pl.yaml +27 -17
  50. data/definitions/pt.yaml +4 -2
  51. data/definitions/ro.yaml +21 -18
  52. data/definitions/se.yaml +24 -18
  53. data/definitions/sg.yaml +10 -9
  54. data/definitions/si.yaml +4 -2
  55. data/definitions/sk.yaml +4 -2
  56. data/definitions/united_nations.yaml +12 -12
  57. data/definitions/ups.yaml +6 -6
  58. data/definitions/us.yaml +12 -11
  59. data/definitions/ve.yaml +8 -4
  60. data/definitions/vi.yaml +6 -6
  61. data/definitions/za.yaml +26 -24
  62. data/holidays.gemspec +3 -1
  63. data/lib/generated_definitions/MANIFEST +1 -1
  64. data/lib/generated_definitions/ar.rb +8 -6
  65. data/lib/generated_definitions/at.rb +11 -9
  66. data/lib/generated_definitions/au.rb +75 -99
  67. data/lib/generated_definitions/be.rb +12 -10
  68. data/lib/generated_definitions/be_fr.rb +12 -10
  69. data/lib/generated_definitions/be_nl.rb +12 -10
  70. data/lib/generated_definitions/bg.rb +14 -13
  71. data/lib/generated_definitions/br.rb +11 -9
  72. data/lib/generated_definitions/ca.rb +20 -20
  73. data/lib/generated_definitions/ch.rb +41 -44
  74. data/lib/generated_definitions/cl.rb +9 -7
  75. data/lib/generated_definitions/cr.rb +9 -7
  76. data/lib/generated_definitions/cz.rb +9 -6
  77. data/lib/generated_definitions/de.rb +25 -25
  78. data/lib/generated_definitions/dk.rb +17 -15
  79. data/lib/generated_definitions/ecb_target.rb +9 -7
  80. data/lib/generated_definitions/el.rb +13 -11
  81. data/lib/generated_definitions/es.rb +35 -33
  82. data/lib/generated_definitions/europe.rb +234 -247
  83. data/lib/generated_definitions/federal_reserve.rb +11 -9
  84. data/lib/generated_definitions/fedex.rb +42 -0
  85. data/lib/generated_definitions/fi.rb +32 -36
  86. data/lib/generated_definitions/fr.rb +12 -10
  87. data/lib/generated_definitions/gb.rb +15 -13
  88. data/lib/generated_definitions/hr.rb +10 -8
  89. data/lib/generated_definitions/hu.rb +9 -7
  90. data/lib/generated_definitions/ie.rb +17 -17
  91. data/lib/generated_definitions/is.rb +26 -26
  92. data/lib/generated_definitions/it.rb +9 -7
  93. data/lib/generated_definitions/jp.rb +112 -89
  94. data/lib/generated_definitions/li.rb +14 -12
  95. data/lib/generated_definitions/lt.rb +9 -7
  96. data/lib/generated_definitions/ma.rb +7 -5
  97. data/lib/generated_definitions/mx.rb +7 -5
  98. data/lib/generated_definitions/nerc.rb +10 -8
  99. data/lib/generated_definitions/nl.rb +15 -13
  100. data/lib/generated_definitions/no.rb +16 -14
  101. data/lib/generated_definitions/north_america.rb +34 -37
  102. data/lib/generated_definitions/nyse.rb +10 -8
  103. data/lib/generated_definitions/nz.rb +40 -40
  104. data/lib/generated_definitions/ph.rb +17 -13
  105. data/lib/generated_definitions/pl.rb +25 -27
  106. data/lib/generated_definitions/pt.rb +10 -8
  107. data/lib/generated_definitions/ro.rb +11 -9
  108. data/lib/generated_definitions/scandinavia.rb +92 -102
  109. data/lib/generated_definitions/se.rb +25 -27
  110. data/lib/generated_definitions/sg.rb +11 -9
  111. data/lib/generated_definitions/si.rb +10 -8
  112. data/lib/generated_definitions/sk.rb +9 -7
  113. data/lib/generated_definitions/united_nations.rb +7 -5
  114. data/lib/generated_definitions/ups.rb +13 -12
  115. data/lib/generated_definitions/us.rb +20 -21
  116. data/lib/generated_definitions/ve.rb +11 -9
  117. data/lib/generated_definitions/vi.rb +7 -5
  118. data/lib/generated_definitions/za.rb +19 -17
  119. data/lib/holidays.rb +20 -83
  120. data/lib/holidays/date_calculator/weekend_modifier.rb +22 -5
  121. data/lib/holidays/definition/context/generator.rb +67 -29
  122. data/lib/holidays/definition/context/merger.rb +8 -8
  123. data/lib/holidays/definition/decorator/custom_method_proc.rb +28 -0
  124. data/lib/holidays/definition/decorator/custom_method_source.rb +30 -0
  125. data/lib/holidays/definition/entity/custom_method.rb +11 -0
  126. data/lib/holidays/definition/parser/custom_method.rb +69 -0
  127. data/lib/holidays/definition/repository/custom_methods.rb +27 -0
  128. data/lib/holidays/definition/repository/holidays_by_month.rb +1 -1
  129. data/lib/holidays/definition/repository/{proc_cache.rb → proc_result_cache.rb} +19 -4
  130. data/lib/holidays/definition/validator/custom_method.rb +31 -0
  131. data/lib/holidays/definition_factory.rb +42 -6
  132. data/lib/holidays/errors.rb +6 -0
  133. data/lib/holidays/load_all_definitions.rb +57 -0
  134. data/lib/holidays/option/context/parse_options.rb +26 -16
  135. data/lib/holidays/option_factory.rb +1 -0
  136. data/lib/holidays/use_case/context/between.rb +41 -14
  137. data/lib/holidays/use_case_factory.rb +2 -1
  138. data/lib/holidays/version.rb +1 -1
  139. data/test/data/test_single_custom_holiday_with_custom_procs.yaml +24 -0
  140. data/test/defs/test_defs_at.rb +1 -1
  141. data/test/defs/test_defs_au.rb +3 -2
  142. data/test/defs/test_defs_cr.rb +1 -0
  143. data/test/defs/test_defs_cz.rb +1 -0
  144. data/test/defs/test_defs_dk.rb +2 -2
  145. data/test/defs/test_defs_el.rb +7 -6
  146. data/test/defs/test_defs_europe.rb +40 -33
  147. data/test/defs/test_defs_fedex.rb +24 -0
  148. data/test/defs/test_defs_fi.rb +4 -3
  149. data/test/defs/test_defs_hr.rb +2 -2
  150. data/test/defs/test_defs_hu.rb +2 -2
  151. data/test/defs/test_defs_is.rb +2 -1
  152. data/test/defs/test_defs_it.rb +2 -1
  153. data/test/defs/test_defs_jp.rb +1 -1
  154. data/test/defs/test_defs_li.rb +1 -1
  155. data/test/defs/test_defs_ma.rb +2 -1
  156. data/test/defs/test_defs_mx.rb +4 -3
  157. data/test/defs/test_defs_nl.rb +7 -6
  158. data/test/defs/test_defs_no.rb +1 -0
  159. data/test/defs/test_defs_north_america.rb +4 -3
  160. data/test/defs/test_defs_nyse.rb +2 -1
  161. data/test/defs/test_defs_pl.rb +1 -0
  162. data/test/defs/test_defs_ro.rb +11 -11
  163. data/test/defs/test_defs_scandinavia.rb +12 -8
  164. data/test/defs/test_defs_se.rb +3 -2
  165. data/test/defs/test_defs_sg.rb +2 -1
  166. data/test/defs/test_defs_vi.rb +1 -1
  167. data/test/defs/test_defs_za.rb +3 -2
  168. data/test/holidays/date_calculator/test_weekend_modifier.rb +11 -0
  169. data/test/holidays/definition/context/test_generator.rb +64 -5
  170. data/test/holidays/definition/context/test_merger.rb +5 -2
  171. data/test/holidays/definition/decorator/test_custom_method_proc.rb +113 -0
  172. data/test/holidays/definition/decorator/test_custom_method_source.rb +96 -0
  173. data/test/holidays/definition/parser/test_custom_method.rb +79 -0
  174. data/test/holidays/definition/repository/test_custom_methods.rb +43 -0
  175. data/test/holidays/definition/repository/test_holidays_by_month.rb +0 -32
  176. data/test/holidays/definition/repository/test_proc_result_cache.rb +84 -0
  177. data/test/holidays/definition/validator/test_custom_method.rb +89 -0
  178. data/test/holidays/option/context/test_parse_options.rb +5 -0
  179. data/test/holidays/test_definition_factory.rb +17 -2
  180. data/test/holidays/use_case/context/test_between.rb +2 -0
  181. data/test/test_all_regions.rb +7 -49
  182. data/test/test_custom_holidays.rb +8 -2
  183. data/test/test_helper.rb +9 -2
  184. data/test/test_holidays.rb +9 -29
  185. metadata +46 -11
  186. data/lib/generated_definitions/fed_ex.rb +0 -41
  187. data/test/holidays/definition/repository/test_proc_cache.rb +0 -29
  188. data/test/test_parse_definitions.rb +0 -30
@@ -10,7 +10,8 @@ months:
10
10
  0:
11
11
  - name: Viernes Santo
12
12
  regions: [ar]
13
- function: easter(year)-2
13
+ function: easter(year)
14
+ function_modifier: -2
14
15
  1:
15
16
  - name: Año Nuevo
16
17
  regions: [ar]
@@ -5,41 +5,45 @@
5
5
  # - http://de.wikipedia.org/wiki/Feiertage_in_%C3%96sterreich
6
6
  # - http://www.timeanddate.com/calendar/index.html?country=8
7
7
  # - http://www.germany.info/relaunch/welcome/travel/holidays.html
8
- ---
8
+ ---
9
9
  months:
10
- 0:
10
+ 0:
11
11
  - name: Ostermontag
12
12
  regions: [at]
13
- function: easter(year)+1
13
+ function: easter(year)
14
+ function_modifier: 1
14
15
  - name: Christi Himmelfahrt
15
16
  regions: [at]
16
- function: easter(year)+39
17
+ function: easter(year)
18
+ function_modifier: 39
17
19
  - name: Pfingstmontag
18
20
  regions: [at]
19
- function: easter(year)+50
21
+ function: easter(year)
22
+ function_modifier: 50
20
23
  - name: Fronleichnam
21
24
  regions: [at]
22
- function: easter(year)+60
23
- 1:
25
+ function: easter(year)
26
+ function_modifier: 60
27
+ 1:
24
28
  - name: Neujahrstag
25
29
  regions: [at]
26
30
  mday: 1
27
31
  - name: Heilige Drei Könige
28
32
  regions: [at]
29
33
  mday: 6
30
- 5:
34
+ 5:
31
35
  - name: Staatsfeiertag
32
36
  regions: [at]
33
37
  mday: 1
34
- 8:
38
+ 8:
35
39
  - name: Mariä Himmelfahrt
36
40
  regions: [at]
37
41
  mday: 15
38
- 10:
42
+ 10:
39
43
  - name: Nationalfeiertag
40
44
  regions: [at]
41
45
  mday: 26
42
- 11:
46
+ 11:
43
47
  - name: Allerheiligen
44
48
  regions: [at]
45
49
  mday: 1
@@ -54,7 +58,7 @@ months:
54
58
  regions: [at]
55
59
  mday: 26
56
60
  tests: |
57
- {Date.civil(2009,1,1) => 'Neujahrstag',
61
+ {Date.civil(2009,1,1) => 'Neujahrstag',
58
62
  Date.civil(2009,4,13) => 'Ostermontag',
59
63
  Date.civil(2009,5,1) => 'Staatsfeiertag',
60
64
  Date.civil(2009,5,21) => 'Christi Himmelfahrt',
@@ -64,5 +68,5 @@ tests: |
64
68
  Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
65
69
  assert_equal name, (Holidays.on(date, :at, :informal)[0] || {})[:name]
66
70
  end
67
-
71
+
68
72
  assert_equal [], Holidays.on(Date.civil(2010,5,8), :at), '2010-05-08 is not a holiday in Austria'
@@ -1,40 +1,43 @@
1
1
  # Australian holiday definitions for the Ruby Holiday gem.
2
2
  # Updated: 2008-11-29.
3
- # Sources:
3
+ # Sources:
4
4
  # - http://en.wikipedia.org/wiki/Australian_public_holidays
5
5
  # - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
6
6
  # - http://www.wst.tas.gov.au/employment_info/public_holidays
7
7
  # - https://www.fairwork.gov.au/leave/public-holidays/list-of-public-holidays
8
8
  ---
9
9
  months:
10
- 0:
10
+ 0:
11
11
  - name: Good Friday
12
12
  regions: [au]
13
- function: easter(year)-2
13
+ function: easter(year)
14
+ function_modifier: -2
14
15
  - name: Easter Saturday
15
16
  regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa]
16
- function: easter(year)-1
17
+ function: easter(year)
18
+ function_modifier: -1
17
19
  - name: Easter Sunday
18
20
  regions: [au_nsw, au_vic]
19
21
  function: easter(year)
20
22
  - name: Easter Monday
21
23
  regions: [au]
22
- function: easter(year)+1
23
- 1:
24
+ function: easter(year)
25
+ function_modifier: 1
26
+ 1:
24
27
  - name: New Year's Day
25
28
  regions: [au]
26
29
  mday: 1
27
- observed: to_monday_if_weekend
30
+ observed: to_monday_if_weekend(date)
28
31
  - name: Australia Day
29
32
  regions: [au]
30
33
  mday: 26
31
- observed: to_monday_if_weekend
34
+ observed: to_monday_if_weekend(date)
32
35
  2:
33
36
  - name: Royal Hobart Regatta
34
37
  regions: [au_tas_south]
35
38
  week: 2
36
39
  wday: 1
37
- 3:
40
+ 3:
38
41
  - name: Labour Day
39
42
  regions: [au_wa]
40
43
  week: 1
@@ -50,19 +53,19 @@ months:
50
53
  - name: March Public Holiday
51
54
  regions: [au_sa]
52
55
  function: march_pub_hol_sa(year)
53
- 4:
56
+ 4:
54
57
  - name: ANZAC Day
55
58
  regions: [au]
56
59
  mday: 25
57
60
  - name: ANZAC Day
58
61
  regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa, au_tas]
59
62
  mday: 25
60
- observed: to_monday_if_sunday
63
+ observed: to_monday_if_sunday(date)
61
64
  - name: ANZAC Day
62
65
  regions: [au_wa]
63
66
  mday: 25
64
- observed: to_monday_if_weekend
65
- 5:
67
+ observed: to_monday_if_weekend(date)
68
+ 5:
66
69
  - name: Labour Day
67
70
  regions: [au_qld]
68
71
  function: qld_labour_day_may(year)
@@ -73,7 +76,7 @@ months:
73
76
  - name: May Public Holiday
74
77
  regions: [au_sa]
75
78
  function: may_pub_hol_sa(year)
76
- 6:
79
+ 6:
77
80
  - name: Foundation Day
78
81
  regions: [au_wa]
79
82
  week: 1
@@ -119,11 +122,11 @@ months:
119
122
  - name: Labour Day
120
123
  regions: [au_qld]
121
124
  function: qld_labour_day_october(year)
122
- observed: to_monday_if_weekend
125
+ observed: to_monday_if_weekend(date)
123
126
  - name: Queen's Birthday
124
127
  regions: [au_qld]
125
128
  function: qld_queens_bday_october(year)
126
- observed: to_monday_if_weekend
129
+ observed: to_monday_if_weekend(date)
127
130
  - name: Royal Hobart Show
128
131
  regions: [au_tas_south]
129
132
  function: hobart_show_day(year)
@@ -139,108 +142,110 @@ months:
139
142
  regions: [au_vic_melbourne]
140
143
  week: 1
141
144
  wday: 2
142
- 12:
145
+ 12:
143
146
  - name: Christmas Day # CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
144
147
  regions: [au_qld, au_nsw, au_act, au_tas, au_wa]
145
148
  mday: 25
146
- observed: to_tuesday_if_sunday_or_monday_if_saturday
149
+ observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
147
150
  - name: Christmas Day # CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
148
151
  regions: [au_sa]
149
152
  mday: 25
150
- observed: to_monday_if_weekend
153
+ observed: to_monday_if_weekend(date)
151
154
  - name: Christmas Day # CHRISTMAS DAY - Victoria and NT don't observe 25th if weekend - xmas is on the 27th
152
155
  regions: [au_vic, au_nt]
153
156
  function: xmas_to_weekday_if_weekend(year)
154
157
  - name: Boxing Day
155
158
  regions: [au_nsw, au_vic, au_qld, au_act, au_wa]
156
159
  mday: 26
157
- observed: to_tuesday_if_sunday_or_monday_if_saturday
160
+ observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
158
161
  - name: Boxing Day
159
162
  regions: [au_sa]
160
163
  function: to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)
161
164
  - name: Boxing Day
162
165
  regions: [au_tas, au_nt]
163
166
  function: to_weekday_if_boxing_weekend_from_year(year)
167
+
164
168
  methods:
165
- afl_grand_final: |
166
- def self.afl_grand_final(year)
169
+ afl_grand_final:
170
+ arguments: year
171
+ source: |
167
172
  if year == 2015
168
173
  Date.civil(2015, 10, 2)
169
174
  end
170
- end
171
- qld_queens_bday_october: |
175
+ qld_queens_bday_october:
172
176
  # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
173
177
  # celebrated twice in 2012
174
178
  # in october again from 2016
175
- def self.qld_queens_bday_october(year)
179
+ arguments: year
180
+ source: |
176
181
  if year >= 2016
177
- Holidays.calculate_day_of_month(year, 10, 1, 1)
182
+ DateCalculatorFactory.day_of_month_calculator.call(year, 10, 1, 1)
178
183
  elsif year == 2012
179
184
  1
180
185
  else
181
186
  nil
182
187
  end
183
- end
184
- qld_labour_day_may: |
188
+ qld_queens_birthday_june:
189
+ # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
190
+ # in june until 2015
191
+ arguments: year
192
+ source: |
193
+ if year <= 2015
194
+ DateCalculatorFactory.day_of_month_calculator.call(year, 6, 2, 1)
195
+ end
196
+ qld_labour_day_may:
185
197
  # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
186
198
  # for 2013 to 2016 it was in October, otherwise it's in May
187
- def self.qld_labour_day_may(year)
199
+ arguments: year
200
+ source: |
188
201
  if year < 2013 || year >= 2016
189
- Holidays.calculate_day_of_month(year, 5, 1, 1)
202
+ DateCalculatorFactory.day_of_month_calculator.call(year, 5, 1, 1)
190
203
  end
191
- end
192
- qld_labour_day_october: |
204
+ qld_labour_day_october:
193
205
  # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
194
206
  # for 2013 to 2016 it was in October, otherwise it's in May
195
- def self.qld_labour_day_october(year)
207
+ arguments: year
208
+ source: |
196
209
  if year >= 2013 && year < 2016
197
- Holidays.calculate_day_of_month(year, 10, 1, 1)
210
+ DateCalculatorFactory.day_of_month_calculator.call(year, 10, 1, 1)
198
211
  end
199
- end
200
- qld_queens_birthday_june: |
201
- # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
202
- # in june until 2015
203
- def self.qld_queens_birthday_june(year)
204
- if year <= 2015
205
- Holidays.calculate_day_of_month(year, 6, 2, 1)
206
- end
207
- end
208
- g20_day_2014_only: |
212
+ g20_day_2014_only:
209
213
  # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
210
214
  # G20 day in brisbane, in 2014, on november 14
211
- def self.g20_day_2014_only(year)
215
+ arguments: year
216
+ source: |
212
217
  year == 2014 ? 14 : nil
213
- end
214
- hobart_show_day: |
218
+ hobart_show_day:
215
219
  # http://worksafe.tas.gov.au/__data/assets/pdf_file/0008/287036/Public_Holidays_2014.pdf
216
- # The Thursday before the fourth Saturday in October.
217
- def self.hobart_show_day(year)
218
- fourth_sat_in_oct = Date.civil(year, 10, Holidays.calculate_day_of_month(year, 10, 4, :saturday))
220
+ # The Thursday before the fourth Saturday in October.
221
+ arguments: year
222
+ source: |
223
+ fourth_sat_in_oct = Date.civil(year, 10, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 10, 4, :saturday))
219
224
  fourth_sat_in_oct - 2 # the thursday before
220
- end
221
- march_pub_hol_sa: |
225
+ march_pub_hol_sa:
222
226
  # http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
223
227
  # 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.
224
- def self.march_pub_hol_sa(year)
228
+ arguments: year
229
+ source: |
225
230
  if year < 2006
226
231
  nil
227
232
  else
228
233
  Date.civil(year, 3, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 3, :second, :monday))
229
234
  end
230
- end
231
- may_pub_hol_sa: |
235
+ may_pub_hol_sa:
232
236
  # http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
233
237
  # 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.
234
- def self.may_pub_hol_sa(year)
238
+ arguments: year
239
+ source: |
235
240
  if year >= 2006
236
241
  nil
237
242
  else
238
243
  Date.civil(year, 5, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 5, :third, :monday))
239
244
  end
240
- end
245
+
241
246
  tests: |
242
- {Date.civil(2007,1,1) => 'New Year\'s Day',
243
- Date.civil(2007,1,26) => 'Australia Day',
247
+ {Date.civil(2007,1,1) => 'New Year\'s Day',
248
+ Date.civil(2007,1,26) => 'Australia Day',
244
249
  Date.civil(2007,4,6) => 'Good Friday',
245
250
  Date.civil(2007,4,9) => 'Easter Monday',
246
251
  Date.civil(2007,4,25) => 'ANZAC Day'}.each do |date, name|
@@ -367,4 +372,4 @@ tests: |
367
372
  assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_vic)[0][:name]
368
373
  assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_nt)[0][:name]
369
374
  assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_vic)[0][:name]
370
- assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nt)[0][:name]
375
+ assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nt)[0][:name]
@@ -3,29 +3,33 @@
3
3
  # Updated: 2012-06-20.
4
4
  # Sources:
5
5
  # - http://en.wikipedia.org/wiki/Public_holidays_in_Belgium
6
- ---
6
+ ---
7
7
  months:
8
- 0:
8
+ 0:
9
9
  - name: Pâques
10
10
  regions: [be_fr]
11
11
  function: easter(year)
12
12
  - name: Lundi de Pâques
13
13
  regions: [be_fr]
14
- function: easter(year)+1
14
+ function: easter(year)
15
+ function_modifier: 1
15
16
  - name: Ascension
16
17
  regions: [be_fr]
17
- function: easter(year)+39
18
+ function: easter(year)
19
+ function_modifier: 39
18
20
  - name: Pentecôte
19
21
  regions: [be_fr]
20
- function: easter(year)+49
22
+ function: easter(year)
23
+ function_modifier: 49
21
24
  - name: Lundi de Pentecôte
22
25
  regions: [be_fr]
23
- function: easter(year)+50
24
- 1:
26
+ function: easter(year)
27
+ function_modifier: 50
28
+ 1:
25
29
  - name: Jour de l'an
26
30
  regions: [be_fr]
27
31
  mday: 1
28
- 5:
32
+ 5:
29
33
  - name: Fête du travail
30
34
  regions: [be_fr]
31
35
  mday: 1
@@ -33,11 +37,11 @@ months:
33
37
  - name: Fête nationale
34
38
  regions: [be_fr]
35
39
  mday: 21
36
- 8:
40
+ 8:
37
41
  - name: Assomption
38
42
  regions: [be_fr]
39
43
  mday: 15
40
- 11:
44
+ 11:
41
45
  - name: Toussaint
42
46
  regions: [be_fr]
43
47
  mday: 1
@@ -11,16 +11,20 @@ months:
11
11
  function: easter(year)
12
12
  - name: Paasmaandag
13
13
  regions: [be_nl]
14
- function: easter(year)+1
14
+ function: easter(year)
15
+ function_modifier: 1
15
16
  - name: O.H. Hemelvaart
16
17
  regions: [be_nl]
17
- function: easter(year)+39
18
+ function: easter(year)
19
+ function_modifier: 39
18
20
  - name: Pinksteren
19
21
  regions: [be_nl]
20
- function: easter(year)+49
22
+ function: easter(year)
23
+ function_modifier: 49
21
24
  - name: Pinkstermaandag
22
25
  regions: [be_nl]
23
- function: easter(year)+50
26
+ function: easter(year)
27
+ function_modifier: 50
24
28
  1:
25
29
  - name: Nieuwjaar
26
30
  regions: [be_nl]
@@ -7,16 +7,20 @@ months:
7
7
  0:
8
8
  - name: Good Friday
9
9
  regions: [bg_en]
10
- function: orthodox_easter_julian(year)-2
10
+ function: orthodox_easter_julian(year)
11
+ function_modifier: -2
11
12
  - name: Разпети петък
12
13
  regions: [bg_bg]
13
- function: orthodox_easter_julian(year)-2
14
+ function: orthodox_easter_julian(year)
15
+ function_modifier: -2
14
16
  - name: Holy Saturday
15
17
  regions: [bg_en]
16
- function: orthodox_easter_julian(year)-1
18
+ function: orthodox_easter_julian(year)
19
+ function_modifier: -1
17
20
  - name: Велика събота
18
21
  regions: [bg_bg]
19
- function: orthodox_easter_julian(year)-1
22
+ function: orthodox_easter_julian(year)
23
+ function_modifier: -1
20
24
  - name: Easter Sunday
21
25
  regions: [bg_en]
22
26
  function: orthodox_easter_julian(year)
@@ -25,10 +29,12 @@ months:
25
29
  function: orthodox_easter_julian(year)
26
30
  - name: Easter Monday
27
31
  regions: [bg_en]
28
- function: orthodox_easter_julian(year)+1
32
+ function: orthodox_easter_julian(year)
33
+ function_modifier: 1
29
34
  - name: Възкресение Христово. Великден
30
35
  regions: [bg_bg]
31
- function: orthodox_easter_julian(year)+1
36
+ function: orthodox_easter_julian(year)
37
+ function_modifier: 1
32
38
  1:
33
39
  - name: New Year's Day
34
40
  regions: [bg_en]