holidays 9.2.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +38 -2
  4. data/lib/generated_definitions/MANIFEST +1 -3
  5. data/lib/generated_definitions/REGIONS.rb +2 -2
  6. data/lib/generated_definitions/au.rb +16 -42
  7. data/lib/generated_definitions/europe.rb +2 -10
  8. data/lib/generated_definitions/lu.rb +1 -1
  9. data/lib/generated_definitions/nz.rb +9 -1
  10. data/lib/generated_definitions/pl.rb +3 -11
  11. data/lib/generated_definitions/{vi.rb → vn.rb} +8 -8
  12. data/lib/holidays/date_calculator/lunar_date.rb +1 -1
  13. data/lib/holidays/date_calculator/weekend_modifier.rb +8 -0
  14. data/lib/holidays/definition/context/function_processor.rb +4 -5
  15. data/lib/holidays/definition/context/generator.rb +5 -3
  16. data/lib/holidays/definition/validator/region.rb +1 -1
  17. data/lib/holidays/finder/context/parse_options.rb +1 -1
  18. data/lib/holidays/finder/context/year_holiday.rb +1 -1
  19. data/lib/holidays/finder/rules/in_region.rb +1 -1
  20. data/lib/holidays/version.rb +1 -1
  21. metadata +4 -316
  22. data/.github/workflows/changelog-check.yml +0 -47
  23. data/.github/workflows/release.yml +0 -46
  24. data/.github/workflows/ruby.yml +0 -26
  25. data/.gitmodules +0 -3
  26. data/CODE_OF_CONDUCT.md +0 -74
  27. data/Gemfile +0 -8
  28. data/Makefile +0 -60
  29. data/Rakefile +0 -137
  30. data/bin/console +0 -7
  31. data/bin/setup +0 -6
  32. data/doc/CONTRIBUTING.md +0 -72
  33. data/doc/MAINTAINERS.md +0 -79
  34. data/doc/REFERENCES +0 -19
  35. data/holidays.gemspec +0 -31
  36. data/lib/generated_definitions/be.rb +0 -42
  37. data/lib/generated_definitions/el.rb +0 -38
  38. data/test/coverage_report.rb +0 -24
  39. data/test/data/test_custom_year_range_holiday_defs.yaml +0 -31
  40. data/test/data/test_date_transform_conflict_region_1.yaml +0 -14
  41. data/test/data/test_date_transform_conflict_region_2.yaml +0 -14
  42. data/test/data/test_invalid_region.rb +0 -15
  43. data/test/data/test_region.rb +0 -15
  44. data/test/data/test_single_custom_holiday_defs.yaml +0 -12
  45. data/test/data/test_single_custom_holiday_with_custom_procs.yaml +0 -28
  46. data/test/defs/test_defs_ar.rb +0 -69
  47. data/test/defs/test_defs_at.rb +0 -31
  48. data/test/defs/test_defs_au.rb +0 -233
  49. data/test/defs/test_defs_be_fr.rb +0 -45
  50. data/test/defs/test_defs_be_nl.rb +0 -45
  51. data/test/defs/test_defs_bg.rb +0 -41
  52. data/test/defs/test_defs_br.rb +0 -49
  53. data/test/defs/test_defs_ca.rb +0 -289
  54. data/test/defs/test_defs_ch.rb +0 -51
  55. data/test/defs/test_defs_cl.rb +0 -69
  56. data/test/defs/test_defs_co.rb +0 -113
  57. data/test/defs/test_defs_cr.rb +0 -29
  58. data/test/defs/test_defs_cy.rb +0 -41
  59. data/test/defs/test_defs_cz.rb +0 -37
  60. data/test/defs/test_defs_de.rb +0 -91
  61. data/test/defs/test_defs_dk.rb +0 -47
  62. data/test/defs/test_defs_ecbtarget.rb +0 -27
  63. data/test/defs/test_defs_ee.rb +0 -41
  64. data/test/defs/test_defs_es.rb +0 -137
  65. data/test/defs/test_defs_europe.rb +0 -1530
  66. data/test/defs/test_defs_fed_ex.rb +0 -24
  67. data/test/defs/test_defs_federalreserve.rb +0 -119
  68. data/test/defs/test_defs_federalreservebanks.rb +0 -251
  69. data/test/defs/test_defs_fedex.rb +0 -31
  70. data/test/defs/test_defs_fi.rb +0 -59
  71. data/test/defs/test_defs_fr.rb +0 -43
  72. data/test/defs/test_defs_gb.rb +0 -163
  73. data/test/defs/test_defs_ge.rb +0 -53
  74. data/test/defs/test_defs_gr.rb +0 -41
  75. data/test/defs/test_defs_hk.rb +0 -93
  76. data/test/defs/test_defs_hr.rb +0 -45
  77. data/test/defs/test_defs_hu.rb +0 -47
  78. data/test/defs/test_defs_ie.rb +0 -53
  79. data/test/defs/test_defs_il.rb +0 -35
  80. data/test/defs/test_defs_in.rb +0 -94
  81. data/test/defs/test_defs_is.rb +0 -51
  82. data/test/defs/test_defs_it.rb +0 -57
  83. data/test/defs/test_defs_jp.rb +0 -159
  84. data/test/defs/test_defs_ke.rb +0 -31
  85. data/test/defs/test_defs_kr.rb +0 -37
  86. data/test/defs/test_defs_kz.rb +0 -39
  87. data/test/defs/test_defs_li.rb +0 -35
  88. data/test/defs/test_defs_lt.rb +0 -65
  89. data/test/defs/test_defs_lu.rb +0 -35
  90. data/test/defs/test_defs_lv.rb +0 -98
  91. data/test/defs/test_defs_ma.rb +0 -29
  92. data/test/defs/test_defs_mc.rb +0 -43
  93. data/test/defs/test_defs_mt_en.rb +0 -41
  94. data/test/defs/test_defs_mt_mt.rb +0 -41
  95. data/test/defs/test_defs_mx.rb +0 -49
  96. data/test/defs/test_defs_my.rb +0 -23
  97. data/test/defs/test_defs_nerc.rb +0 -29
  98. data/test/defs/test_defs_ng.rb +0 -29
  99. data/test/defs/test_defs_nl.rb +0 -33
  100. data/test/defs/test_defs_no.rb +0 -43
  101. data/test/defs/test_defs_northamerica.rb +0 -679
  102. data/test/defs/test_defs_nyse.rb +0 -46
  103. data/test/defs/test_defs_nz.rb +0 -67
  104. data/test/defs/test_defs_pe.rb +0 -47
  105. data/test/defs/test_defs_ph.rb +0 -29
  106. data/test/defs/test_defs_pl.rb +0 -229
  107. data/test/defs/test_defs_pt.rb +0 -47
  108. data/test/defs/test_defs_ro.rb +0 -69
  109. data/test/defs/test_defs_rs_cyrl.rb +0 -46
  110. data/test/defs/test_defs_rs_la.rb +0 -46
  111. data/test/defs/test_defs_ru.rb +0 -34
  112. data/test/defs/test_defs_scandinavia.rb +0 -215
  113. data/test/defs/test_defs_se.rb +0 -59
  114. data/test/defs/test_defs_sg.rb +0 -25
  115. data/test/defs/test_defs_si.rb +0 -105
  116. data/test/defs/test_defs_sk.rb +0 -37
  117. data/test/defs/test_defs_southamerica.rb +0 -327
  118. data/test/defs/test_defs_th.rb +0 -33
  119. data/test/defs/test_defs_tn.rb +0 -27
  120. data/test/defs/test_defs_tr.rb +0 -60
  121. data/test/defs/test_defs_tsx.rb +0 -70
  122. data/test/defs/test_defs_ua.rb +0 -41
  123. data/test/defs/test_defs_unitednations.rb +0 -11
  124. data/test/defs/test_defs_ups.rb +0 -31
  125. data/test/defs/test_defs_us.rb +0 -399
  126. data/test/defs/test_defs_ve.rb +0 -35
  127. data/test/defs/test_defs_vi.rb +0 -22
  128. data/test/defs/test_defs_za.rb +0 -35
  129. data/test/e2e/README.md +0 -52
  130. data/test/e2e/data/test_multiple_regions_with_conflicts_region_1.yaml +0 -38
  131. data/test/e2e/data/test_multiple_regions_with_conflicts_region_2.yaml +0 -38
  132. data/test/e2e/data/test_multiple_regions_with_conflicts_region_3.yaml +0 -38
  133. data/test/e2e/test_all_regions.rb +0 -49
  134. data/test/e2e/test_any_holidays_during_work_week.rb +0 -90
  135. data/test/e2e/test_holidays.rb +0 -244
  136. data/test/e2e/test_holidays_between.rb +0 -87
  137. data/test/e2e/test_multiple_regions.rb +0 -71
  138. data/test/e2e/test_multiple_regions_with_conflict.rb +0 -228
  139. data/test/e2e/test_nonstandard_regions.rb +0 -25
  140. data/test/holidays/core_extensions/test_date.rb +0 -122
  141. data/test/holidays/core_extensions/test_date_time.rb +0 -60
  142. data/test/holidays/date_calculator/test_day_of_month.rb +0 -27
  143. data/test/holidays/date_calculator/test_easter_gregorian.rb +0 -30
  144. data/test/holidays/date_calculator/test_easter_julian.rb +0 -36
  145. data/test/holidays/date_calculator/test_lunar_date.rb +0 -89
  146. data/test/holidays/date_calculator/test_weekend_modifier.rb +0 -54
  147. data/test/holidays/definition/context/test_function_processor.rb +0 -199
  148. data/test/holidays/definition/context/test_generator.rb +0 -226
  149. data/test/holidays/definition/context/test_load.rb +0 -37
  150. data/test/holidays/definition/context/test_merger.rb +0 -25
  151. data/test/holidays/definition/decorator/test_custom_method_proc.rb +0 -113
  152. data/test/holidays/definition/decorator/test_custom_method_source.rb +0 -96
  153. data/test/holidays/definition/decorator/test_test.rb +0 -123
  154. data/test/holidays/definition/generator/test_module.rb +0 -268
  155. data/test/holidays/definition/generator/test_regions.rb +0 -97
  156. data/test/holidays/definition/generator/test_test.rb +0 -113
  157. data/test/holidays/definition/parser/test_custom_method.rb +0 -79
  158. data/test/holidays/definition/parser/test_test.rb +0 -142
  159. data/test/holidays/definition/repository/test_cache.rb +0 -123
  160. data/test/holidays/definition/repository/test_custom_methods.rb +0 -43
  161. data/test/holidays/definition/repository/test_holidays_by_month.rb +0 -275
  162. data/test/holidays/definition/repository/test_proc_result_cache.rb +0 -91
  163. data/test/holidays/definition/repository/test_regions.rb +0 -104
  164. data/test/holidays/definition/validator/test_custom_method.rb +0 -94
  165. data/test/holidays/definition/validator/test_region.rb +0 -54
  166. data/test/holidays/definition/validator/test_test.rb +0 -60
  167. data/test/holidays/finder/context/test_between.rb +0 -172
  168. data/test/holidays/finder/context/test_dates_driver_builder.rb +0 -91
  169. data/test/holidays/finder/context/test_next_holiday.rb +0 -156
  170. data/test/holidays/finder/context/test_parse_options.rb +0 -141
  171. data/test/holidays/finder/context/test_search.rb +0 -290
  172. data/test/holidays/finder/context/test_year_holiday.rb +0 -202
  173. data/test/holidays/finder/rules/test_in_region.rb +0 -42
  174. data/test/holidays/finder/rules/test_year_range.rb +0 -166
  175. data/test/integration/README.md +0 -48
  176. data/test/integration/data/test_custom_govt_holiday_defs.yaml +0 -5
  177. data/test/integration/data/test_custom_informal_holidays_defs.yaml +0 -11
  178. data/test/integration/data/test_multiple_custom_holiday_defs.yaml +0 -12
  179. data/test/integration/test_custom_holidays.rb +0 -41
  180. data/test/integration/test_custom_informal_holidays.rb +0 -15
  181. data/test/integration/test_custom_year_range_holidays.rb +0 -35
  182. data/test/smoke/README.md +0 -31
  183. data/test/smoke/test_available_regions.rb +0 -18
  184. data/test/smoke/test_smoke.rb +0 -74
  185. data/test/test_helper.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5df9d7c9191d51eb57d3d62573ea4ad0b606d8edf9e0d8f0c8e77ad980c69cc
