holidays 4.2.0 → 8.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (330) hide show
  1. checksums.yaml +5 -5
  2. data/.gitmodules +3 -0
  3. data/CHANGELOG.md +195 -0
  4. data/Makefile +45 -0
  5. data/README.md +253 -77
  6. data/Rakefile +10 -11
  7. data/bin/console +0 -0
  8. data/bin/setup +1 -0
  9. data/doc/CONTRIBUTING.md +72 -0
  10. data/doc/MAINTAINERS.md +81 -0
  11. data/{REFERENCES → doc/REFERENCES} +0 -0
  12. data/holidays.gemspec +9 -9
  13. data/lib/generated_definitions/MANIFEST +26 -4
  14. data/lib/generated_definitions/REGIONS.rb +3 -1
  15. data/lib/generated_definitions/ar.rb +4 -10
  16. data/lib/generated_definitions/at.rb +3 -9
  17. data/lib/generated_definitions/au.rb +32 -25
  18. data/lib/generated_definitions/be_fr.rb +2 -8
  19. data/lib/generated_definitions/be_nl.rb +2 -8
  20. data/lib/generated_definitions/bg.rb +2 -8
  21. data/lib/generated_definitions/br.rb +2 -8
  22. data/lib/generated_definitions/ca.rb +33 -32
  23. data/lib/generated_definitions/ch.rb +17 -11
  24. data/lib/generated_definitions/cl.rb +38 -12
  25. data/lib/generated_definitions/co.rb +121 -0
  26. data/lib/generated_definitions/cr.rb +2 -8
  27. data/lib/generated_definitions/cz.rb +2 -8
  28. data/lib/generated_definitions/de.rb +11 -14
  29. data/lib/generated_definitions/dk.rb +2 -8
  30. data/lib/generated_definitions/{ecb_target.rb → ecbtarget.rb} +10 -16
  31. data/lib/generated_definitions/ee.rb +36 -0
  32. data/lib/generated_definitions/el.rb +2 -8
  33. data/lib/generated_definitions/es.rb +8 -11
  34. data/lib/generated_definitions/europe.rb +121 -51
  35. data/lib/generated_definitions/federalreserve.rb +34 -0
  36. data/lib/generated_definitions/{federal_reserve.rb → federalreservebanks.rb} +14 -20
  37. data/lib/generated_definitions/fedex.rb +3 -9
  38. data/lib/generated_definitions/fi.rb +2 -8
  39. data/lib/generated_definitions/fr.rb +6 -10
  40. data/lib/generated_definitions/gb.rb +12 -16
  41. data/lib/generated_definitions/ge.rb +41 -0
  42. data/lib/generated_definitions/hk.rb +106 -0
  43. data/lib/generated_definitions/hr.rb +10 -14
  44. data/lib/generated_definitions/hu.rb +4 -9
  45. data/lib/generated_definitions/ie.rb +3 -17
  46. data/lib/generated_definitions/is.rb +3 -9
  47. data/lib/generated_definitions/it.rb +16 -13
  48. data/lib/generated_definitions/jp.rb +47 -36
  49. data/lib/generated_definitions/kr.rb +40 -0
  50. data/lib/generated_definitions/kz.rb +38 -0
  51. data/lib/generated_definitions/li.rb +2 -8
  52. data/lib/generated_definitions/lt.rb +2 -8
  53. data/lib/generated_definitions/lu.rb +35 -0
  54. data/lib/generated_definitions/lv.rb +52 -0
  55. data/lib/generated_definitions/ma.rb +2 -8
  56. data/lib/generated_definitions/mt_en.rb +38 -0
  57. data/lib/generated_definitions/mt_mt.rb +38 -0
  58. data/lib/generated_definitions/mx.rb +6 -12
  59. data/lib/generated_definitions/my.rb +30 -0
  60. data/lib/generated_definitions/nerc.rb +2 -8
  61. data/lib/generated_definitions/ng.rb +33 -0
  62. data/lib/generated_definitions/nl.rb +2 -8
  63. data/lib/generated_definitions/no.rb +2 -8
  64. data/lib/generated_definitions/northamerica.rb +223 -0
  65. data/lib/generated_definitions/nyse.rb +3 -9
  66. data/lib/generated_definitions/nz.rb +2 -9
  67. data/lib/generated_definitions/pe.rb +43 -0
  68. data/lib/generated_definitions/ph.rb +4 -10
  69. data/lib/generated_definitions/pl.rb +2 -8
  70. data/lib/generated_definitions/pt.rb +12 -12
  71. data/lib/generated_definitions/ro.rb +6 -9
  72. data/lib/generated_definitions/rs_cyrl.rb +39 -0
  73. data/lib/generated_definitions/rs_la.rb +39 -0
  74. data/lib/generated_definitions/ru.rb +37 -0
  75. data/lib/generated_definitions/scandinavia.rb +3 -9
  76. data/lib/generated_definitions/se.rb +2 -8
  77. data/lib/generated_definitions/sg.rb +2 -8
  78. data/lib/generated_definitions/si.rb +2 -8
  79. data/lib/generated_definitions/sk.rb +2 -8
  80. data/lib/generated_definitions/southamerica.rb +228 -0
  81. data/lib/generated_definitions/th.rb +36 -0
  82. data/lib/generated_definitions/tn.rb +32 -0
  83. data/lib/generated_definitions/tr.rb +64 -0
  84. data/lib/generated_definitions/ua.rb +37 -0
  85. data/lib/generated_definitions/{united_nations.rb → unitednations.rb} +61 -67
  86. data/lib/generated_definitions/ups.rb +3 -9
  87. data/lib/generated_definitions/us.rb +113 -23
  88. data/lib/generated_definitions/ve.rb +2 -8
  89. data/lib/generated_definitions/vi.rb +6 -11
  90. data/lib/generated_definitions/za.rb +2 -8
  91. data/lib/holidays/core_extensions/date.rb +21 -3
  92. data/lib/holidays/core_extensions/time.rb +23 -0
  93. data/lib/holidays/date_calculator/day_of_month.rb +3 -3
  94. data/lib/holidays/date_calculator/lunar_date.rb +371 -0
  95. data/lib/holidays/date_calculator/weekend_modifier.rb +0 -7
  96. data/lib/holidays/definition/context/function_processor.rb +91 -0
  97. data/lib/holidays/definition/context/generator.rb +37 -96
  98. data/lib/holidays/definition/context/load.rb +29 -0
  99. data/lib/holidays/definition/context/merger.rb +0 -4
  100. data/lib/holidays/definition/decorator/test.rb +37 -0
  101. data/lib/holidays/definition/entity/test.rb +11 -0
  102. data/lib/holidays/definition/generator/module.rb +54 -0
  103. data/lib/holidays/definition/generator/regions.rb +55 -0
  104. data/lib/holidays/definition/generator/test.rb +51 -0
  105. data/lib/holidays/definition/parser/custom_method.rb +3 -5
  106. data/lib/holidays/definition/parser/test.rb +86 -0
  107. data/lib/holidays/definition/repository/cache.rb +23 -9
  108. data/lib/holidays/definition/repository/holidays_by_month.rb +10 -2
  109. data/lib/holidays/definition/repository/proc_result_cache.rb +1 -1
  110. data/lib/holidays/definition/repository/regions.rb +23 -13
  111. data/lib/holidays/definition/validator/custom_method.rb +1 -1
  112. data/lib/holidays/definition/validator/region.rb +2 -11
  113. data/lib/holidays/definition/validator/test.rb +71 -0
  114. data/lib/holidays/errors.rb +5 -0
  115. data/lib/holidays/factory/date_calculator.rb +42 -0
  116. data/lib/holidays/factory/definition.rb +143 -0
  117. data/lib/holidays/factory/finder.rb +70 -0
  118. data/lib/holidays/finder/context/between.rb +45 -0
  119. data/lib/holidays/{use_case → finder}/context/dates_driver_builder.rb +11 -15
  120. data/lib/holidays/finder/context/next_holiday.rb +57 -0
  121. data/lib/holidays/finder/context/parse_options.rb +104 -0
  122. data/lib/holidays/finder/context/search.rb +110 -0
  123. data/lib/holidays/finder/context/year_holiday.rb +57 -0
  124. data/lib/holidays/finder/rules/in_region.rb +31 -0
  125. data/lib/holidays/finder/rules/year_range.rb +58 -0
  126. data/lib/holidays/load_all_definitions.rb +16 -17
  127. data/lib/holidays/version.rb +1 -1
  128. data/lib/holidays.rb +50 -125
  129. data/test/coverage_report.rb +26 -0
  130. data/test/data/test_custom_informal_holidays_defs.yaml +11 -0
  131. data/test/data/test_custom_year_range_holiday_defs.yaml +13 -10
  132. data/test/data/test_invalid_region.rb +15 -0
  133. data/test/data/test_multiple_custom_holiday_defs.yaml +7 -4
  134. data/test/data/test_multiple_regions_with_conflicts_region_1.yaml +38 -0
  135. data/test/data/test_multiple_regions_with_conflicts_region_2.yaml +38 -0
  136. data/test/data/test_region.rb +15 -0
  137. data/test/data/test_single_custom_holiday_defs.yaml +7 -4
  138. data/test/data/test_single_custom_holiday_with_custom_procs.yaml +11 -7
  139. data/test/defs/test_defs_ar.rb +41 -19
  140. data/test/defs/test_defs_at.rb +18 -11
  141. data/test/defs/test_defs_au.rb +185 -126
  142. data/test/defs/test_defs_be_fr.rb +33 -14
  143. data/test/defs/test_defs_be_nl.rb +33 -14
  144. data/test/defs/test_defs_bg.rb +29 -17
  145. data/test/defs/test_defs_br.rb +33 -19
  146. data/test/defs/test_defs_ca.rb +246 -136
  147. data/test/defs/test_defs_ch.rb +35 -23
  148. data/test/defs/test_defs_cl.rb +57 -27
  149. data/test/defs/test_defs_co.rb +113 -0
  150. data/test/defs/test_defs_cr.rb +17 -11
  151. data/test/defs/test_defs_cz.rb +25 -15
  152. data/test/defs/test_defs_de.rb +60 -59
  153. data/test/defs/test_defs_dk.rb +31 -19
  154. data/test/defs/test_defs_ecbtarget.rb +27 -0
  155. data/test/defs/test_defs_ee.rb +41 -0
  156. data/test/defs/test_defs_el.rb +29 -17
  157. data/test/defs/test_defs_es.rb +116 -52
  158. data/test/defs/test_defs_europe.rb +1382 -701
  159. data/test/defs/test_defs_federalreserve.rb +113 -0
  160. data/test/defs/test_defs_federalreservebanks.rb +247 -0
  161. data/test/defs/test_defs_fedex.rb +19 -12
  162. data/test/defs/test_defs_fi.rb +47 -27
  163. data/test/defs/test_defs_fr.rb +31 -18
  164. data/test/defs/test_defs_gb.rb +120 -51
  165. data/test/defs/test_defs_ge.rb +53 -0
  166. data/test/defs/test_defs_hk.rb +59 -0
  167. data/test/defs/test_defs_hr.rb +32 -18
  168. data/test/defs/test_defs_hu.rb +34 -16
  169. data/test/defs/test_defs_ie.rb +41 -25
  170. data/test/defs/test_defs_is.rb +39 -22
  171. data/test/defs/test_defs_it.rb +43 -14
  172. data/test/defs/test_defs_jp.rb +141 -55
  173. data/test/defs/test_defs_kr.rb +37 -0
  174. data/test/defs/test_defs_kz.rb +39 -0
  175. data/test/defs/test_defs_li.rb +20 -20
  176. data/test/defs/test_defs_lt.rb +51 -30
  177. data/test/defs/test_defs_lu.rb +35 -0
  178. data/test/defs/test_defs_lv.rb +90 -0
  179. data/test/defs/test_defs_ma.rb +17 -11
  180. data/test/defs/test_defs_mt_en.rb +41 -0
  181. data/test/defs/test_defs_mt_mt.rb +41 -0
  182. data/test/defs/test_defs_mx.rb +34 -23
  183. data/test/defs/test_defs_my.rb +23 -0
  184. data/test/defs/test_defs_nerc.rb +17 -11
  185. data/test/defs/test_defs_ng.rb +29 -0
  186. data/test/defs/test_defs_nl.rb +21 -13
  187. data/test/defs/test_defs_no.rb +31 -18
  188. data/test/defs/test_defs_northamerica.rb +644 -0
  189. data/test/defs/test_defs_nyse.rb +27 -11
  190. data/test/defs/test_defs_nz.rb +47 -28
  191. data/test/defs/test_defs_pe.rb +47 -0
  192. data/test/defs/test_defs_ph.rb +17 -13
  193. data/test/defs/test_defs_pl.rb +200 -119
  194. data/test/defs/test_defs_pt.rb +35 -15
  195. data/test/defs/test_defs_ro.rb +53 -24
  196. data/test/defs/test_defs_rs_cyrl.rb +46 -0
  197. data/test/defs/test_defs_rs_la.rb +46 -0
  198. data/test/defs/test_defs_ru.rb +34 -0
  199. data/test/defs/test_defs_scandinavia.rb +193 -116
  200. data/test/defs/test_defs_se.rb +47 -28
  201. data/test/defs/test_defs_sg.rb +13 -9
  202. data/test/defs/test_defs_si.rb +93 -24
  203. data/test/defs/test_defs_sk.rb +29 -17
  204. data/test/defs/test_defs_southamerica.rb +307 -0
  205. data/test/defs/test_defs_th.rb +33 -0
  206. data/test/defs/test_defs_tn.rb +27 -0
  207. data/test/defs/test_defs_tr.rb +60 -0
  208. data/test/defs/test_defs_ua.rb +41 -0
  209. data/test/defs/{test_defs_united_nations.rb → test_defs_unitednations.rb} +3 -4
  210. data/test/defs/test_defs_ups.rb +19 -12
  211. data/test/defs/test_defs_us.rb +370 -30
  212. data/test/defs/test_defs_ve.rb +23 -16
  213. data/test/defs/test_defs_vi.rb +10 -6
  214. data/test/defs/test_defs_za.rb +23 -14
  215. data/test/holidays/core_extensions/test_date.rb +3 -2
  216. data/test/holidays/core_extensions/test_date_time.rb +60 -0
  217. data/test/holidays/date_calculator/test_lunar_date.rb +89 -0
  218. data/test/holidays/definition/context/test_function_processor.rb +199 -0
  219. data/test/holidays/definition/context/test_generator.rb +66 -35
  220. data/test/holidays/definition/context/test_load.rb +37 -0
  221. data/test/holidays/definition/decorator/test_test.rb +123 -0
  222. data/test/holidays/definition/generator/test_module.rb +268 -0
  223. data/test/holidays/definition/generator/test_regions.rb +97 -0
  224. data/test/holidays/definition/generator/test_test.rb +113 -0
  225. data/test/holidays/definition/parser/test_custom_method.rb +6 -6
  226. data/test/holidays/definition/parser/test_test.rb +142 -0
  227. data/test/holidays/definition/repository/test_cache.rb +47 -6
  228. data/test/holidays/definition/repository/test_holidays_by_month.rb +121 -1
  229. data/test/holidays/definition/repository/test_proc_result_cache.rb +8 -1
  230. data/test/holidays/definition/repository/test_regions.rb +31 -13
  231. data/test/holidays/definition/validator/test_custom_method.rb +5 -0
  232. data/test/holidays/definition/validator/test_region.rb +16 -12
  233. data/test/holidays/definition/validator/test_test.rb +60 -0
  234. data/test/holidays/finder/context/test_between.rb +172 -0
  235. data/test/holidays/{use_case → finder}/context/test_dates_driver_builder.rb +2 -2
  236. data/test/holidays/finder/context/test_next_holiday.rb +156 -0
  237. data/test/holidays/finder/context/test_parse_options.rb +141 -0
  238. data/test/holidays/finder/context/test_search.rb +232 -0
  239. data/test/holidays/finder/context/test_year_holiday.rb +202 -0
  240. data/test/holidays/finder/rules/test_in_region.rb +42 -0
  241. data/test/holidays/finder/rules/test_year_range.rb +166 -0
  242. data/test/integration/README.md +9 -0
  243. data/test/{test_all_regions.rb → integration/test_all_regions.rb} +18 -4
  244. data/test/integration/test_any_holidays_during_work_week.rb +90 -0
  245. data/test/integration/test_available_regions.rb +23 -0
  246. data/test/{test_custom_holidays.rb → integration/test_custom_holidays.rb} +6 -6
  247. data/test/integration/test_custom_informal_holidays.rb +15 -0
  248. data/test/{test_custom_year_range_holidays.rb → integration/test_custom_year_range_holidays.rb} +1 -9
  249. data/test/{test_holidays.rb → integration/test_holidays.rb} +100 -69
  250. data/test/{test_holidays_between.rb → integration/test_holidays_between.rb} +19 -17
  251. data/test/integration/test_multiple_regions.rb +71 -0
  252. data/test/integration/test_multiple_regions_with_conflict.rb +29 -0
  253. data/test/integration/test_nonstandard_regions.rb +25 -0
  254. data/test/test_helper.rb +7 -3
  255. metadata +204 -132
  256. data/CONTRIBUTING.md +0 -41
  257. data/benchmark.rb +0 -8
  258. data/definitions/README.md +0 -353
  259. data/definitions/ar.yaml +0 -93
  260. data/definitions/at.yaml +0 -72
  261. data/definitions/au.yaml +0 -375
  262. data/definitions/be_fr.yaml +0 -69
  263. data/definitions/be_nl.yaml +0 -69
  264. data/definitions/bg.yaml +0 -127
  265. data/definitions/br.yaml +0 -77
  266. data/definitions/ca.yaml +0 -302
  267. data/definitions/ch.yaml +0 -193
  268. data/definitions/cl.yaml +0 -94
  269. data/definitions/cr.yaml +0 -65
  270. data/definitions/cz.yaml +0 -73
  271. data/definitions/de.yaml +0 -209
  272. data/definitions/dk.yaml +0 -130
  273. data/definitions/ecb_target.yaml +0 -44
  274. data/definitions/el.yaml +0 -84
  275. data/definitions/es.yaml +0 -203
  276. data/definitions/federal_reserve.yaml +0 -114
  277. data/definitions/fedex.yaml +0 -62
  278. data/definitions/fi.yaml +0 -115
  279. data/definitions/fr.yaml +0 -79
  280. data/definitions/gb.yaml +0 -151
  281. data/definitions/hr.yaml +0 -79
  282. data/definitions/hu.yaml +0 -63
  283. data/definitions/ie.yaml +0 -89
  284. data/definitions/index.yaml +0 -57
  285. data/definitions/is.yaml +0 -146
  286. data/definitions/it.yaml +0 -67
  287. data/definitions/jp.yaml +0 -316
  288. data/definitions/li.yaml +0 -107
  289. data/definitions/lt.yaml +0 -89
  290. data/definitions/ma.yaml +0 -52
  291. data/definitions/mx.yaml +0 -106
  292. data/definitions/nerc.yaml +0 -51
  293. data/definitions/nl.yaml +0 -73
  294. data/definitions/no.yaml +0 -90
  295. data/definitions/north_america_informal.yaml +0 -61
  296. data/definitions/nyse.yaml +0 -64
  297. data/definitions/nz.yaml +0 -163
  298. data/definitions/ph.yaml +0 -94
  299. data/definitions/pl.yaml +0 -320
  300. data/definitions/pt.yaml +0 -69
  301. data/definitions/ro.yaml +0 -78
  302. data/definitions/se.yaml +0 -120
  303. data/definitions/sg.yaml +0 -56
  304. data/definitions/si.yaml +0 -86
  305. data/definitions/sk.yaml +0 -80
  306. data/definitions/united_nations.yaml +0 -189
  307. data/definitions/ups.yaml +0 -62
  308. data/definitions/us.yaml +0 -103
  309. data/definitions/ve.yaml +0 -74
  310. data/definitions/vi.yaml +0 -29
  311. data/definitions/za.yaml +0 -80
  312. data/lib/generated_definitions/north_america.rb +0 -126
  313. data/lib/holidays/date_calculator_factory.rb +0 -35
  314. data/lib/holidays/definition_factory.rb +0 -86
  315. data/lib/holidays/option/context/parse_options.rb +0 -106
  316. data/lib/holidays/option_factory.rb +0 -15
  317. data/lib/holidays/use_case/context/between.rb +0 -45
  318. data/lib/holidays/use_case/context/context_common.rb +0 -123
  319. data/lib/holidays/use_case/context/next_holiday.rb +0 -54
  320. data/lib/holidays/use_case_factory.rb +0 -31
  321. data/test/defs/test_defs_ecb_target.rb +0 -23
  322. data/test/defs/test_defs_federal_reserve.rb +0 -69
  323. data/test/defs/test_defs_north_america.rb +0 -195
  324. data/test/holidays/option/context/test_parse_options.rb +0 -74
  325. data/test/holidays/test_date_calculator_factory.rb +0 -27
  326. data/test/holidays/test_definition_factory.rb +0 -49
  327. data/test/holidays/test_option_factory.rb +0 -9
  328. data/test/holidays/test_use_case_factory.rb +0 -13
  329. data/test/holidays/use_case/context/test_between.rb +0 -77
  330. data/test/test_multiple_regions.rb +0 -24
