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/cr.yaml DELETED
@@ -1,65 +0,0 @@
1
- # Costa Rican holiday definitions for the Ruby Holiday gem.
2
- #
3
- #
4
- # Updated: 2014-11-22.
5
- #
6
- # Sources:
7
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Costa_Rica
8
- #
9
- months:
10
- 0:
11
- - name: Jueves Santo
12
- regions: [cr]
13
- function: easter(year)
14
- function_modifier: -3
15
- - name: Viernes Santo
16
- regions: [cr]
17
- function: easter(year)
18
- function_modifier: -2
19
- 1:
20
- - name: Año Nuevo
21
- regions: [cr]
22
- mday: 1
23
- 4:
24
- - name: Día de Juan Santamaría
25
- regions: [cr]
26
- mday: 11
27
- 5:
28
- - name: Día del Trabajador
29
- regions: [cr]
30
- mday: 1
31
- 7:
32
- - name: Día de la Anexión de Guanacaste
33
- regions: [cr]
34
- mday: 25
35
- 8:
36
- - name: Día de la Virgen de los Angeles
37
- regions: [cr]
38
- mday: 2
39
- - name: Día de la Madre
40
- regions: [cr]
41
- mday: 15
42
- 9:
43
- - name: Día de la Independencia
44
- regions: [cr]
45
- mday: 15
46
- 10:
47
- - name: Día de las Culturas
48
- regions: [cr]
49
- mday: 12
50
- 12:
51
- - name: Navidad
52
- regions: [cr]
53
- mday: 25
54
- tests: |
55
- {Date.civil(2015,1,1) => 'Año Nuevo',
56
- Date.civil(2015,4,11) => 'Día de Juan Santamaría',
57
- Date.civil(2015,5,1) => 'Día del Trabajador',
58
- Date.civil(2015,7,25) => 'Día de la Anexión de Guanacaste',
59
- Date.civil(2015,8,2) => 'Día de la Virgen de los Angeles',
60
- Date.civil(2015,8,15) => 'Día de la Madre',
61
- Date.civil(2015,9,15) => 'Día de la Independencia',
62
- Date.civil(2015,10,12) => 'Día de las Culturas',
63
- Date.civil(2016,12,25) => 'Navidad'}.each do |date, name|
64
- assert_equal name, (Holidays.on(date, :cr)[0] || {})[:name]
65
- end
data/definitions/cz.yaml DELETED
@@ -1,73 +0,0 @@
1
- # Czech holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2016-04-20.
4
- # Sources:
5
- # - http://cs.wikipedia.org/wiki/%C4%8Cesk%C3%BD_st%C3%A1tn%C3%AD_sv%C3%A1tek
6
- # - http://www.mpsv.cz/cs/74
7
- ---
8
- months:
9
- 0:
10
- - name: Velký pátek
11
- regions: [cz]
12
- function: easter(year)
13
- function_modifier: -2
14
- - name: Velikonoční pondělí
15
- regions: [cz]
16
- function: easter(year)
17
- function_modifier: 1
18
- 1:
19
- - name: Den obnovy samostatného českého státu
20
- regions: [cz]
21
- mday: 1
22
- 5:
23
- - name: Svátek práce
24
- regions: [cz]
25
- mday: 1
26
- - name: Den vítězství
27
- regions: [cz]
28
- mday: 8
29
- 7:
30
- - name: Den slovanských věrozvěstů Cyrila a Metoděje
31
- regions: [cz]
32
- mday: 5
33
- - name: Den upálení mistra Jana Husa
34
- regions: [cz]
35
- mday: 6
36
- 9:
37
- - name: Den české státnosti
38
- regions: [cz]
39
- mday: 28
40
- 10:
41
- - name: Den vzniku samostatného československého státu
42
- regions: [cz]
43
- mday: 28
44
- 11:
45
- - name: Den boje za svobodu a demokracii
46
- regions: [cz]
47
- mday: 17
48
- 12:
49
- - name: Štědrý den
50
- regions: [cz]
51
- mday: 24
52
- - name: 1. svátek vánoční
53
- regions: [cz]
54
- mday: 25
55
- - name: 2. svátek vánoční
56
- regions: [cz]
57
- mday: 26
58
- tests: |
59
- {Date.civil(2010,1,1) => 'Den obnovy samostatného českého státu',
60
- Date.civil(2016,3,25) => 'Velký pátek',
61
- Date.civil(2010,4,5) => 'Velikonoční pondělí',
62
- Date.civil(2010,5,1) => 'Svátek práce',
63
- Date.civil(2010,5,8) => 'Den vítězství',
64
- Date.civil(2010,7,5) => 'Den slovanských věrozvěstů Cyrila a Metoděje',
65
- Date.civil(2010,7,6) => 'Den upálení mistra Jana Husa',
66
- Date.civil(2010,9,28) => 'Den české státnosti',
67
- Date.civil(2010,10,28) => 'Den vzniku samostatného československého státu',
68
- Date.civil(2010,11,17) => 'Den boje za svobodu a demokracii',
69
- Date.civil(2010,12,24) => 'Štědrý den',
70
- Date.civil(2010,12,25) => '1. svátek vánoční',
71
- Date.civil(2010,12,26) => '2. svátek vánoční'}.each do |date, name|
72
- assert_equal name, (Holidays.on(date, :cz, :informal)[0] || {})[:name]
73
- end
data/definitions/de.yaml DELETED
@@ -1,209 +0,0 @@
1
- # German holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2016-03-16
4
- #
5
- # Changes 2016-03-16:
6
- # - Add Ostersonntag, Pfingstsonntag, Heilig Abend and Silvester as informal holidays.
7
- # - Add Fronleichnam for de_sn_aux, de_th_aux
8
- # - Add Reformationstag as informal holiday for de_bw (it is school free)
9
- # - Add Reformationstag for 2017 (500 years)
10
- # - Correction in test for :de_by_aux
11
- #
12
- # Sources:
13
- # - http://en.wikipedia.org/wiki/Holidays_in_Germany
14
- # - http://www.timeanddate.com/calendar/index.html?country=8
15
- # - http://www.germany.info/relaunch/welcome/travel/holidays.html
16
- ---
17
- months:
18
- 0:
19
- - name: Karfreitag
20
- regions: [de]
21
- function: easter(year)
22
- function_modifier: -2
23
- - name: Ostersonntag
24
- regions: [de]
25
- function: easter(year)
26
- type: informal
27
- - name: Ostermontag
28
- regions: [de]
29
- function: easter(year)
30
- function_modifier: 1
31
- - name: Christi Himmelfahrt
32
- regions: [de]
33
- function: easter(year)
34
- function_modifier: 39
35
- - name: Pfingstsonntag
36
- regions: [de]
37
- function: easter(year)
38
- function_modifier: 49
39
- type: informal
40
- - name: Pfingstmontag
41
- regions: [de]
42
- function: easter(year)
43
- function_modifier: 50
44
- - name: Fronleichnam
45
- regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl]
46
- function: easter(year)
47
- function_modifier: 60
48
- - name: Fronleichnam
49
- regions: [de_sn_aux, de_th_aux]
50
- function: easter(year)
51
- function_modifier: 60
52
- - name: Weiberfastnacht
53
- regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn]
54
- function: easter(year)
55
- function_modifier: -52
56
- type: informal
57
- - name: Rosenmontag
58
- regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn]
59
- function: easter(year)
60
- function_modifier: -48
61
- type: informal
62
- - name: Aschermittwoch
63
- regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn]
64
- function: easter(year)
65
- function_modifier: -46
66
- type: informal
67
- 1:
68
- - name: Neujahrstag
69
- regions: [de]
70
- mday: 1
71
- - name: Heilige Drei Könige
72
- regions: [de_bw, de_by, de_st]
73
- mday: 6
74
- 5:
75
- - name: Tag der Arbeit
76
- regions: [de]
77
- mday: 1
78
- 8:
79
- - name: Mariä Himmelfahrt
80
- regions: [de_by, de_sl]
81
- mday: 15
82
- - name: Friedensfest
83
- regions: [de_by_aux]
84
- mday: 8
85
- 10:
86
- - name: Tag der Deutschen Einheit
87
- regions: [de]
88
- mday: 3
89
- - name: Reformationstag
90
- regions: [de_bb, de_mv, de_sn, de_st, de_th]
91
- mday: 31
92
- - name: Reformationstag
93
- regions: [de_bw]
94
- mday: 31
95
- type: informal
96
- - name: Reformationstag
97
- regions: [de]
98
- mday: 31
99
- year_ranges:
100
- - limited: [2017]
101
- 11:
102
- - name: Allerheiligen
103
- regions: [de_bw, de_by, de_nw, de_rp, de_sl]
104
- mday: 1
105
- - name: Buß- und Bettag
106
- regions: [de_sn]
107
- function: de_buss_und_bettag(year)
108
- 12:
109
- - name: Heilig Abend
110
- regions: [de]
111
- mday: 24
112
- type: informal
113
- - name: 1. Weihnachtstag
114
- regions: [de]
115
- mday: 25
116
- - name: 2. Weihnachtstag
117
- regions: [de]
118
- mday: 26
119
- - name: Silvester
120
- regions: [de]
121
- mday: 31
122
- type: informal
123
-
124
- methods:
125
- de_buss_und_bettag:
126
- # Germany: Wednesday before November 23
127
- arguments: year
128
- source: |
129
- date = Date.civil(year,11,23)
130
- if date.wday > 3
131
- date -= (date.wday - 3)
132
- else
133
- date -= (date.wday + 4)
134
- end
135
- date
136
-
137
- tests: |
138
- {Date.civil(2009,1,1) => 'Neujahrstag',
139
- Date.civil(2009,4,10) => 'Karfreitag',
140
- Date.civil(2009,4,12) => 'Ostersonntag',
141
- Date.civil(2009,4,13) => 'Ostermontag',
142
- Date.civil(2009,5,1) => 'Tag der Arbeit',
143
- Date.civil(2009,5,21) => 'Christi Himmelfahrt',
144
- Date.civil(2009,5,31) => 'Pfingstsonntag',
145
- Date.civil(2009,6,1) => 'Pfingstmontag',
146
- Date.civil(2009,10,3) => 'Tag der Deutschen Einheit',
147
- Date.civil(2009,12,24) => 'Heilig Abend',
148
- Date.civil(2009,12,25) => '1. Weihnachtstag',
149
- Date.civil(2009,12,26) => '2. Weihnachtstag',
150
- Date.civil(2009,12,31) => 'Silvester'}.each do |date, name|
151
- assert_equal name, (Holidays.on(date, :de, :informal)[0] || {})[:name], "Failed on '#{name}' for date '#{date}'"
152
- end
153
-
154
- [:de_bw, :de_by, :de_st, :de_].each do |r|
155
- assert_equal 'Heilige Drei Könige', Holidays.on(Date.civil(2009,1,6), r)[0][:name]
156
- end
157
-
158
- [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_].each do |r|
159
- assert_equal 'Fronleichnam', Holidays.on(Date.civil(2009,6,11), r)[0][:name]
160
- end
161
-
162
- [:de_by, :de_sl, :de_].each do |r|
163
- assert_equal 'Mariä Himmelfahrt', Holidays.on(Date.civil(2009,8,15), r)[0][:name]
164
- end
165
-
166
- [:de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
167
- assert_equal 'Reformationstag', Holidays.on(Date.civil(2009,10,31), r)[0][:name]
168
- end
169
-
170
- # Free day in schools
171
- [:de_bw].each do |r|
172
- assert_equal 'Reformationstag', Holidays.on(Date.civil(2009,10,31), r, :informal)[0][:name]
173
- end
174
-
175
- # 500 years reformation in 2017
176
- assert_equal 'Reformationstag', Holidays.on(Date.civil(2017,10,31), :de)[0][:name]
177
- assert_equal [], Holidays.on(Date.civil(2016,10,31), :de), "Reformationstag is not a holiday in 2016 in whole Germany"
178
- assert_equal [], Holidays.on(Date.civil(2018,10,31), :de), "Reformationstag is not a holiday in 2018 in whole Germany"
179
-
180
- [:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
181
- assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009,11,1), r)[0][:name]
182
- end
183
-
184
- [:de_by_aux].each do |r|
185
- assert_equal 'Friedensfest', Holidays.on(Date.civil(2015,8,8),r)[0][:name]
186
- end
187
-
188
- [:de,
189
- :de_bw, :de_by, :de_bb, :de_he, :de_mv,
190
- :de_nw, :de_rp, :de_sl, :de_sn, :de_st, :de_th].each do |r|
191
- assert_equal [], Holidays.on(Date.civil(2015,8,8), r), "Friedensfest is not a holiday in #{r}"
192
- end
193
-
194
- assert_equal [], Holidays.on(Date.civil(2010,5,8), :de), '2010-05-08 is not a holiday in Germany'
195
-
196
- assert_equal [], Holidays.on(Date.civil(2010,8,8), :de), '2010-08-08 is not a holiday in Germany'
197
-
198
- # Repentance Day
199
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2004,11,17), :de_sn)[0][:name]
200
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2005,11,16), :de_sn)[0][:name]
201
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2006,11,22), :de_sn)[0][:name]
202
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2009,11,18), :de_sn)[0][:name]
203
-
204
- # Carnival
205
- [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn].each do |r|
206
- assert_equal 'Weiberfastnacht', Holidays.on(Date.civil(2016,2,4),r,:informal)[0][:name]
207
- assert_equal 'Rosenmontag', Holidays.on(Date.civil(2016,2,8),r,:informal)[0][:name]
208
- assert_equal 'Aschermittwoch', Holidays.on(Date.civil(2016,2,10),r,:informal)[0][:name]
209
- end
data/definitions/dk.yaml DELETED
@@ -1,130 +0,0 @@
1
- # Danish holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2008-11-22.
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Holidays_in_Denmark
6
- # - http://www.amblondon.um.dk/en/menu/AboutDenmark/PublicHolidaysInDK/PublicHolidaysinDenmark-until2010.htm
7
- # - http://borger.dk/forside/kirke-og-tro/folkekirken/officielle-helligdage
8
- ---
9
- months:
10
- 0:
11
- - name: Fastelavn
12
- regions: [dk]
13
- function: easter(year)
14
- function_modifier: -49
15
- type: informal
16
- - name: Palmesøndag
17
- regions: [dk]
18
- function: easter(year)
19
- function_modifier: -7
20
- type: informal
21
- - name: Skærtorsdag
22
- regions: [dk]
23
- function: easter(year)
24
- function_modifier: -3
25
- - name: Langfredag
26
- regions: [dk]
27
- function: easter(year)
28
- function_modifier: -2
29
- - name: Påskedag
30
- regions: [dk]
31
- function: easter(year)
32
- - name: 2. påskedag
33
- regions: [dk]
34
- function: easter(year)
35
- function_modifier: 1
36
- - name: Store Bededag
37
- regions: [dk]
38
- function: easter(year)
39
- function_modifier: 26
40
- - name: Kristi Himmelfartsdag
41
- regions: [dk]
42
- function: easter(year)
43
- function_modifier: 39
44
- - name: Pinsedag
45
- regions: [dk]
46
- function: easter(year)
47
- function_modifier: 49
48
- - name: 2. Pinsedag
49
- regions: [dk]
50
- function: easter(year)
51
- function_modifier: 50
52
- 1:
53
- - name: Nytårsdag
54
- regions: [dk]
55
- mday: 1
56
- 4:
57
- - name: 1. april
58
- regions: [dk]
59
- mday: 1
60
- type: informal
61
- - name: Danmarks besættelse
62
- regions: [dk]
63
- mday: 9
64
- type: informal
65
- - name: Dronningens fødselsdag
66
- regions: [dk]
67
- mday: 16
68
- type: informal
69
- 5:
70
- - name: Arbejdernes kampdag
71
- regions: [dk]
72
- mday: 1
73
- type: informal
74
- - name: Danmarks befrielse
75
- regions: [dk]
76
- mday: 5
77
- type: informal
78
- 6:
79
- - name: Grundlovsdag
80
- regions: [dk]
81
- mday: 5
82
- type: informal
83
- - name: Valdemarsdag og Genforeningsdag
84
- regions: [dk]
85
- mday: 15
86
- type: informal
87
- - name: Sankt Hans aften
88
- regions: [dk]
89
- mday: 23
90
- type: informal
91
- 11:
92
- - name: Mortensaften
93
- regions: [dk]
94
- mday: 10
95
- type: informal
96
- 12:
97
- - name: Sankt Lucia
98
- regions: [dk]
99
- mday: 13
100
- type: informal
101
- - name: Juleaftensdag
102
- regions: [dk]
103
- mday: 24
104
- type: informal
105
- - name: 1. juledag
106
- regions: [dk]
107
- mday: 25
108
- - name: 2. juledag
109
- regions: [dk]
110
- mday: 26
111
- tests: |
112
- {Date.civil(2007,1,1) => 'Nytårsdag',
113
- Date.civil(2007,2,18) => 'Fastelavn',
114
- Date.civil(2007,4,9) => 'Danmarks besættelse',
115
- Date.civil(2007,4,16) => 'Dronningens fødselsdag',
116
- Date.civil(2007,4,5) => 'Skærtorsdag',
117
- Date.civil(2007,4,6) => 'Langfredag',
118
- Date.civil(2007,4,8) => 'Påskedag',
119
- Date.civil(2007,4,9) => '2. påskedag',
120
- Date.civil(2007,5,1) => 'Arbejdernes kampdag',
121
- Date.civil(2007,5,4) => 'Store Bededag',
122
- Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
123
- Date.civil(2007,5,27) => 'Pinsedag',
124
- Date.civil(2007,5,28) => '2. Pinsedag',
125
- Date.civil(2007,6,5) => 'Grundlovsdag',
126
- Date.civil(2007,12,24) => 'Juleaftensdag',
127
- Date.civil(2007,12,25) => '1. juledag',
128
- Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
129
- assert_equal name, (Holidays.on(date, :dk, :informal)[0] || {})[:name]
130
- end
@@ -1,44 +0,0 @@
1
- # ECB TARGET Closing Days
2
- #
3
- # Updated: 2014-01-04.
4
- # Sources:
5
- # - http://www.ecb.europa.eu/home/html/holidays.en.html
6
- # - http://www.ecb.europa.eu/press/pr/date/2000/html/pr001214_4.en.html
7
- ---
8
- months:
9
- 0:
10
- - name: Good Friday
11
- regions: [ecb_target]
12
- function: easter(year)
13
- function_modifier: -2
14
- - name: Easter Monday
15
- regions: [ecb_target]
16
- function: easter(year)
17
- function_modifier: 1
18
- 1:
19
- - name: New Year's Day
20
- regions: [ecb_target]
21
- mday: 1
22
- 5:
23
- - name: Labour Day
24
- regions: [ecb_target]
25
- mday: 1
26
- 12:
27
- - name: Christmas Day
28
- regions: [ecb_target]
29
- mday: 25
30
- - name: Christmas Holiday
31
- regions: [ecb_target]
32
- mday: 26
33
- tests: |
34
- {Date.civil(2013,1,1) => 'New Year\'s Day',
35
- Date.civil(2013,5,1) => 'Labour Day',
36
- Date.civil(2013,3,29) => 'Good Friday',
37
- Date.civil(2013,4,1) => 'Easter Monday',
38
- Date.civil(2013,12,25) => 'Christmas Day',
39
- Date.civil(2013,12,26) => 'Christmas Holiday'}.each do |date, name|
40
- assert_equal name, (Holidays.on(date, :ecb_target)[0] || {})[:name]
41
- end
42
-
43
- assert_equal 'Good Friday', Holidays.on(Date.civil(2013,3,29), :ecb_target)[0][:name]
44
- assert_equal 'Easter Monday', Holidays.on(Date.civil(2013,4,1), :ecb_target)[0][:name]
data/definitions/el.yaml DELETED
@@ -1,84 +0,0 @@
1
- # Greek holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Created: 2011-05-11.
4
- # Sources:
5
- # http://www.assa.org.au/edm.html
6
- # http://fotios.org/node/1104
7
- # http://www.faqs.org/faqs/calendars/faq/
8
- # http://5dspace-time.org/Calendar/Algorithm.html - for offsets
9
- # http://el.wikipedia.org/wiki/Επίσημες_αργίες_στην_Ελλάδα - for holidays
10
- # http://www.eortologio.gr/arthra/pasxa.php - for holidays
11
- ---
12
- months:
13
- 0:
14
- - name: Μεγάλη Παρασκευή
15
- regions: [el]
16
- function: orthodox_easter(year)
17
- function_modifier: -2
18
- - name: Μεγάλο Σάββατο
19
- regions: [el]
20
- function: orthodox_easter(year)
21
- function_modifier: -1
22
- - name: Κυριακή του Πάσχα
23
- regions: [el]
24
- function: orthodox_easter(year)
25
- - name: Δευτέρα του Πάσχα
26
- regions: [el]
27
- function: orthodox_easter(year)
28
- function_modifier: 1
29
- - name: Καθαρά Δευτέρα
30
- regions: [el]
31
- function: orthodox_easter(year)
32
- function_modifier: -48
33
- - name: Αγίου Πνεύματος
34
- regions: [el]
35
- function: orthodox_easter(year)
36
- function_modifier: 50
37
- 1:
38
- - name: Πρωτοχρονιά
39
- regions: [el]
40
- mday: 1
41
- - name: Θεοφάνεια
42
- regions: [el]
43
- mday: 6
44
- 3:
45
- - name: Επέτειος της Επανάστασης του 1821
46
- regions: [el]
47
- mday: 25
48
- 5:
49
- - name: Πρωτομαγιά
50
- regions: [el]
51
- mday: 1
52
- 8:
53
- - name: Κοίμηση της Θεοτόκου
54
- regions: [el]
55
- mday: 15
56
- 10:
57
- - name: Επέτειος του Όχι
58
- regions: [el]
59
- mday: 28
60
- 12:
61
- - name: Χριστούγεννα
62
- regions: [el]
63
- mday: 25
64
- - name: Δεύτερη ημέρα των Χριστουγέννων
65
- regions: [el]
66
- mday: 26
67
- tests: |
68
- {Date.civil(2011,1,1) => 'Πρωτοχρονιά',
69
- Date.civil(2011,1,6) => 'Θεοφάνεια',
70
- Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
71
- Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
72
- Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
73
- Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
74
- Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
75
- Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
76
- Date.civil(2011,5,1) => 'Πρωτομαγιά',
77
- Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
78
- Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
79
- Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
80
- Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
81
- Date.civil(2011,12,25) => 'Χριστούγεννα',
82
- Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
83
- assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
84
- end