4
- data.tar.gz: c78ba3585823a7ec2ec21634216c39d8b3eb6170d9209131664c6a0f169ff61b
3
+ metadata.gz: 4a50db0819861773f47fbb4a0d9a4ae915252de055df2469ce1c0bde7d37a841
4
+ data.tar.gz: 7ab200f4615da49c92460f1bc7f6ccda43e4d955fac918425b1d9e78199592e1
5
5
  SHA512:
6
- metadata.gz: 0a2960e5d509413c28be78a5d21e42d06176d2311577604673b5f9465efb8d13c86a05df2d39ed0d51207d1178d23f1c3e3c865b85693720c5f95ef073d487f5
7
- data.tar.gz: f436525c1aa5d8230ef1a88ab29c09addc15e5f68e55fe8ba735b3129bd1296bdc6bd67913cd5e77bbe2efd89f1fd544f3b0a7e725da67dbdd7851916c82b38f
6
+ metadata.gz: b769b76632a24b952c132ccaee4e76dfb7b6f03c84004b19cd4243e6c2fc79c1756d131e6e7d275c36f62943f79a19833cc44e7051b02de3c184312823236cd7
7
+ data.tar.gz: b374d432b537393e8afbe38dfc3fee5c20f70aa35e32c4c46bb2b8b13f9f5c4422662f3d083cf0f2e6a5db6cd457e2d941898a9596387203e6f4eb88a8765cb8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Ruby Holidays Gem CHANGELOG
2
2
 