@@ -1,51 +0,0 @@
1
- # NERC holiday definitions for the Ruby Holiday gem.
2
- #
3
- # By Adam Strickland
4
- # Source: www.nerc.com/docs/oc/rs/Additional_Off-peak_Days.doc
5
- #
6
- # Updated 2013-01-03.
7
- ---
8
- months:
9
- 1:
10
- - name: New Year's Day
11
- regions: [nerc]
12
- mday: 1
13
- observed: to_monday_if_sunday(date)
14
- 5:
15
- - name: Memorial Day
16
- week: -1
17
- regions: [nerc]
18
- wday: 1
19
- 7:
20
- - name: Independence Day
21
- regions: [nerc]
22
- mday: 4
23
- observed: to_monday_if_sunday(date)
24
- 9:
25
- - name: Labor Day
26
- week: 1
27
- regions: [nerc]
28
- wday: 1
29
- 11:
30
- - name: Thanksgiving
31
- week: 4
32
- regions: [nerc]
33
- wday: 4
34
- 12:
35
- - name: Christmas Day
36
- regions: [nerc]
37
- mday: 25
38
- observed: to_monday_if_sunday(date)
39
- methods:
40
- tests: |
41
- {Date.civil(2013,1,1) => 'New Year\'s Day',
42
- Date.civil(2017,1,2) => 'New Year\'s Day',
43
- Date.civil(2013,5,27) => 'Memorial Day',
44
- Date.civil(2013,7,4) => 'Independence Day',
45
- Date.civil(2010,7,5) => 'Independence Day',
46
- Date.civil(2013,9,2) => 'Labor Day',
47
- Date.civil(2013,11,28) => 'Thanksgiving',
48
- Date.civil(2013,12,25) => 'Christmas Day',
49
- Date.civil(2011,12,26) => 'Christmas Day'}.each do |date, name|
50
- assert_equal name, (Holidays.on(date, :nerc, :observed)[0] || {})[:name]
51
- end
data/definitions/nl.yaml DELETED
@@ -1,73 +0,0 @@
1
- # Dutch holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2014-04-17.
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Public_holidays_in_the_Netherlands
6
- ---
7
- months:
8
- 0:
9
- - name: Goede Vrijdag
10
- regions: [nl]
11
- function: easter(year)
12
- function_modifier: -2
13
- type: informal
14
- - name: Eerste Paasdag
15
- regions: [nl]
16
- function: easter(year)
17
- - name: Tweede Paasdag
18
- regions: [nl]
19
- function: easter(year)
20
- function_modifier: 1
21
- - name: Hemelvaartsdag
22
- regions: [nl]
23
- function: easter(year)
24
- function_modifier: 39
25
- - name: Eerste Pinksterdag
26
- regions: [nl]
27
- function: easter(year)
28
- function_modifier: 49
29
- - name: Tweede Pinksterdag
30
- regions: [nl]
31
- function: easter(year)
32
- function_modifier: 50
33
- 1:
34
- - name: Nieuwjaarsdag
35
- regions: [nl]
36
- mday: 1
37
- 4:
38
- - name: Koningsdag
39
- regions: [nl]
40
- mday: 27
41
- 5:
42
- - name: Dodenherdenking
43
- regions: [nl]
44
- mday: 4
45
- type: informal
46
- - name: Bevrijdingsdag
47
- regions: [nl]
48
- mday: 5
49
- 12:
50
- - name: Sinterklaas
51
- regions: [nl]
52
- mday: 5
53
- type: informal
54
- - name: Eerste Kerstdag
55
- regions: [nl]
56
- mday: 25
57
- - name: Tweede Kerstdag
58
- regions: [nl]
59
- mday: 26
60
- tests: |
61
- {Date.civil(2008,1,1) => 'Nieuwjaarsdag',
62
- Date.civil(2008,3,21) => 'Goede Vrijdag',
63
- Date.civil(2008,3,23) => 'Eerste Paasdag',
64
- Date.civil(2008,3,24) => 'Tweede Paasdag',
65
- Date.civil(2008,4,27) => 'Koningsdag',
66
- Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
67
- Date.civil(2008,5,5) => 'Bevrijdingsdag',
68
- Date.civil(2008,5,11) => 'Eerste Pinksterdag', # Pentecost, Easter+49
69
- Date.civil(2008,5,12) => 'Tweede Pinksterdag', # Pentecost, Easter+50
70
- Date.civil(2008,12,25) => 'Eerste Kerstdag',
71
- Date.civil(2008,12,26) => 'Tweede Kerstdag'}.each do |date, name|
72
- assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
73
- end
data/definitions/no.yaml DELETED
@@ -1,90 +0,0 @@
1
- # Norwegian holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Added: 20010-02-22.
4
- # Sources:
5
- # - http://no.wikipedia.org/wiki/Offentlig_fridag
6
- # - http://www.timeanddate.com/norsk/kalender.html
7
- ---
8
- months:
9
- 0:
10
- - name: Fastelavn
11
- regions: ["no"]
12
- function: easter(year)
13
- function_modifier: -49
14
- type: informal
15
- - name: Palmesøndag
16
- regions: ["no"]
17
- function: easter(year)
18
- function_modifier: -7
19
- - name: Skjærtorsdag
20
- regions: ["no"]
21
- function: easter(year)
22
- function_modifier: -3
23
- - name: Langfredag
24
- regions: ["no"]
25
- function: easter(year)
26
- function_modifier: -2
27
- - name: 1. påskedag
28
- regions: ["no"]
29
- function: easter(year)
30
- - name: 2. påskedag
31
- regions: ["no"]
32
- function: easter(year)
33
- function_modifier: 1
34
- - name: Kristi Himmelfartsdag
35
- regions: ["no"]
36
- function: easter(year)
37
- function_modifier: 39
38
- - name: 1. pinsedag
39
- regions: ["no"]
40
- function: easter(year)
41
- function_modifier: 49
42
- - name: 2. pinsedag
43
- regions: ["no"]
44
- function: easter(year)
45
- function_modifier: 50
46
- 1:
47
- - name: Nyttårsdag
48
- regions: ["no"]
49
- mday: 1
50
- 5:
51
- - name: 1. mai
52
- regions: ["no"]
53
- mday: 1
54
- - name: 17. mai
55
- regions: ["no"]
56
- mday: 17
57
- 12:
58
- - name: Julaften
59
- regions: ["no"]
60
- mday: 24
61
- type: informal
62
- - name: 1. juledag
63
- regions: ["no"]
64
- mday: 25
65
- - name: 2. juledag
66
- regions: ["no"]
67
- mday: 26
68
- - name: Nyttårsaften
69
- regions: ["no"]
70
- mday: 31
71
- type: informal
72
- tests: |
73
- {Date.civil(2010,1,1) => 'Nyttårsdag',
74
- Date.civil(2010,5,1) => '1. mai',
75
- Date.civil(2010,5,17) => '17. mai',
76
- Date.civil(2010,12,24) => 'Julaften',
77
- Date.civil(2010,12,25) => '1. juledag',
78
- Date.civil(2010,12,26) => '2. juledag',
79
- Date.civil(2010,12,31) => 'Nyttårsaften',
80
- Date.civil(2010,2,14) => 'Fastelavn',
81
- Date.civil(2010,3,28) => 'Palmesøndag',
82
- Date.civil(2010,4,1) => 'Skjærtorsdag',
83
- Date.civil(2010,4,2) => 'Langfredag',
84
- Date.civil(2010,4,4) => '1. påskedag',
85
- Date.civil(2010,4,5) => '2. påskedag',
86
- Date.civil(2010,5,13) => 'Kristi Himmelfartsdag',
87
- Date.civil(2010,5,23) => '1. pinsedag',
88
- Date.civil(2010,5,24) => '2. pinsedag'}.each do |date, name|
89
- assert_equal name, (Holidays.on(date, :no, :informal)[0] || {})[:name]
90
- end
@@ -1,61 +0,0 @@
1
- # Informal North American holiday definitions for the Ruby Holiday gem.
2
- # Updated 2008-11-22.
3
- ---
4
- months:
5
- 2:
6
- - name: Groundhog Day
7
- regions: [us, ca]
8
- mday: 2
9
- type: informal
10
- - name: Valentine's Day
11
- regions: [us, ca]
12
- mday: 14
13
- type: informal
14
- 3:
15
- - name: St. Patrick's Day
16
- regions: [us, ca]
17
- mday: 17
18
- type: informal
19
- 4:
20
- - name: April Fool's Day
21
- regions: [us, ca]
22
- mday: 1
23
- type: informal
24
- - name: Earth Day
25
- regions: [us, ca]
26
- mday: 22
27
- type: informal
28
- 5:
29
- - name: Mother's Day
30
- week: 2
31
- regions: [us, ca]
32
- wday: 0
33
- type: informal
34
- - name: Armed Forces Day
35
- week: 3
36
- regions: [us]
37
- wday: 6
38
- type: informal
39
- 6:
40
- - name: Father's Day
41
- week: 3
42
- regions: [us, ca]
43
- wday: 0
44
- type: informal
45
- 10:
46
- - name: Halloween
47
- regions: [us, ca]
48
- mday: 31
49
- type: informal
50
- tests: |
51
- {Date.civil(2013,2,2) => 'Groundhog Day',
52
- Date.civil(2013,2,14) => 'Valentine\'s Day',
53
- Date.civil(2013,3,17) => 'St. Patrick\'s Day',
54
- Date.civil(2013,4,1) => 'April Fool\'s Day',
55
- Date.civil(2013,4,22) => 'Earth Day',
56
- Date.civil(2013,5,12) => 'Mother\'s Day',
57
- Date.civil(2013,5,18) => 'Armed Forces Day',
58
- Date.civil(2013,6,16) => 'Father\'s Day',
59
- Date.civil(2013,10,31) => 'Halloween'}.each do |date, name|
60
- assert_equal name, (Holidays.on(date, :us, :informal)[0] || {})[:name]
61
- end
@@ -1,64 +0,0 @@
1
- # NYSE holiday definitions for the Ruby Holiday gem.
2
- #
3
- # By Alan Larkin
4
- # Source: http://www.nyse.com/about/newsevents/1176373643795.html#earlyclose2008
5
- #
6
- # Updated 2008-11-19.
7
- ---
8
- months:
9
- 0:
10
- - name: Good Friday
11
- regions: [nyse]
12
- function: easter(year)
13
- function_modifier: -2
14
- 1:
15
- - name: New Year's Day
16
- regions: [nyse]
17
- mday: 1
18
- - name: Martin Luther King, Jr. Day
19
- week: 3
20
- regions: [nyse]
21
- wday: 1
22
- 2:
23
- - name: Presidents' Day
24
- week: 3
25
- regions: [nyse]
26
- wday: 1
27
- 5:
28
- - name: Memorial Day
29
- week: -1
30
- regions: [nyse]
31
- wday: 1
32
- 7:
33
- - name: Independence Day
34
- regions: [nyse]
35
- mday: 4
36
- observed: to_weekday_if_weekend(date)
37
- 9:
38
- - name: Labor Day
39
- week: 1
40
- regions: [nyse]
41
- wday: 1
42
- 11:
43
- - name: Thanksgiving
44
- week: 4
45
- regions: [nyse]
46
- wday: 4
47
- 12:
48
- - name: Christmas Day
49
- regions: [nyse]
50
- mday: 25
51
- observed: to_weekday_if_weekend(date)
52
- methods:
53
- tests: |
54
- {Date.civil(2008,1,1) => 'New Year\'s Day',
55
- Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
56
- Date.civil(2008,2,18) => 'Presidents\' Day',
57
- Date.civil(2008,3,21) => 'Good Friday',
58
- Date.civil(2008,5,26) => 'Memorial Day',
59
- Date.civil(2008,7,4) => 'Independence Day',
60
- Date.civil(2008,9,1) => 'Labor Day',
61
- Date.civil(2008,11,27) => 'Thanksgiving',
62
- Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
63
- assert_equal name, (Holidays.on(date, :nyse)[0] || {})[:name]
64
- end
data/definitions/nz.yaml DELETED
@@ -1,163 +0,0 @@
1
- # New Zealand holiday definitions for the Ruby Holiday gem.
2
- # Updated: 2010-03-28.
3
- # Sources:
4
- # - http://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand
5
- ---
6
- months:
7
- 0:
8
- - name: Good Friday
9
- regions: [nz]
10
- function: easter(year)
11
- function_modifier: -2
12
- - name: Easter Saturday
13
- regions: [nz]
14
- function: easter(year)
15
- function_modifier: -1
16
- - name: Easter Monday
17
- regions: [nz]
18
- function: easter(year)
19
- function_modifier: 1
20
- 1:
21
- - name: New Year's Day
22
- regions: [nz]
23
- mday: 1
24
- observed: to_monday_if_weekend(date)
25
- - name: Day after New Year's Day
26
- regions: [nz]
27
- mday: 2
28
- observed: to_weekday_if_boxing_weekend(date)
29
- - name: Southland Anniversary Day
30
- regions: [nz_sl]
31
- mday: 17
32
- - name: Wellington Anniversary Day
33
- regions: [nz_we]
34
- mday: 22
35
- observed: closest_monday(date)
36
- - name: Auckland Anniversary Day
37
- regions: [nz_ak]
38
- mday: 29
39
- observed: closest_monday(date)
40
- - name: Northland Anniversary Day
41
- regions: [nz_nl]
42
- mday: 29
43
- observed: closest_monday(date)
44
- 2:
45
- - name: Nelson Anniversary Day
46
- regions: [nz_ne]
47
- mday: 1
48
- observed: closest_monday(date)
49
- - name: Waitangi Day
50
- regions: [nz]
51
- mday: 6
52
- observed: to_monday_if_weekend(date)
53
- 3:
54
- - name: Otago Anniversary Day
55
- regions: [nz_ot]
56
- mday: 23
57
- observed: closest_monday(date)
58
- - name: Taranaki Anniversary Day
59
- regions: [nz_ta]
60
- week: 2
61
- wday: 1
62
- observed: closest_monday(date)
63
- 4:
64
- - name: ANZAC Day
65
- regions: [nz]
66
- mday: 25
67
- observed: to_monday_if_weekend(date)
68
- 6:
69
- - name: Queen's Birthday
70
- regions: [nz]
71
- week: 1
72
- wday: 1
73
- 9:
74
- - name: Dominion Day
75
- regions: [nz_sc]
76
- week: 4
77
- wday: 1
78
- 10:
79
- - name: Hawke's bay Anniversary Day
80
- regions: [nz_hb]
81
- week: 1
82
- wday: 1
83
- observed: previous_friday(date)
84
- - name: Labour Day
85
- regions: [nz]
86
- week: 4
87
- wday: 1
88
- - name: Marlborough Anniversary Day
89
- regions: [nz_mb]
90
- week: 4
91
- wday: 1
92
- observed: next_week(date)
93
- 11:
94
- - name: Canterbury Anniversary Day
95
- regions: [nz_ca]
96
- week: 2
97
- wday: 5
98
- - name: Chatham Island Anniversary Day
99
- regions: [nz_ch]
100
- mday: 30
101
- observed: closest_monday(date)
102
- 12:
103
- - name: Westland Anniversary Day
104
- regions: [nz_wl]
105
- mday: 1
106
- observed: closest_monday(date)
107
- - name: Christmas Day
108
- regions: [nz]
109
- mday: 25
110
- observed: to_monday_if_weekend(date)
111
- - name: Boxing Day
112
- regions: [nz]
113
- mday: 26
114
- observed: to_weekday_if_boxing_weekend(date)
115
- tests: |
116
- {Date.civil(2007,1,1) => 'New Year\'s Day',
117
- Date.civil(2007,1,2) => 'Day after New Year\'s Day',
118
- Date.civil(2007,2,6) => 'Waitangi Day',
119
- Date.civil(2007,4,6) => 'Good Friday',
120
- Date.civil(2007,4,9) => 'Easter Monday',
121
- Date.civil(2007,4,25) => 'ANZAC Day',
122
- Date.civil(2007,12,25) => 'Christmas Day',
123
- Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
124
- assert_equal name, (Holidays.on(date, :nz, :informal)[0] || {})[:name]
125
- end
126
- assert_equal 'ANZAC Day', Holidays.on(Date.civil(2015, 4, 25), :nz)[0][:name]
127
- assert_equal 'ANZAC Day', Holidays.on(Date.civil(2015, 4, 27), :nz, :observed)[0][:name]
128
- assert_equal 'ANZAC Day', Holidays.on(Date.civil(2016, 4, 25), :nz)[0][:name]
129
- assert_equal 'ANZAC Day', Holidays.on(Date.civil(2016, 4, 25), :nz, :observed)[0][:name]
130
- assert_equal 'Waitangi Day', Holidays.on(Date.civil(2015, 2, 6), :nz)[0][:name]
131
- assert_equal 'Waitangi Day', Holidays.on(Date.civil(2015, 2, 6), :nz, :observed)[0][:name]
132
- assert_equal 'Waitangi Day', Holidays.on(Date.civil(2016, 2, 6), :nz)[0][:name]
133
- assert_equal 'Waitangi Day', Holidays.on(Date.civil(2016, 2, 8), :nz, :observed)[0][:name]
134
-
135
- assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2016, 2, 1), :nz_ne, :observed)[0][:name]
136
- assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2017, 1, 30), :nz_ne, :observed)[0][:name]
137
- assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2018, 1, 29), :nz_ne, :observed)[0][:name]
138
- assert_equal 'Nelson Anniversary Day', Holidays.on(Date.civil(2019, 2, 4), :nz_ne, :observed)[0][:name]
139
-
140
- assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2016, 3, 14), :nz_ta, :observed)[0][:name]
141
- assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2017, 3, 13), :nz_ta, :observed)[0][:name]
142
- assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2018, 3, 12), :nz_ta, :observed)[0][:name]
143
- assert_equal 'Taranaki Anniversary Day', Holidays.on(Date.civil(2019, 3, 11), :nz_ta, :observed)[0][:name]
144
- methods:
145
- closest_monday:
146
- arguments: date
147
- source: |
148
- if [1, 2, 3, 4].include?(date.wday)
149
- date -= (date.wday - 1)
150
- elsif 0 == date.wday
151
- date += 1
152
- else
153
- date += 8 - date.wday
154
- end
155
- date
156
- previous_friday:
157
- arguments: date
158
- source: |
159
- date - 3
160
- next_week:
161
- arguments: date
162
- source: |
163
- date + 7
data/definitions/ph.yaml DELETED
@@ -1,94 +0,0 @@
1
- # Philippines holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2015-03-25 by itsmechlark
4
- # Sources:
5
- # - http://www.gov.ph/2014/07/23/list-of-nationwide-holidays-for-2015/
6
- # - http://www.timeanddate.com/holidays/philippines/
7
- ---
8
- months:
9
- 0:
10
- - name: Maundy Thursday
11
- regions: [ph]
12
- function: easter(year)
13
- function_modifier: -3
14
- - name: Good Friday
15
- regions: [ph]
16
- function: easter(year)
17
- function_modifier: -2
18
- - name: Holy Saturday
19
- regions: [ph]
20
- function: easter(year)
21
- function_modifier: -1
22
- - name: Easter Sunday
23
- regions: [ph]
24
- function: easter(year)
25
- 1:
26
- - name: New Year’s Day
27
- regions: [ph]
28
- mday: 1
29
- 2:
30
- - name: People Power Anniversary
31
- regions: [ph]
32
- mday: 25
33
- 4:
34
- - name: The Day of Valor
35
- regions: [ph]
36
- mday: 9
37
- 5:
38
- - name: Labor Day
39
- regions: [ph]
40
- mday: 1
41
- 6:
42
- - name: Independence Day
43
- regions: [ph]
44
- mday: 12
45
- 8:
46
- - name: Ninoy Aquino Day
47
- regions: [ph]
48
- mday: 21
49
- - name: National Heroes Day
50
- regions: [ph]
51
- function: ph_heroes_day(year)
52
- 11:
53
- - name: All Saints Day
54
- regions: [ph]
55
- mday: 1
56
- - name: Bonifacio Day
57
- regions: [ph]
58
- mday: 30
59
- 12:
60
- - name: Christmas Day
61
- regions: [ph]
62
- mday: 25
63
- - name: Rizal Day
64
- regions: [ph]
65
- mday: 30
66
- - name: New Year's Eve
67
- regions: [ph]
68
- mday: 31
69
- methods:
70
- ph_heroes_day:
71
- # last Monday of August
72
- arguments: year
73
- source: |
74
- date = Date.new(year, 8, -1)
75
-
76
- if date.wday != 1
77
- date -= date.wday - 1
78
- end
79
-
80
- date
81
- tests: |
82
- {Date.civil(2015,2,25) => 'People Power Anniversary',
83
- Date.civil(2015,4,3) => 'Good Friday',
84
- Date.civil(2015,4,9) => 'The Day of Valor',
85
- Date.civil(2015,5,1) => 'Labor Day',
86
- Date.civil(2015,6,12) => 'Independence Day',
87
- Date.civil(2015,8,21) => 'Ninoy Aquino Day',
88
- Date.civil(2015,8,31) => 'National Heroes Day',
89
- Date.civil(2015,11,1) => 'All Saints Day',
90
- Date.civil(2015,11,30) => 'Bonifacio Day',
91
- Date.civil(2015,12,25) => 'Christmas Day',
92
- Date.civil(2015,12,30) => 'Rizal Day'}.each do |date, name|
93
- assert_equal name, (Holidays.on(date, :ph)[0] || {})[:name]
94
- end