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
data/definitions/es.yaml DELETED
@@ -1,203 +0,0 @@
1
- # Spanish holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Including the Balearic Islands and the Canary Islands.
4
- #
5
- # Updated: 2008-11-29.
6
- #
7
- # Sources:
8
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Spain
9
- # - http://www.timeanddate.com/calendar/index.html?country=16
10
- #
11
- # Notes:
12
- # - Valencia is encoded as both es_v and es_vc
13
- months:
14
- 0:
15
- - name: Jueves Santo
16
- regions: [es_pv, es_na, es_an, es_ib, es_cm, es_mu, es_m, es_ar, es_cl, es_cn, es_lo, es_ga, es_ce, es_o, es_ex]
17
- function: easter(year)
18
- function_modifier: -3
19
- - name: Viernes Santo
20
- regions: [es]
21
- function: easter(year)
22
- function_modifier: -2
23
- - name: Lunes de Pascua
24
- regions: [es_pv, es_ct, es_na, es_v, es_vc]
25
- function: easter(year)
26
- function_modifier: 1
27
- 1:
28
- - name: Año Nuevo
29
- regions: [es]
30
- mday: 1
31
- observed: to_monday_if_sunday(date)
32
- - name: Día de Reyes
33
- regions: [es]
34
- mday: 6
35
- observed: to_monday_if_sunday(date)
36
- 2:
37
- - name: Día de Andalucía
38
- regions: [es_an]
39
- mday: 28
40
- observed: to_monday_if_sunday(date)
41
- 3:
42
- - name: Día de las Islas Baleares
43
- regions: [es_ib]
44
- mday: 1
45
- observed: to_monday_if_sunday(date)
46
- - name: San José
47
- regions: [es_v, es_vc, es_cm, es_mu, es_m]
48
- mday: 19
49
- observed: to_monday_if_sunday(date)
50
- 4:
51
- - name: Día de Castilla y León
52
- regions: [es_cl]
53
- mday: 23
54
- observed: to_monday_if_sunday(date)
55
- - name: San Jorge, Día de Aragón
56
- regions: [es_ar]
57
- mday: 23
58
- observed: to_monday_if_sunday(date)
59
- 5:
60
- - name: Día del Trabajador
61
- regions: [es]
62
- mday: 1
63
- observed: to_monday_if_sunday(date)
64
- - name: Fiesta de la Comunidad
65
- regions: [es_m]
66
- mday: 2
67
- observed: to_monday_if_sunday(date)
68
- - name: Día de las Canarias
69
- regions: [es_cn]
70
- mday: 30
71
- observed: to_monday_if_sunday(date)
72
- - name: Día de la Región Castilla-La Mancha
73
- regions: [es_cm]
74
- mday: 31
75
- observed: to_monday_if_sunday(date)
76
- 6:
77
- - name: Día de la Región de Murcia
78
- regions: [es_mu]
79
- mday: 9
80
- observed: to_monday_if_sunday(date)
81
- - name: Día de La Rioja
82
- regions: [es_lo]
83
- mday: 9
84
- observed: to_monday_if_sunday(date)
85
- 7:
86
- - name: Santiago Apostol
87
- regions: [es_ga]
88
- mday: 23
89
- observed: to_monday_if_sunday(date)
90
- 8:
91
- - name: Asunción
92
- regions: [es]
93
- mday: 15
94
- observed: to_monday_if_sunday(date)
95
- 9:
96
- - name: Día de Ceuta
97
- regions: [es_ce]
98
- mday: 2
99
- observed: to_monday_if_sunday(date)
100
- - name: Día de Asturias
101
- regions: [es_o]
102
- mday: 8
103
- observed: to_monday_if_sunday(date)
104
- - name: Día de Extremadura
105
- regions: [es_ex]
106
- mday: 8
107
- - name: Fiesta Nacional de Cataluña
108
- regions: [es_ct]
109
- mday: 11
110
- observed: to_monday_if_sunday(date)
111
- 10:
112
- - name: Día de Valencia
113
- regions: [es_vc, es_v]
114
- mday: 9
115
- observed: to_monday_if_sunday(date)
116
- - name: Día de la Hispanidad
117
- regions: [es]
118
- mday: 12
119
- observed: to_monday_if_sunday(date)
120
- 11:
121
- - name: Todos los Santos
122
- regions: [es]
123
- mday: 1
124
- observed: to_monday_if_sunday(date)
125
- 12:
126
- - name: Día de la Constitución
127
- regions: [es]
128
- mday: 6
129
- observed: to_monday_if_sunday(date)
130
- - name: Inmaculada Concepción
131
- regions: [es]
132
- mday: 8
133
- observed: to_monday_if_sunday(date)
134
- - name: Navidad del Señor
135
- regions: [es]
136
- mday: 25
137
- observed: to_monday_if_sunday(date)
138
- - name: San Esteban
139
- regions: [es_ib, es_ct]
140
- mday: 26
141
- observed: to_monday_if_sunday(date)
142
- tests: |
143
- {Date.civil(2009,1,1) => 'Año Nuevo',
144
- Date.civil(2009,1,6) => 'Día de Reyes',
145
- Date.civil(2009,4,10) => 'Viernes Santo',
146
- Date.civil(2009,5,1) => 'Día del Trabajador',
147
- Date.civil(2009,8,15) => 'Asunción',
148
- Date.civil(2009,10,12) => 'Día de la Hispanidad',
149
- Date.civil(2009,11,1) => 'Todos los Santos',
150
- Date.civil(2009,12,6) => 'Día de la Constitución',
151
- Date.civil(2009,12,8) => 'Inmaculada Concepción',
152
- Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
153
- assert_equal name, (Holidays.on(date, :es, :informal)[0] || {})[:name]
154
- end
155
-
156
- [:es_pv, :es_na, :es_an, :es_ib, :es_cm, :es_mu, :es_m, :es_ar, :es_cl, :es_cn, :es_lo, :es_ga, :es_ce, :es_o, :es_ex, :es_].each do |r|
157
- assert_equal 'Jueves Santo', Holidays.on(Date.civil(2009,4,9), r)[0][:name]
158
- end
159
- [:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
160
- assert_equal 'Lunes de Pascua', Holidays.on(Date.civil(2009,4,13), r)[0][:name]
161
- end
162
-
163
- assert_equal 'Jueves Santo', Holidays.on(Date.civil(2009,4,9), :es_an)[0][:name]
164
-
165
- [:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
166
- assert_equal 'San José', Holidays.on(Date.civil(2009,3,19), r)[0][:name]
167
- end
168
-
169
- [:es_cl].each do |r|
170
- assert_equal 'Día de Castilla y León', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
171
- end
172
-
173
- [:es_ar].each do |r|
174
- assert_equal 'San Jorge, Día de Aragón', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
175
- end
176
-
177
- [:es_].each do |r|
178
- assert_equal 'Día de Castilla y León', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
179
- assert_equal 'San Jorge, Día de Aragón', Holidays.on(Date.civil(2009,4,23), r)[1][:name]
180
- end
181
-
182
- [:es_vc, :es_v, :es_].each do |r|
183
- assert_equal 'Día de Valencia', Holidays.on(Date.civil(2009,10,9), r)[0][:name]
184
- end
185
-
186
- [:es_ib, :es_ct, :es_].each do |r|
187
- assert_equal 'San Esteban', Holidays.on(Date.civil(2009,12,26), r)[0][:name]
188
- end
189
-
190
- assert_equal 'Año Nuevo', Holidays.on(Date.civil(2012,1,1), :es)[0][:name]
191
- assert_equal 'Año Nuevo', Holidays.on(Date.civil(2012,1,2), :es, :observed)[0][:name]
192
- assert_equal 'Día de Andalucía', Holidays.on(Date.civil(2009,2,28), :es_an)[0][:name]
193
- assert_equal 'Día de las Islas Baleares', Holidays.on(Date.civil(2009,3,1), :es_ib)[0][:name]
194
- assert_equal 'Fiesta de la Comunidad', Holidays.on(Date.civil(2006,5,2), :es_m)[0][:name]
195
- assert_equal 'Día de las Canarias', Holidays.on(Date.civil(2006,5,30), :es_cn)[0][:name]
196
- assert_equal 'Día de la Región Castilla-La Mancha', Holidays.on(Date.civil(2009,5,31), :es_cm)[0][:name]
197
- assert_equal 'Día de la Región de Murcia', Holidays.on(Date.civil(2009,6,9), :es_mu)[0][:name]
198
- assert_equal 'Día de La Rioja', Holidays.on(Date.civil(2009,6,9), :es_lo)[0][:name]
199
- assert_equal 'Santiago Apostol', Holidays.on(Date.civil(2009,7,23), :es_ga)[0][:name]
200
- assert_equal 'Día de Ceuta', Holidays.on(Date.civil(2009,9,2), :es_ce)[0][:name]
201
- assert_equal 'Día de Asturias', Holidays.on(Date.civil(2009,9,8), :es_o)[0][:name]
202
- assert_equal 'Día de Extremadura', Holidays.on(Date.civil(2009,9,8), :es_ex)[0][:name]
203
- assert_equal 'Fiesta Nacional de Cataluña', Holidays.on(Date.civil(2009,9,11), :es_ct)[0][:name]
@@ -1,114 +0,0 @@
1
- # Federal reserve holidays definition for the Ruby Holiday gem.
2
- #
3
- # Updated: 2015-03-16
4
- #
5
- # Sources:
6
- # - http://www.federalreserve.gov/aboutthefed/k8.htm
7
- ---
8
- months:
9
- 1:
10
- - name: New Year's Day
11
- regions: [federal_reserve]
12
- mday: 1
13
- observed: to_monday_if_sunday(date)
14
- - name: Birthday of Martin Luther King, Jr
15
- week: 3
16
- wday: 1
17
- regions: [federal_reserve]
18
- 2:
19
- - name: Washington's Birthday
20
- week: 3
21
- wday: 1
22
- regions: [federal_reserve]
23
- 5:
24
- - name: Memorial Day
25
- week: -1
26
- wday: 1
27
- regions: [federal_reserve]
28
- 7:
29
- - name: Independence Day
30
- regions: [federal_reserve]
31
- mday: 4
32
- observed: to_monday_if_sunday(date)
33
- 9:
34
- - name: Labor Day
35
- week: 1
36
- regions: [federal_reserve]
37
- wday: 1
38
- 10:
39
- - name: Columbus Day
40
- week: 2
41
- regions: [federal_reserve]
42
- wday: 1
43
- 11:
44
- - name: Veterans Day
45
- regions: [federal_reserve]
46
- mday: 11
47
- observed: to_monday_if_sunday(date)
48
- - name: Thanksgiving Day
49
- week: 4
50
- wday: 4
51
- regions: [federal_reserve]
52
- 12:
53
- - name: Christmas Day
54
- regions: [federal_reserve]
55
- mday: 25
56
- observed: to_monday_if_sunday(date)
57
- tests: |
58
- {Date.civil(2012,1,2) => "New Year's Day",
59
- Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
60
- Date.civil(2012,2,20) => "Washington's Birthday",
61
- Date.civil(2012,5,28) => "Memorial Day",
62
- Date.civil(2012,7,4) => "Independence Day",
63
- Date.civil(2012,9,3) => "Labor Day",
64
- Date.civil(2012,10,8) => "Columbus Day",
65
- Date.civil(2012,11,12) => "Veterans Day",
66
- Date.civil(2012,11,22) => "Thanksgiving Day",
67
- Date.civil(2012,12,25) => "Christmas Day",
68
-
69
- Date.civil(2013,1,1) => "New Year's Day",
70
- Date.civil(2013,1,21) => "Birthday of Martin Luther King, Jr",
71
- Date.civil(2013,2,18) => "Washington's Birthday",
72
- Date.civil(2013,5,27) => "Memorial Day",
73
- Date.civil(2013,7,4) => "Independence Day",
74
- Date.civil(2013,9,2) => "Labor Day",
75
- Date.civil(2013,10,14) => "Columbus Day",
76
- Date.civil(2013,11,11) => "Veterans Day",
77
- Date.civil(2013,11,28) => "Thanksgiving Day",
78
- Date.civil(2013,12,25) => "Christmas Day",
79
-
80
- Date.civil(2014,1,1) => "New Year's Day",
81
- Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
82
- Date.civil(2014,2,17) => "Washington's Birthday",
83
- Date.civil(2014,5,26) => "Memorial Day",
84
- Date.civil(2014,7,4) => "Independence Day",
85
- Date.civil(2014,9,1) => "Labor Day",
86
- Date.civil(2014,10,13) => "Columbus Day",
87
- Date.civil(2014,11,11) => "Veterans Day",
88
- Date.civil(2014,11,27) => "Thanksgiving Day",
89
- Date.civil(2014,12,25) => "Christmas Day",
90
-
91
- Date.civil(2015,1,1) => "New Year's Day",
92
- Date.civil(2015,1,19) => "Birthday of Martin Luther King, Jr",
93
- Date.civil(2015,2,16) => "Washington's Birthday",
94
- Date.civil(2015,5,25) => "Memorial Day",
95
- Date.civil(2015,7,4) => "Independence Day",
96
- Date.civil(2015,9,7) => "Labor Day",
97
- Date.civil(2015,10,12) => "Columbus Day",
98
- Date.civil(2015,11,11) => "Veterans Day",
99
- Date.civil(2015,11,26) => "Thanksgiving Day",
100
- Date.civil(2015,12,25) => "Christmas Day",
101
-
102
- Date.civil(2016,1,1) => "New Year's Day",
103
- Date.civil(2016,1,18) => "Birthday of Martin Luther King, Jr",
104
- Date.civil(2016,2,15) => "Washington's Birthday",
105
- Date.civil(2016,5,30) => "Memorial Day",
106
- Date.civil(2016,7,4) => "Independence Day",
107
- Date.civil(2016,9,5) => "Labor Day",
108
- Date.civil(2016,10,10) => "Columbus Day",
109
- Date.civil(2016,11,11) => "Veterans Day",
110
- Date.civil(2016,11,24) => "Thanksgiving Day",
111
- Date.civil(2016,12,26) => "Christmas Day",
112
- }.each do |date, name|
113
- assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
114
- end
@@ -1,62 +0,0 @@
1
- # FedEx holiday definitions for the Ruby Holiday gem.
2
- #
3
- # By Adam Runner
4
- #
5
- # Updated: 2015-03-09.
6
- # Source: http://www.fedex.com/us/service-guide/holiday-schedule.html
7
- ---
8
- months:
9
- 1:
10
- - name: New Year's Day
11
- regions: [fedex]
12
- mday: 1
13
- observed: to_weekday_if_weekend(date)
14
- 5:
15
- - name: Memorial Day
16
- week: -1
17
- regions: [fedex]
18
- wday: 1
19
- 7:
20
- - name: Independence Day
21
- regions: [fedex]
22
- mday: 4
23
- observed: to_weekday_if_weekend(date)
24
- 9:
25
- - name: Labor Day
26
- week: 1
27
- regions: [fedex]
28
- wday: 1
29
- 11:
30
- - name: Thanksgiving
31
- week: 4
32
- regions: [fedex]
33
- wday: 4
34
- - name: Day After Thanksgiving
35
- function: day_after_thanksgiving(year)
36
- regions: [fedex]
37
- 12:
38
- - name: Christmas Day
39
- regions: [fedex]
40
- mday: 25
41
- observed: to_weekday_if_weekend(date)
42
- - name: New Year's Eve
43
- regions: [fedex]
44
- mday: 31
45
- methods:
46
- day_after_thanksgiving:
47
- arguments: year
48
- source: |
49
- Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 11, 4, 4) + 1
50
- tests: |
51
- {Date.civil(2015,1,1) => 'New Year\'s Day',
52
- Date.civil(2015,5,25) => 'Memorial Day',
53
- Date.civil(2015,7,4) => 'Independence Day',
54
- Date.civil(2015,9,7) => 'Labor Day',
55
- Date.civil(2015,11,26) => 'Thanksgiving',
56
- Date.civil(2015,11,27) => 'Day After Thanksgiving',
57
- Date.civil(2013,11,28) => 'Thanksgiving',
58
- Date.civil(2013,11,29) => 'Day After Thanksgiving',
59
- Date.civil(2015,12,25) => 'Christmas Day',
60
- Date.civil(2015,12,31) => 'New Year\'s Eve',}.each do |date, name|
61
- assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
62
- end
data/definitions/fi.yaml DELETED
@@ -1,115 +0,0 @@
1
- # Finnish holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2010-12-28.
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
6
- ---
7
- months:
8
- 0:
9
- - name: Pitkäperjantai
10
- regions: [fi]
11
- function: easter(year)
12
- function_modifier: -2
13
- - name: Pääsiäispäivä
14
- regions: [fi]
15
- function: easter(year)
16
- - name: 2. Pääsiäispäivä
17
- regions: [fi]
18
- function: easter(year)
19
- function_modifier: 1
20
- - name: Helatorstai # Ascension Day
21
- regions: [fi]
22
- function: easter(year)
23
- function_modifier: 39
24
- - name: Helluntaipäivä # Whitsunday
25
- regions: [fi]
26
- function: easter(year)
27
- function_modifier: 49
28
- - name: Pyhäinpäivä # All Saint's Day
29
- regions: [fi]
30
- function: fi_pyhainpaiva(year)
31
- 1:
32
- - name: Uudenvuodenpäivä
33
- regions: [fi]
34
- mday: 1
35
- - name: Loppiainen
36
- regions: [fi]
37
- mday: 6
38
- 5:
39
- - name: Vappu
40
- regions: [fi]
41
- mday: 1
42
- 6:
43
- - name: Juhannusaatto
44
- regions: [fi]
45
- function: fi_juhannusaatto(year)
46
- - name: Juhannuspäivä
47
- regions: [fi]
48
- function: fi_juhannuspaiva(year)
49
- 12:
50
- - name: Itsenäisyyspäivä
51
- regions: [fi]
52
- mday: 6
53
- - name: Jouluaatto
54
- regions: [fi]
55
- mday: 24
56
- - name: Joulupäivä
57
- regions: [fi]
58
- mday: 25
59
- - name: Tapaninpäivä
60
- regions: [fi]
61
- mday: 26
62
- methods:
63
- fi_juhannusaatto:
64
- # Finland: Mid-summer eve (Friday between June 19–25)
65
- arguments: year
66
- source: |
67
- date = Date.civil(year,6,19)
68
- if date.wday > 5 #if 19.6 is saturday
69
- date += 6
70
- else
71
- date += (5 - date.wday)
72
- end
73
- date
74
- fi_juhannuspaiva:
75
- # Finland: Mid-summer (Saturday between June 20–26)
76
- arguments: year
77
- source: |
78
- date = Date.civil(year,6,20)
79
- date += (6 - date.wday)
80
- date
81
- fi_pyhainpaiva:
82
- # Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
83
- arguments: year
84
- source: |
85
- date = Date.civil(year,10,31)
86
- date += (6 - date.wday)
87
- date
88
- tests: |
89
- {Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
90
- Date.civil(2008,1,6) => 'Loppiainen',
91
- Date.civil(2008,3,21) => 'Pitkäperjantai',
92
- Date.civil(2008,3,23) => 'Pääsiäispäivä',
93
- Date.civil(2008,3,24) => '2. Pääsiäispäivä',
94
- Date.civil(2008,5,1) => 'Vappu',
95
- Date.civil(2008,5,1) => 'Helatorstai',
96
- Date.civil(2008,5,11) => 'Helluntaipäivä',
97
- Date.civil(2009,6,19) => 'Juhannusaatto',
98
- Date.civil(2010,6,25) => 'Juhannusaatto',
99
- Date.civil(2011,6,24) => 'Juhannusaatto',
100
- Date.civil(2012,6,22) => 'Juhannusaatto',
101
- Date.civil(2013,6,21) => 'Juhannusaatto',
102
- Date.civil(2005,6,25) => 'Juhannuspäivä',
103
- Date.civil(2006,6,24) => 'Juhannuspäivä',
104
- Date.civil(2007,6,23) => 'Juhannuspäivä',
105
- Date.civil(2008,6,21) => 'Juhannuspäivä',
106
- Date.civil(2005,11,5) => 'Pyhäinpäivä',
107
- Date.civil(2006,11,4) => 'Pyhäinpäivä',
108
- Date.civil(2007,11,3) => 'Pyhäinpäivä',
109
- Date.civil(2008,11,1) => 'Pyhäinpäivä',
110
- Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
111
- Date.civil(2008,12,24) => 'Jouluaatto',
112
- Date.civil(2008,12,25) => 'Joulupäivä',
113
- Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
114
- assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
115
- end
data/definitions/fr.yaml DELETED
@@ -1,79 +0,0 @@
1
- # French holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2013-10-2*.
4
- # Sources:
5
- # - http://fr.wikipedia.org/wiki/Jours_f%C3%A9ri%C3%A9s_en_France#Les_f.C3.AAtes_f.C3.A9ri.C3.A9es
6
- # - http://vosdroits.service-public.fr/particuliers/F2405.xhtml
7
- ---
8
- months:
9
- 0:
10
- - name: Pâques
11
- regions: [fr]
12
- function: easter(year)
13
- type: informal
14
- - name: Lundi de Pâques
15
- regions: [fr]
16
- function: easter(year)
17
- function_modifier: 1
18
- - name: Ascension
19
- regions: [fr]
20
- function: easter(year)
21
- function_modifier: 39
22
- - name: Pentecôte
23
- regions: [fr]
24
- function: easter(year)
25
- function_modifier: 49
26
- type: informal
27
- - name: Lundi de Pentecôte
28
- regions: [fr]
29
- function: easter(year)
30
- function_modifier: 50
31
- 1:
32
- - name: Jour de l'an
33
- regions: [fr]
34
- mday: 1
35
- 5:
36
- - name: Fête du travail
37
- regions: [fr]
38
- mday: 1
39
- - name: Victoire 1945
40
- regions: [fr]
41
- mday: 8
42
- 7:
43
- - name: Fête nationale
44
- regions: [fr]
45
- mday: 14
46
- 8:
47
- - name: Assomption
48
- regions: [fr]
49
- mday: 15
50
- 11:
51
- - name: Toussaint
52
- regions: [fr]
53
- mday: 1
54
- - name: Armistice 1918
55
- regions: [fr]
56
- mday: 11
57
- 12:
58
- - name: Noël
59
- regions: [fr]
60
- mday: 25
61
- tests: |
62
- {Date.civil(2007,1,1) => 'Jour de l\'an',
63
- Date.civil(2007,4,9) => 'Lundi de Pâques',
64
- Date.civil(2007,5,1) => 'Fête du travail',
65
- Date.civil(2007,5,8) => 'Victoire 1945',
66
- Date.civil(2007,5,17) => 'Ascension',
67
- Date.civil(2007,5,28) => 'Lundi de Pentecôte',
68
- Date.civil(2007,7,14) => 'Fête nationale',
69
- Date.civil(2007,8,15) => 'Assomption',
70
- Date.civil(2007,11,1) => 'Toussaint',
71
- Date.civil(2007,11,11) => 'Armistice 1918',
72
- Date.civil(2007,12,25) => 'Noël'}.each do |date, name|
73
- assert_equal name, (Holidays.on(date, :fr)[0] || {})[:name]
74
- end
75
- {Date.civil(2007,4,8) => 'Pâques',
76
- Date.civil(2007,5,27) => 'Pentecôte'}.each do |date, name|
77
- assert_nil (Holidays.on(date, :fr)[0] || {})[:name]
78
- assert_equal name, (Holidays.on(date, :fr, :informal)[0] || {})[:name]
79
- end