3
+ ## 11.0.0
4
+
5
+ * Update to [v8.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v8.0.0). Please see the changelog for the definition details.
6
+ * Rename the Vietnam region code from `vi` to `vn` to follow ISO 3166-1 alpha-2 (`VI` is the US Virgin Islands, `VN` is Vietnam) ([definitions #177](https://github.com/holidays/definitions/issues/177)). This is a breaking change: callers must use `:vn` instead of `:vi`.
7
+
8
+ ## 10.0.0
9
+
10
+ * Drop support for Ruby 3.2. Supported versions are now 3.3, 3.4, 4.0, and ruby-head.
11
+ * Update to [v7.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v7.0.0). Please see the changelog for the definition details.
12
+ * Bump tested JRuby from 10.0.4.0 to 10.0.5.0
13
+ * Raise an `ArgumentError` during definition parsing when a `function` or `observed` rule references an unknown method ([#333](https://github.com/holidays/holidays/issues/333))
14
+ * Fix bug ([#352](https://github.com/holidays/holidays/issues/352)) where holidays with the same name and region that differed only by their function modifier were merged into a single entry, dropping one of the dates
15
+ * Document that `tests` stanzas in custom definition files loaded via `load_custom` are not run at runtime ([#304](https://github.com/holidays/holidays/issues/304))
16
+
3
17
  ## 9.2.0
4
18
 
5
19
  * Update to [v6.1.1 definitions](https://github.com/holidays/definitions/releases/tag/v6.1.1). Please see the changelog for the definition details.
data/README.md CHANGED
@@ -4,6 +4,8 @@ Functionality to deal with holidays in Ruby.
4
4
 
5
5
  Extends Ruby's built-in Date and Time classes and supports custom holiday definition lists.
6
6
 
7
+ All holiday definitions are maintained in the [holidays/definitions](https://github.com/holidays/definitions) repository. By default this gem returns statutory (formally government-defined) holidays. Culturally recognized but non-statutory holidays (such as Valentine's Day) are available via the `:informal` option. See the [definitions syntax guide](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md#formalinformal) for details on how holidays are classified.
8
+
7
9
  ## Installation
8
10
 
9
11
  ```
@@ -14,11 +16,10 @@ gem install holidays
14
16
 
15
17
  This gem is tested with the following ruby versions:
16
18
 
17
- * 3.2
18
19
  * 3.3
19
20
  * 3.4
20
21
  * 4.0
21
- * JRuby 10.0.4.0
22
+ * JRuby 10.0.5.0
22
23
 
23
24
  ## Semver
24
25
 
@@ -65,6 +66,35 @@ You can leave off 'regions' to get holidays for any region in our [definitions](
65
66
  ]
66
67
  ```
67
68
 
69
+ #### Wildcard regions
70
+
71
+ A region ending in an underscore (e.g. `:au_`, `:ca_`) is a *wildcard*. It matches the
72
+ parent country region **and all of its sub-regions** in a single call:
73
+
74
+ ```ruby
75
+ Holidays.on(Date.new(2017, 3, 13), :au_)
76
+ => [{:name=>"Eight Hours Day", :regions=>[:au_tas],...},
77
+ {:name=>"Labour Day", :regions=>[:au_vic],...},
78
+ {:name=>"March Public Holiday", :regions=>[:au_sa],...},
79
+ {:name=>"Canberra Day", :regions=>[:au_act],...}]
80
+ ```
81
+
82
+ The same date queried with the plain `:au` region returns nothing, because none of
83
+ those holidays are observed nation-wide:
84
+
85
+ ```ruby
86
+ Holidays.on(Date.new(2017, 3, 13), :au)
87
+ => []
88
+ ```
89
+
90
+ Use a wildcard when you want "this country and every sub-region it defines" without
91
+ listing each sub-region explicitly.
92
+
93
+ Note that a wildcard always collapses to the **top-level** country region. The portion
94
+ between the country prefix and the trailing underscore is ignored, so `:au_vic_` behaves
95
+ identically to `:au_` (it loads every Australian sub-region, not just Victoria's). There
96
+ is currently no way to wildcard-match only the children of a sub-region.
97
+
68
98
  #### Checking a date range
69
99
 
70
100
  Get all holidays during the month of July 2008 in Canada and the US:
@@ -236,6 +266,12 @@ Holidays.load_custom(
236
266
  )
237
267
  ```
238
268
 
269
+ Note that any `tests:` stanzas in a custom definition file are ignored by
270
+ `load_custom`. Tests are only executed at build time for definitions contributed
271
+ to the [definitions repository](https://github.com/holidays/definitions), where
272
+ `rake generate` turns them into the test suite. There is no runtime mechanism to
273
+ run the tests embedded in a custom file loaded on the fly.
274
+
239
275
  ## Extending Ruby's Date and Time classes
240
276
 
241
277
  ### Date
@@ -5,7 +5,6 @@ The following definition files are included in this installation:
5
5
  * generated_definitions/ar
6
6
  * generated_definitions/at
7
7
  * generated_definitions/au
8
- * generated_definitions/be
9
8
  * generated_definitions/be_fr
10
9
  * generated_definitions/be_nl
11
10
  * generated_definitions/bg
@@ -21,7 +20,6 @@ The following definition files are included in this installation:
21
20
  * generated_definitions/dk
22
21
  * generated_definitions/ecbtarget
23
22
  * generated_definitions/ee
24
- * generated_definitions/el
25
23
  * generated_definitions/es
26
24
  * generated_definitions/europe
27
25
  * generated_definitions/federalreserve
@@ -84,5 +82,5 @@ The following definition files are included in this installation:
84
82
  * generated_definitions/ups
85
83
  * generated_definitions/us
86
84
  * generated_definitions/ve
87
- * generated_definitions/vi
85
+ * generated_definitions/vn
88
86
  * generated_definitions/za
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Holidays
3
- REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be_fr, :be_nl, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :us, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cl, :co, :cr, :cy, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :ecbtarget, :ee, :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, :es_ct, :es_v, :es_vc, :federalreserve, :federalreservebanks, :fedex, :fi, :fr_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :im, :gb_iom, :ge, :gr, :hr, :hk, :hu, :ie, :il, :in, :in_wb, :in_od, :in_tr, :in_mh, :in_ar, :in_mz, :in_br, :in_hp, :in_gj, :in_sk, :in_ts, :in_jh, :in_py, :in_kl, :in_ka, :in_jk, :in_ap, :in_cg, :in_hr, :in_mp, :in_pb, :in_nl, :in_as, :in_ga, :is, :it, :it_ve, :it_tv, :it_vr, :it_pd, :it_fi, :it_ge, :it_to, :it_rm, :it_vi, :it_bl, :it_ro, :ke, :kr, :kz, :li, :lt, :lv, :ma, :mc, :mt_mt, :mt_en, :mx, :mx_pue, :nerc, :nl, :lu, :no, :nyse, :nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ne, :nz_ot, :nz_ta, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl, :pe, :ph, :pl, :pt, :pt_li, :pt_po, :ro, :rs_cyrl, :rs_la, :ru, :se, :tn, :tr, :tsx, :ua, :us_fl, :us_al, :us_la, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ga, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_il, :us_mt, :us_nm, :us_ny, :us_oh, :us_mi, :us_mn, :us_nv, :us_or, :us_sd, :us_wa, :us_wi, :us_wy, :us_ia, :us_ks, :us_nh, :us_ok, :unitednations, :ups, :za, :ve, :sk, :si, :jp, :vi, :sg, :my, :th, :ng]
3
+ REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be_fr, :be_nl, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :us, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cl, :co, :cr, :cy, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :ecbtarget, :ee, :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, :es_ct, :es_v, :es_vc, :federalreserve, :federalreservebanks, :fedex, :fi, :fr_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :im, :gb_iom, :ge, :gr, :hr, :hk, :hu, :ie, :il, :in, :in_wb, :in_od, :in_tr, :in_mh, :in_ar, :in_mz, :in_br, :in_hp, :in_gj, :in_sk, :in_ts, :in_jh, :in_py, :in_kl, :in_ka, :in_jk, :in_ap, :in_cg, :in_hr, :in_mp, :in_pb, :in_nl, :in_as, :in_ga, :is, :it, :it_ve, :it_tv, :it_vr, :it_pd, :it_fi, :it_ge, :it_to, :it_rm, :it_vi, :it_bl, :it_ro, :ke, :kr, :kz, :li, :lt, :lv, :ma, :mc, :mt_mt, :mt_en, :mx, :mx_pue, :nerc, :nl, :lu, :no, :nyse, :nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ne, :nz_ot, :nz_ta, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl, :pe, :ph, :pl, :pt, :pt_li, :pt_po, :ro, :rs_cyrl, :rs_la, :ru, :se, :tn, :tr, :tsx, :ua, :us_fl, :us_al, :us_la, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ga, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_il, :us_mt, :us_nm, :us_ny, :us_oh, :us_mi, :us_mn, :us_nv, :us_or, :us_sd, :us_wa, :us_wi, :us_wy, :us_ia, :us_ks, :us_nh, :us_ok, :unitednations, :ups, :za, :ve, :sk, :si, :jp, :vn, :sg, :my, :th, :ng]
4
4
 
5
- PARENT_REGION_LOOKUP = {ar: :ar, at: :at, au: :au, au_nsw: :au, au_vic: :au, au_qld: :au, au_nt: :au, au_act: :au, au_sa: :au, au_wa: :au, au_tas: :au, au_tas_south: :au, au_qld_cairns: :au, au_qld_brisbane: :au, au_tas_north: :au, au_vic_melbourne: :au, be_fr: :be_fr, be_nl: :be_nl, br: :br, bg_en: :bg, bg_bg: :bg, ca: :ca, ca_qc: :ca, ca_ab: :ca, ca_sk: :ca, ca_on: :ca, ca_bc: :ca, ca_nb: :ca, ca_mb: :ca, ca_ns: :ca, ca_pe: :ca, ca_nl: :ca, ca_nt: :ca, ca_nu: :ca, ca_yt: :ca, us: :us, ch_zh: :ch, ch_be: :ch, ch_lu: :ch, ch_ur: :ch, ch_sz: :ch, ch_ow: :ch, ch_nw: :ch, ch_gl: :ch, ch_zg: :ch, ch_fr: :ch, ch_so: :ch, ch_bs: :ch, ch_bl: :ch, ch_sh: :ch, ch_ar: :ch, ch_ai: :ch, ch_sg: :ch, ch_gr: :ch, ch_ag: :ch, ch_tg: :ch, ch_ti: :ch, ch_vd: :ch, ch_ne: :ch, ch_ge: :ch, ch_ju: :ch, ch_vs: :ch, ch: :ch, cl: :cl, co: :co, cr: :cr, cy: :cy, cz: :cz, dk: :dk, de: :de, de_bw: :de, de_by: :de, de_he: :de, de_nw: :de, de_rp: :de, de_sl: :de, de_sn_sorbian: :de, de_th_cath: :de, de_sn: :de, de_st: :de, de_be: :de, de_mv: :de, de_by_cath: :de, de_by_augsburg: :de, de_th: :de, de_bb: :de, de_hb: :de, de_hh: :de, de_ni: :de, de_sh: :de, ecbtarget: :ecbtarget, ee: :ee, es_pv: :es, es_na: :es, es_an: :es, es_ib: :es, es_cm: :es, es_mu: :es, es_m: :es, es_ar: :es, es_cl: :es, es_cn: :es, es_lo: :es, es_ga: :es, es_ce: :es, es_o: :es, es_ex: :es, es: :es, es_ct: :es, es_v: :es, es_vc: :es, federalreserve: :federalreserve, federalreservebanks: :federalreservebanks, fedex: :fedex, fi: :fi, fr_a: :fr, fr_m: :fr, fr: :fr, gb: :gb, gb_eng: :gb, gb_wls: :gb, gb_eaw: :gb, gb_nir: :gb, gb_con: :gb, je: :gb, gb_jsy: :gb, gg: :gb, gb_gsy: :gb, gb_sct: :gb, im: :gb, gb_iom: :gb, ge: :ge, gr: :gr, hr: :hr, hk: :hk, hu: :hu, ie: :ie, il: :il, in: :in, in_wb: :in, in_od: :in, in_tr: :in, in_mh: :in, in_ar: :in, in_mz: :in, in_br: :in, in_hp: :in, in_gj: :in, in_sk: :in, in_ts: :in, in_jh: :in, in_py: :in, in_kl: :in, in_ka: :in, in_jk: :in, in_ap: :in, in_cg: :in, in_hr: :in, in_mp: :in, in_pb: :in, in_nl: :in, in_as: :in, in_ga: :in, is: :is, it: :it, it_ve: :it, it_tv: :it, it_vr: :it, it_pd: :it, it_fi: :it, it_ge: :it, it_to: :it, it_rm: :it, it_vi: :it, it_bl: :it, it_ro: :it, ke: :ke, kr: :kr, kz: :kz, li: :li, lt: :lt, lv: :lv, ma: :ma, mc: :mc, mt_mt: :mt_mt, mt_en: :mt_en, mx: :mx, mx_pue: :mx, nerc: :nerc, nl: :nl, lu: :lu, no: :no, nyse: :nyse, nz: :nz, nz_sl: :nz, nz_we: :nz, nz_ak: :nz, nz_nl: :nz, nz_ne: :nz, nz_ot: :nz, nz_ta: :nz, nz_sc: :nz, nz_hb: :nz, nz_mb: :nz, nz_ca: :nz, nz_ch: :nz, nz_wl: :nz, pe: :pe, ph: :ph, pl: :pl, pt: :pt, pt_li: :pt, pt_po: :pt, ro: :ro, rs_cyrl: :rs_cyrl, rs_la: :rs_la, ru: :ru, se: :se, tn: :tn, tr: :tr, tsx: :tsx, ua: :ua, us_fl: :us, us_al: :us, us_la: :us, us_ct: :us, us_de: :us, us_gu: :us, us_hi: :us, us_in: :us, us_ky: :us, us_nj: :us, us_nc: :us, us_nd: :us, us_pa: :us, us_pr: :us, us_tn: :us, us_ga: :us, us_ms: :us, us_id: :us, us_ar: :us, us_tx: :us, us_dc: :us, us_md: :us, us_va: :us, us_vt: :us, us_ak: :us, us_ca: :us, us_me: :us, us_ma: :us, us_ne: :us, us_mo: :us, us_sc: :us, us_wv: :us, us_vi: :us, us_ut: :us, us_ri: :us, us_az: :us, us_co: :us, us_il: :us, us_mt: :us, us_nm: :us, us_ny: :us, us_oh: :us, us_mi: :us, us_mn: :us, us_nv: :us, us_or: :us, us_sd: :us, us_wa: :us, us_wi: :us, us_wy: :us, us_ia: :us, us_ks: :us, us_nh: :us, us_ok: :us, unitednations: :unitednations, ups: :ups, za: :za, ve: :southamerica, sk: :europe, si: :europe, jp: :jp, vi: :vi, sg: :sg, my: :my, th: :th, ng: :ng}
5
+ PARENT_REGION_LOOKUP = {ar: :ar, at: :at, au: :au, au_nsw: :au, au_vic: :au, au_qld: :au, au_nt: :au, au_act: :au, au_sa: :au, au_wa: :au, au_tas: :au, au_tas_south: :au, au_qld_cairns: :au, au_qld_brisbane: :au, au_tas_north: :au, au_vic_melbourne: :au, be_fr: :be_fr, be_nl: :be_nl, br: :br, bg_en: :bg, bg_bg: :bg, ca: :ca, ca_qc: :ca, ca_ab: :ca, ca_sk: :ca, ca_on: :ca, ca_bc: :ca, ca_nb: :ca, ca_mb: :ca, ca_ns: :ca, ca_pe: :ca, ca_nl: :ca, ca_nt: :ca, ca_nu: :ca, ca_yt: :ca, us: :us, ch_zh: :ch, ch_be: :ch, ch_lu: :ch, ch_ur: :ch, ch_sz: :ch, ch_ow: :ch, ch_nw: :ch, ch_gl: :ch, ch_zg: :ch, ch_fr: :ch, ch_so: :ch, ch_bs: :ch, ch_bl: :ch, ch_sh: :ch, ch_ar: :ch, ch_ai: :ch, ch_sg: :ch, ch_gr: :ch, ch_ag: :ch, ch_tg: :ch, ch_ti: :ch, ch_vd: :ch, ch_ne: :ch, ch_ge: :ch, ch_ju: :ch, ch_vs: :ch, ch: :ch, cl: :cl, co: :co, cr: :cr, cy: :cy, cz: :cz, dk: :dk, de: :de, de_bw: :de, de_by: :de, de_he: :de, de_nw: :de, de_rp: :de, de_sl: :de, de_sn_sorbian: :de, de_th_cath: :de, de_sn: :de, de_st: :de, de_be: :de, de_mv: :de, de_by_cath: :de, de_by_augsburg: :de, de_th: :de, de_bb: :de, de_hb: :de, de_hh: :de, de_ni: :de, de_sh: :de, ecbtarget: :ecbtarget, ee: :ee, es_pv: :es, es_na: :es, es_an: :es, es_ib: :es, es_cm: :es, es_mu: :es, es_m: :es, es_ar: :es, es_cl: :es, es_cn: :es, es_lo: :es, es_ga: :es, es_ce: :es, es_o: :es, es_ex: :es, es: :es, es_ct: :es, es_v: :es, es_vc: :es, federalreserve: :federalreserve, federalreservebanks: :federalreservebanks, fedex: :fedex, fi: :fi, fr_a: :fr, fr_m: :fr, fr: :fr, gb: :gb, gb_eng: :gb, gb_wls: :gb, gb_eaw: :gb, gb_nir: :gb, gb_con: :gb, je: :gb, gb_jsy: :gb, gg: :gb, gb_gsy: :gb, gb_sct: :gb, im: :gb, gb_iom: :gb, ge: :ge, gr: :gr, hr: :hr, hk: :hk, hu: :hu, ie: :ie, il: :il, in: :in, in_wb: :in, in_od: :in, in_tr: :in, in_mh: :in, in_ar: :in, in_mz: :in, in_br: :in, in_hp: :in, in_gj: :in, in_sk: :in, in_ts: :in, in_jh: :in, in_py: :in, in_kl: :in, in_ka: :in, in_jk: :in, in_ap: :in, in_cg: :in, in_hr: :in, in_mp: :in, in_pb: :in, in_nl: :in, in_as: :in, in_ga: :in, is: :is, it: :it, it_ve: :it, it_tv: :it, it_vr: :it, it_pd: :it, it_fi: :it, it_ge: :it, it_to: :it, it_rm: :it, it_vi: :it, it_bl: :it, it_ro: :it, ke: :ke, kr: :kr, kz: :kz, li: :li, lt: :lt, lv: :lv, ma: :ma, mc: :mc, mt_mt: :mt_mt, mt_en: :mt_en, mx: :mx, mx_pue: :mx, nerc: :nerc, nl: :nl, lu: :lu, no: :no, nyse: :nyse, nz: :nz, nz_sl: :nz, nz_we: :nz, nz_ak: :nz, nz_nl: :nz, nz_ne: :nz, nz_ot: :nz, nz_ta: :nz, nz_sc: :nz, nz_hb: :nz, nz_mb: :nz, nz_ca: :nz, nz_ch: :nz, nz_wl: :nz, pe: :pe, ph: :ph, pl: :pl, pt: :pt, pt_li: :pt, pt_po: :pt, ro: :ro, rs_cyrl: :rs_cyrl, rs_la: :rs_la, ru: :ru, se: :se, tn: :tn, tr: :tr, tsx: :tsx, ua: :ua, us_fl: :us, us_al: :us, us_la: :us, us_ct: :us, us_de: :us, us_gu: :us, us_hi: :us, us_in: :us, us_ky: :us, us_nj: :us, us_nc: :us, us_nd: :us, us_pa: :us, us_pr: :us, us_tn: :us, us_ga: :us, us_ms: :us, us_id: :us, us_ar: :us, us_tx: :us, us_dc: :us, us_md: :us, us_va: :us, us_vt: :us, us_ak: :us, us_ca: :us, us_me: :us, us_ma: :us, us_ne: :us, us_mo: :us, us_sc: :us, us_wv: :us, us_vi: :us, us_ut: :us, us_ri: :us, us_az: :us, us_co: :us, us_il: :us, us_mt: :us, us_nm: :us, us_ny: :us, us_oh: :us, us_mi: :us, us_mn: :us, us_nv: :us, us_or: :us, us_sd: :us, us_wa: :us, us_wi: :us, us_wy: :us, us_ia: :us, us_ks: :us, us_nh: :us, us_ok: :us, unitednations: :unitednations, ups: :ups, za: :za, ve: :southamerica, sk: :europe, si: :europe, jp: :jp, vn: :vn, sg: :sg, my: :my, th: :th, ng: :ng}
6
6
  end
@@ -24,19 +24,20 @@ module Holidays
24
24
  3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
25
25
  {:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
26
26
  {:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]},
27
- {:function => "march_pub_hol_sa(year)", :function_arguments => [:year], :name => "March Public Holiday", :regions => [:au_sa]},
27
+ {:function => "march_pub_hol_sa(year)", :function_arguments => [:year], :year_ranges => { :from => 2006 },:name => "March Public Holiday", :regions => [:au_sa]},
28
28
  {:wday => 1, :week => 2, :name => "Canberra Day", :regions => [:au_act]}],
29
29
  4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au, :au_vic]},
30
30
  {:mday => 25, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:au_qld, :au_nt, :au_act, :au_sa]},
31
31
  {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:au_wa]}],
32
- 5 => [{:function => "qld_labour_day_may(year)", :function_arguments => [:year], :name => "Labour Day", :regions => [:au_qld]},
32
+ 5 => [{:function => "qld_labour_day_may(year)", :function_arguments => [:year], :year_ranges => { :until => 2012 },:name => "Labour Day", :regions => [:au_qld]},
33
+ {:function => "qld_labour_day_may(year)", :function_arguments => [:year], :year_ranges => { :from => 2016 },:name => "Labour Day", :regions => [:au_qld]},
33
34
  {:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]},
34
- {:function => "may_pub_hol_sa(year)", :function_arguments => [:year], :name => "May Public Holiday", :regions => [:au_sa]},
35
+ {:function => "may_pub_hol_sa(year)", :function_arguments => [:year], :year_ranges => { :until => 2005 },:name => "May Public Holiday", :regions => [:au_sa]},
35
36
  {:mday => 27, :function => "to_nearest_monday_after(date)", :function_arguments => [:date], :year_ranges => { :from => 2018 },:name => "Reconciliation Day", :regions => [:au_act]}],
36
37
  6 => [{:wday => 1, :week => 1, :name => "Western Australia Day", :regions => [:au_wa]},
37
38
  {:wday => 1, :week => 2, :year_ranges => { :until => 2022 },:name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_vic]},
38
39
  {:wday => 1, :week => 2, :year_ranges => { :from => 2023 },:name => "King's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_vic]},
39
- {:function => "qld_queens_birthday_june(year)", :function_arguments => [:year], :name => "Queen's Birthday", :regions => [:au_qld]},
40
+ {:function => "qld_queens_birthday_june(year)", :function_arguments => [:year], :year_ranges => { :until => 2015 },:name => "Queen's Birthday", :regions => [:au_qld]},
40
41
  {:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
41
42
  7 => [{:wday => 5, :week => 3, :name => "Cairns Show", :regions => [:au_qld_cairns]}],
42
43
  8 => [{:function => "qld_brisbane_ekka_holiday(year)", :function_arguments => [:year], :name => "Ekka", :regions => [:au_qld_brisbane]}],
@@ -46,11 +47,12 @@ module Holidays
46
47
  {:wday => 1, :week => -1, :year_ranges => { :until => 2017 },:name => "Family & Community Day", :regions => [:au_act]}],
47
48
  10 => [{:function => "afl_grand_final(year)", :function_arguments => [:year], :name => "Friday before the AFL Grand Final", :regions => [:au_vic]},
48
49
  {:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]},
49
- {:function => "qld_labour_day_october(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Labour Day", :regions => [:au_qld]},
50
- {:function => "qld_queens_bday_october(year)", :function_arguments => [:year], :year_ranges => { :until => 2022 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Queen's Birthday", :regions => [:au_qld]},
50
+ {:function => "qld_labour_day_october(year)", :function_arguments => [:year], :year_ranges => { :between => 2013..2015 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Labour Day", :regions => [:au_qld]},
51
+ {:mday => 1, :year_ranges => { :limited => [2012] },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Queen's Birthday", :regions => [:au_qld]},
52
+ {:function => "qld_queens_bday_october(year)", :function_arguments => [:year], :year_ranges => { :between => 2016..2022 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Queen's Birthday", :regions => [:au_qld]},
51
53
  {:function => "qld_kings_bday_october(year)", :function_arguments => [:year], :year_ranges => { :from => 2023 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "King's Birthday", :regions => [:au_qld]},
52
54
  {:function => "hobart_show_day(year)", :function_arguments => [:year], :name => "Royal Hobart Show", :regions => [:au_tas_south]}],
53
- 11 => [{:function => "g20_day_2014_only(year)", :function_arguments => [:year], :name => "G20 Day", :regions => [:au_qld_brisbane]},
55
+ 11 => [{:mday => 14, :year_ranges => { :limited => [2014] },:name => "G20 Day", :regions => [:au_qld_brisbane]},
54
56
  {:wday => 1, :week => 1, :name => "Recreation Day", :regions => [:au_tas_north]},
55
57
  {:wday => 2, :week => 1, :name => "Melbourne Cup Day", :regions => [:au_vic_melbourne]}],
56
58
  12 => [{:mday => 25, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_qld, :au_nsw, :au_act, :au_tas, :au_wa, :au_vic, :au_nt]},
@@ -85,43 +87,23 @@ end
85
87
  },
86
88
 
87
89
  "qld_queens_bday_october(year)" => Proc.new { |year|
88
- if year >= 2016
89
- Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
90
- elsif year == 2012
91
- 1
92
- else
93
- nil
94
- end
90
+ Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
95
91
  },
96
92
 
97
93
  "qld_kings_bday_october(year)" => Proc.new { |year|
98
- if year >= 2023
99
- Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
100
- else
101
- nil
102
- end
94
+ Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
103
95
  },
104
96
 
105
97
  "qld_queens_birthday_june(year)" => Proc.new { |year|
106
- if year <= 2015
107
- Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 6, 2, 1)
108
- end
98
+ Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 6, 2, 1)
109
99
  },
110
100
 
111
101
  "qld_labour_day_may(year)" => Proc.new { |year|
112
- if year < 2013 || year >= 2016
113
- Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, 1, 1)
114
- end
102
+ Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, 1, 1)
115
103
  },
116
104
 
117
105
  "qld_labour_day_october(year)" => Proc.new { |year|
118
- if year >= 2013 && year < 2016
119
- Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
120
- end
121
- },
122
-
123
- "g20_day_2014_only(year)" => Proc.new { |year|
124
- year == 2014 ? 14 : nil
106
+ Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
125
107
  },
126
108
 
127
109
  "hobart_show_day(year)" => Proc.new { |year|
@@ -130,19 +112,11 @@ fourth_sat_in_oct - 2 # the thursday before
130
112
  },
131
113
 
132
114
  "march_pub_hol_sa(year)" => Proc.new { |year|
133
- if year < 2006
134
- nil
135
- else
136
- Date.civil(year, 3, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 3, :second, :monday))
137
- end
115
+ Date.civil(year, 3, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 3, :second, :monday))
138
116
  },
139
117
 
140
118
  "may_pub_hol_sa(year)" => Proc.new { |year|
141
- if year >= 2006
142
- nil
143
- else
144
- Date.civil(year, 5, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, :third, :monday))
145
- end
119
+ Date.civil(year, 5, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, :third, :monday))
146
120
  },
147
121
 
148
122
  "qld_brisbane_ekka_holiday(year)" => Proc.new { |year|
@@ -194,8 +194,8 @@ module Holidays
194
194
  {:mday => 1, :name => "Nieuwjaarsdag", :regions => [:nl]},
195
195
  {:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
196
196
  {:mday => 1, :name => "Nowy Rok", :regions => [:pl]},
197
- {:function => "pl_trzech_kroli(year)", :function_arguments => [:year], :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
198
- {:function => "pl_trzech_kroli_informal(year)", :function_arguments => [:year], :type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
197
+ {:mday => 6, :year_ranges => { :from => 2011 },:name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
198
+ {:mday => 6, :year_ranges => { :until => 2010 },:type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
199
199
  {:mday => 21, :type => :informal, :name => "Dzień Babci", :regions => [:pl]},
200
200
  {:mday => 22, :type => :informal, :name => "Dzień Dziadka", :regions => [:pl]},
201
201
  {:mday => 1, :name => "Ano Novo", :regions => [:pt]},
@@ -629,14 +629,6 @@ when 2028
629
629
  end
630
630
  },
631
631
 
632
- "pl_trzech_kroli(year)" => Proc.new { |year|
633
- year >= 2011 ? 6 : nil
634
- },
635
-
636
- "pl_trzech_kroli_informal(year)" => Proc.new { |year|
637
- year < 2011 ? 6 : nil
638
- },
639
-
640
632
 
641
633
  }
642
634
  end
@@ -14,7 +14,7 @@ module Holidays
14
14
  {
15
15
  0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Ouschterméindeg", :regions => [:lu]},
16
16
  {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Christi Himmelfaart", :regions => [:lu]},
17
- {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Péngschtméindeg", :regions => [:lu]}],
17
+ {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Péngschtméindeg", :regions => [:lu]}],
18
18
  1 => [{:mday => 1, :name => "Neijoerschdag", :regions => [:lu]}],
19
19
  5 => [{:mday => 1, :name => "Dag vun der Aarbecht", :regions => [:lu]},
20
20
  {:mday => 9, :year_ranges => { :from => 2019 },:name => "Europadag", :regions => [:lu]}],
@@ -32,7 +32,7 @@ module Holidays
32
32
  10 => [{:wday => 1, :week => 1, :observed => "previous_friday(date)", :observed_arguments => [:date], :name => "Hawke's bay Anniversary Day", :regions => [:nz_hb]},
33
33
  {:wday => 1, :week => 4, :name => "Labour Day", :regions => [:nz]},
34
34
  {:wday => 1, :week => 4, :observed => "next_week(date)", :observed_arguments => [:date], :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}],
35
- 11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
35
+ 11 => [{:function => "nz_canterbury_anniversary(year)", :function_arguments => [:year], :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
36
36
  {:mday => 30, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
37
37
  12 => [{:mday => 1, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Westland Anniversary Day", :regions => [:nz_wl]},
38
38
  {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:nz]},
@@ -61,6 +61,14 @@ date - 3
61
61
  date + 7
62
62
  },
63
63
 
64
+ "nz_canterbury_anniversary(year)" => Proc.new { |year|
65
+ date = Date.civil(year, 11, 1)
66
+ date += 1 until date.tuesday?
67
+ date += 1
68
+ date += 1 until date.friday?
69
+ date + 7
70
+ },
71
+
64
72
  "matariki(year)" => Proc.new { |year|
65
73
  @matariki_dates ||= {
66
74
  '2022' => Date.civil(2022, 6, 24),
@@ -24,8 +24,8 @@ module Holidays
24
24
  {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Zesłanie Ducha Świętego (Zielone Świątki)", :regions => [:pl]},
25
25
  {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)", :regions => [:pl]}],
26
26
  1 => [{:mday => 1, :name => "Nowy Rok", :regions => [:pl]},
27
- {:function => "pl_trzech_kroli(year)", :function_arguments => [:year], :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
28
- {:function => "pl_trzech_kroli_informal(year)", :function_arguments => [:year], :type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
27
+ {:mday => 6, :year_ranges => { :from => 2011 },:name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
28
+ {:mday => 6, :year_ranges => { :until => 2010 },:type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
29
29
  {:mday => 21, :type => :informal, :name => "Dzień Babci", :regions => [:pl]},
30
30
  {:mday => 22, :type => :informal, :name => "Dzień Dziadka", :regions => [:pl]}],
31
31
  2 => [{:mday => 2, :type => :informal, :name => "Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)", :regions => [:pl]},
@@ -58,15 +58,7 @@ module Holidays
58
58
 
59
59
  def self.custom_methods
60
60
  {
61
- "pl_trzech_kroli(year)" => Proc.new { |year|
62
- year >= 2011 ? 6 : nil
63
- },
64
-
65
- "pl_trzech_kroli_informal(year)" => Proc.new { |year|
66
- year < 2011 ? 6 : nil
67
- },
68
-
69
-
61
+
70
62
  }
71
63
  end
72
64
  end
@@ -2,21 +2,21 @@
2
2
  module Holidays
3
3
  # This file is generated by the Ruby Holidays gem.
4
4
  #
5
- # Definitions loaded: definitions/vi.yaml
5
+ # Definitions loaded: definitions/vn.yaml
6
6
  #
7
7
  # All the definitions are available at https://github.com/holidays/holidays
8
- module VI # :nodoc:
8
+ module VN # :nodoc:
9
9
  def self.defined_regions
10
- [:vi]
10
+ [:vn]
11
11
  end
12
12
 
13
13
  def self.holidays_by_month
14
14
  {
15
- 1 => [{:mday => 1, :name => "Tết dương lịch", :regions => [:vi]}],
16
- 3 => [{:mday => 10, :function => "lunar_to_solar(year, month, day, region)", :function_arguments => [:year, :month, :day, :region], :name => "Giỗ tổ Hùng Vương", :regions => [:vi]}],
17
- 4 => [{:mday => 30, :name => "Ngày Giải phóng miền Nam, thống nhất đất nước", :regions => [:vi]}],
18
- 5 => [{:mday => 1, :name => "Ngày Quốc tế Lao động", :regions => [:vi]}],
19
- 9 => [{:mday => 2, :name => "Quốc khánh", :regions => [:vi]}]
15
+ 1 => [{:mday => 1, :name => "Tết dương lịch", :regions => [:vn]}],
16
+ 3 => [{:mday => 10, :function => "lunar_to_solar(year, month, day, region)", :function_arguments => [:year, :month, :day, :region], :name => "Giỗ tổ Hùng Vương", :regions => [:vn]}],
17
+ 4 => [{:mday => 30, :name => "Ngày Giải phóng miền Nam, thống nhất đất nước", :regions => [:vn]}],
18
+ 5 => [{:mday => 1, :name => "Ngày Quốc tế Lao động", :regions => [:vn]}],
19
+ 9 => [{:mday => 2, :name => "Quốc khánh", :regions => [:vn]}]
20
20
  }
21
21
  end
22
22
 
@@ -500,7 +500,7 @@ module Holidays
500
500
  # table and uses it in the calculation
501
501
  CALENDAR_YEAR_INFO_MAP = {
502
502
  kr: KOREAN_LUNAR_YEAR_INFO,
503
- vi: VIETNAMESE_LUNAR_YEAR_INFO,
503
+ vn: VIETNAMESE_LUNAR_YEAR_INFO,
504
504
  hk: CHINESE_LUNAR_YEAR_INFO,
505
505
  }.freeze
506
506
 
@@ -84,6 +84,14 @@ module Holidays
84
84
  date
85
85
  end
86
86
 
87
+ def to_the_weekday_after(date)
88
+ to_monday_if_sunday(to_monday_if_sunday(date) + 1)
89
+ end
90
+
91
+ def to_the_second_weekday_after(date)
92
+ to_monday_if_sunday(to_the_weekday_after(date) + 1)
93
+ end
94
+
87
95
  def to_previous_day_if_leap_year(date)
88
96
  date -= 1 if ::Date.gregorian_leap?(date.year)
89
97
  date
@@ -74,11 +74,10 @@ module Holidays
74
74
  raise Holidays::InvalidFunctionResponse.new("invalid day response from custom method call resulting in invalid date. Result: '#{result}'")
75
75
  end
76
76
  elsif result.nil?
77
- # Do nothing. This is because some functions can return 'nil' today.
78
- # I want to change this and so rather than come up with a clean
79
- # implementation I'll do this so we don't throw an error in this specific
80
- # situation. This should be removed once we have changed the existing
81
- # custom definition functions. See https://github.com/holidays/holidays/issues/204
77
+ # nil is a valid return value meaning the calculation determined that no
78
+ # holiday exists on this date. For example, jp_substitute_holiday returns
79
+ # nil when the original holiday does not fall on a Sunday (no substitute
80
+ # needed), and us_inauguration_day returns nil when year % 4 != 1.
82
81
  else
83
82
  raise Holidays::InvalidFunctionResponse.new("invalid response from custom method call, must be a 'date' or 'integer' representing the day. Result: '#{result}'")
84
83
  end
@@ -105,12 +105,12 @@ module Holidays
105
105
  rule[:year_ranges][:between] = Range.new(start_year, end_year)
106
106
  end
107
107
 
108
- rule[:regions] = rule[:regions].collect { |r| r.to_sym }
108
+ rule[:regions] = rule[:regions].collect(&:to_sym)
109
109
  regions << rule[:regions]
110
110
 
111
111
  exists = false
112
112
  rules_by_month[month].each do |ex|
113
- if ex[:name] == rule[:name] and ex[:wday] == rule[:wday] and ex[:mday] == rule[:mday] and ex[:week] == rule[:week] and ex[:type] == rule[:type] and ex[:function] == rule[:function] and ex[:observed] == rule[:observed] and ex[:year_ranges] == rule[:year_ranges]
113
+ if ex[:name] == rule[:name] and ex[:wday] == rule[:wday] and ex[:mday] == rule[:mday] and ex[:week] == rule[:week] and ex[:type] == rule[:type] and ex[:function] == rule[:function] and ex[:function_modifier] == rule[:function_modifier] and ex[:observed] == rule[:observed] and ex[:year_ranges] == rule[:year_ranges]
114
114
  ex[:regions] << rule[:regions].flatten
115
115
  exists = true
116
116
  end
@@ -200,7 +200,9 @@ module Holidays
200
200
  if method = @custom_methods_repository.find(function_id)
201
201
  method.parameters.collect { |arg| arg[1] }
202
202
  elsif method = parsed_custom_methods[function_id]
203
- method.arguments.collect { |arg| arg.to_sym }
203
+ method.arguments.collect(&:to_sym)
204
+ else
205
+ raise ArgumentError, "Unknown function '#{function_id}'. It must either be a built-in method or be defined in the 'methods' section of a definition file."
204
206
  end
205
207
  end
206
208
  end
@@ -22,7 +22,7 @@ module Holidays
22
22
  def find_wildcard_base(region)
23
23
  r = region.to_s
24
24
 
25
- if r =~ /_$/
25
+ if /_$/.match?(r)
26
26
  base = r.split('_').first
27
27
  else
28
28
  base = r
@@ -35,7 +35,7 @@ module Holidays
35
35
  if regions.empty?
36
36
  regions = [:any]
37
37
  else
38
- regions = regions.collect { |r| r.to_sym }
38
+ regions = regions.collect(&:to_sym)
39
39
  end
40
40
 
41
41
  validate!(regions)
@@ -34,7 +34,7 @@ module Holidays
34
34
  end
35
35
  end
36
36
 
37
- holidays.sort{|a, b| a[:date] <=> b[:date] }
37
+ holidays.sort_by { |a| a[:date] }
38
38
  end
39
39
 
40
40
  private
@@ -9,7 +9,7 @@ module Holidays
9
9
  # When an underscore is encountered, derive the parent regions
10
10
  # symbol and check for both.
11
11
  requested = requested.collect do |r|
12
- if r.to_s =~ /_/
12
+ if r.to_s.include?('_')
13
13
  chunks = r.to_s.split('_')
14
14
 
15
15
  chunks.length.downto(1).map do |num|
@@ -1,3 +1,3 @@
1
1
  module Holidays
2
- VERSION = '9.2.0'
2
+ VERSION = '11.0.0'
3
3
  end