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/jp.yaml DELETED
@@ -1,316 +0,0 @@
1
- # Japanese holiday definitions for Ruby Holiday gem.
2
- # Reference:
3
- # - http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm
4
- # - http://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html
5
- # - https://en.wikipedia.org/wiki/Public_holidays_in_Japan
6
- #
7
- # For Japanese/English translations of each holiday:
8
- # - http://www.japanesecalendar.net/holidays/2016/
9
- #
10
- # This definition can calculate current Japanese holidays,
11
- # don't compat with past changes of Japan Holiday Act.
12
- #
13
- # CHANGES:
14
- # 2010-12-25: Initial version by Tatsuki Sugiura <sugi@nemui.org>
15
- # 2014-11-09: Added substitute holiday by Yoshiyuki Hirano <yoshiyuki.hirano@henteco-labs.com>
16
- # 2015-05-10: Non-Monday substitute holidays by Shuhei Kagawa <shuhei.kagawa@gmail.com>
17
- # 2015-12-15: Added mountain day by Tsuyoshi Sano <ttwo32@gmail.com>
18
- # 2016-03-26: Updated to match new custom method signature. See below for more. Phil Trimble <philtrimble@gmail.com>
19
- #
20
- # NOTE: This is the most complex set of custom date methods in the entire
21
- # project, mainly surrounding the idea of 'substitute' holidays. Since this is
22
- # the only one that is this complex I have settled on a less-than-ideal solution.
23
- # It is overly verbose and not easy to follow. It will be a target for refactoring
24
- # in the near future.
25
- ---
26
- months:
27
- 1:
28
- - name: 元日
29
- regions: [jp]
30
- mday: 1
31
- - name: 成人の日
32
- regions: [jp]
33
- wday: 1
34
- week: 2
35
- - name: 振替休日
36
- regions: [jp]
37
- mday: 1
38
- function: jp_substitute_holiday(year, month, day)
39
- 2:
40
- - name: 建国記念日
41
- regions: [jp]
42
- mday: 11
43
- - name: 振替休日
44
- regions: [jp]
45
- mday: 11
46
- function: jp_substitute_holiday(year, month, day)
47
- 3:
48
- - name: 春分の日
49
- regions: [jp]
50
- function: jp_vernal_equinox_day(year)
51
- - name: 振替休日
52
- regions: [jp]
53
- function: jp_vernal_equinox_day_substitute(year)
54
- 4:
55
- - name: 昭和の日
56
- regions: [jp]
57
- mday: 29
58
- - name: 振替休日
59
- regions: [jp]
60
- mday: 29
61
- function: jp_substitute_holiday(year, month, day)
62
- 5:
63
- - name: 憲法記念日
64
- regions: [jp]
65
- mday: 3
66
- - name: みどりの日
67
- regions: [jp]
68
- mday: 4
69
- - name: こどもの日
70
- regions: [jp]
71
- mday: 5
72
- - name: 振替休日
73
- regions: [jp]
74
- mday: 3
75
- function: jp_substitute_holiday(year, month, day)
76
- - name: 振替休日
77
- regions: [jp]
78
- mday: 4
79
- function: jp_substitute_holiday(year, month, day)
80
- - name: 振替休日
81
- regions: [jp]
82
- mday: 5
83
- function: jp_substitute_holiday(year, month, day)
84
- 7:
85
- - name: 海の日
86
- regions: [jp]
87
- mday: 20
88
- year_ranges:
89
- - between: 1996..2002
90
- - name: 海の日
91
- regions: [jp]
92
- wday: 1
93
- week: 3
94
- year_ranges:
95
- - after: 2003
96
- - name: 振替休日
97
- regions: [jp]
98
- function: jp_marine_day_substitute(year)
99
- year_ranges:
100
- - between: 1996..2002
101
- 8:
102
- - name: 山の日
103
- regions: [jp]
104
- year_ranges:
105
- - after: 2016
106
- function: jp_mountain_holiday(year)
107
- - name: 振替休日
108
- regions: [jp]
109
- year_ranges:
110
- - after: 2016
111
- function: jp_mountain_holiday_substitute(year)
112
- 9:
113
- - name: 敬老の日
114
- regions: [jp]
115
- wday: 1
116
- week: 3
117
- - name: 振替休日
118
- regions: [jp]
119
- function: jp_respect_for_aged_holiday_substitute(year)
120
- - name: 国民の休日
121
- regions: [jp]
122
- function: jp_citizens_holiday(year)
123
- - name: 秋分の日
124
- regions: [jp]
125
- function: jp_national_culture_day(year)
126
- - name: 振替休日
127
- regions: [jp]
128
- function: jp_national_culture_day_substitute(year)
129
- 10:
130
- - name: 体育の日
131
- regions: [jp]
132
- wday: 1
133
- week: 2
134
- - name: 振替休日
135
- regions: [jp]
136
- function: jp_health_sports_day_substitute(year)
137
- 11:
138
- - name: 文化の日
139
- regions: [jp]
140
- mday: 3
141
- - name: 振替休日
142
- regions: [jp]
143
- mday: 3
144
- function: jp_substitute_holiday(year, month, day)
145
- - name: 勤労感謝の日
146
- regions: [jp]
147
- mday: 23
148
- - name: 振替休日
149
- regions: [jp]
150
- mday: 23
151
- function: jp_substitute_holiday(year, month, day)
152
- 12:
153
- - name: 天皇誕生日
154
- regions: [jp]
155
- mday: 23
156
- - name: 振替休日
157
- regions: [jp]
158
- mday: 23
159
- function: jp_substitute_holiday(year, month, day)
160
-
161
- methods:
162
- jp_health_sports_day_substitute:
163
- arguments: year
164
- source: |
165
- Holidays::DefinitionFactory.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 10, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 10, 2, 1))
166
- jp_vernal_equinox_day:
167
- arguments: year
168
- source: |
169
- day =
170
- case year
171
- when 1851..1899
172
- 19.8277
173
- when 1900..1979
174
- 20.8357
175
- when 1980..2099
176
- 20.8431
177
- when 2100..2150
178
- 21.8510
179
- else
180
- raise IndexError.new("Out of range")
181
- end
182
- day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
183
- day = day.floor
184
- Date.civil(year, 3, day)
185
- jp_vernal_equinox_day_substitute:
186
- arguments: year
187
- source: |
188
- date = Holidays::DefinitionFactory.custom_methods_repository.find("jp_vernal_equinox_day(year)").call(year)
189
- Holidays::DefinitionFactory.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
190
- jp_marine_day_substitute:
191
- arguments: year
192
- source: |
193
- Holidays::DefinitionFactory.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 7, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 7, 3, 1))
194
- jp_national_culture_day:
195
- arguments: year
196
- source: |
197
- day =
198
- case year
199
- when 1851..1899
200
- 22.2588
201
- when 1900..1979
202
- 23.2588
203
- when 1980..2099
204
- 23.2488
205
- when 2100..2150
206
- 24.2488
207
- else
208
- raise IndexError.new("Out of range")
209
- end
210
- day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
211
- day = day.floor
212
- Date.civil(year, 9, day)
213
- jp_national_culture_day_substitute:
214
- arguments: year
215
- source: |
216
- date = Holidays::DefinitionFactory.custom_methods_repository.find("jp_national_culture_day(year)").call(year)
217
- Holidays::DefinitionFactory.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
218
- jp_citizens_holiday:
219
- arguments: year
220
- source: |
221
- year < 2003 and return nil
222
- ncd = Holidays::DefinitionFactory.custom_methods_repository.find("jp_national_culture_day(year)").call(year)
223
- if ncd.wday == 3
224
- ncd - 1
225
- else
226
- nil
227
- end
228
- jp_mountain_holiday:
229
- arguments: year
230
- source: |
231
- return nil if year < 2016
232
- Date.civil(year, 8, 11)
233
- jp_mountain_holiday_substitute:
234
- arguments: year
235
- source: |
236
- date = Holidays::DefinitionFactory.custom_methods_repository.find("jp_mountain_holiday(year)").call(year)
237
- Holidays::DefinitionFactory.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
238
- jp_respect_for_aged_holiday_substitute:
239
- arguments: year
240
- source: |
241
- Holidays::DefinitionFactory.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 9, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 9, 3, 1))
242
- jp_substitute_holiday:
243
- arguments: year, month, day
244
- source: |
245
- date = Date.civil(year, month, day)
246
- date.wday == 0 ? (Holidays::DefinitionFactory.custom_methods_repository.find("jp_next_weekday(date)").call(date+1)) : nil
247
- jp_next_weekday:
248
- arguments: date
249
- source: |
250
- is_holiday = Holidays::JP.holidays_by_month[date.month].any? do |holiday|
251
- holiday[:mday] == date.day
252
- end
253
- date.wday == 0 || is_holiday ? (Holidays::DefinitionFactory.custom_methods_repository.find("jp_next_weekday(date)").call(date+1)) : date
254
-
255
- tests: |
256
- {Date.civil(2008,1,1) => '元日',
257
- Date.civil(2010,1,11) => '成人の日',
258
- Date.civil(2008,2,11) => '建国記念日',
259
- Date.civil(2008,4,29) => '昭和の日',
260
- Date.civil(2008,5,3) => '憲法記念日',
261
- Date.civil(2008,5,5) => 'こどもの日',
262
- Date.civil(2010,7,19) => '海の日',
263
- Date.civil(2010,9,20) => '敬老の日',
264
- Date.civil(2010,10,11) => '体育の日',
265
- Date.civil(2008,11,3) => '文化の日',
266
- Date.civil(2008,11,23) => '勤労感謝の日',
267
- Date.civil(2008,12,23) => '天皇誕生日',
268
- Date.civil(2010,3,22) => '振替休日',
269
- Date.civil(2008,11,24) => '振替休日',
270
- Date.civil(2012,1,2) => '振替休日',
271
- Date.civil(2013,5,6) => '振替休日',
272
- Date.civil(2014,5,6) => '振替休日',
273
- Date.civil(2015,5,6) => '振替休日',
274
- Date.civil(2019,8,12) => '振替休日'
275
- }.each do |date, name|
276
- assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
277
- end
278
-
279
- # vernal equinox day
280
- [Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
281
- Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
282
- Date.civil(2010,3,21)].each do |date|
283
- assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
284
- end
285
-
286
- # national culture day
287
- [Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
288
- Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
289
- Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
290
- Date.civil(2013,9,23)].each do |date|
291
- assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
292
- end
293
-
294
- # citizens holiday
295
- [Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
296
- Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
297
- assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
298
- end
299
-
300
- # marine day since 1996
301
- [Date.civil(1996, 7, 20), Date.civil(2002, 7, 20), Date.civil(2003, 7, 21),
302
- Date.civil(2004, 7, 19), Date.civil(2005, 7, 18), Date.civil(2006, 7, 17),
303
- Date.civil(2007, 7, 16), Date.civil(2009, 7, 20), Date.civil(2013, 7, 15),
304
- Date.civil(2014, 7, 21)].each do |date|
305
- assert_equal '海の日', Holidays.on(date, :jp)[0][:name]
306
- end
307
-
308
- # mountain holiday start since 2016
309
- [Date.civil(2016,8,11), Date.civil(2017,8,11),Date.civil(2018,8,11),
310
- Date.civil(2019,8,11), Date.civil(2020,8,11),Date.civil(2021,8,11),
311
- Date.civil(2022,8,11)].each do |date|
312
- assert_equal '山の日', Holidays.on(date, :jp)[0][:name]
313
- end
314
-
315
- # before 2016, there is no mountain holiday.
316
- assert_nil Holidays.on(Date.civil(2015,8,11), :jp)[0]
data/definitions/li.yaml DELETED
@@ -1,107 +0,0 @@
1
- # Liechtenstein holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2011-10-17.
4
- # Sources:
5
- # http://www.tourismus.li/de/navpage-RegionLI-InformationLI-44728.html
6
- ---
7
- months:
8
- 0:
9
- - name: Fasnachtsdienstag
10
- regions: [li]
11
- function: easter(year)
12
- function_modifier: -47
13
- - name: Karfreitag
14
- regions: [li]
15
- function: easter(year)
16
- function_modifier: -2
17
- - name: Ostern
18
- regions: [li]
19
- function: easter(year)
20
- type: informal
21
- - name: Ostermontag
22
- regions: [li]
23
- function: easter(year)
24
- function_modifier: 1
25
- - name: Auffahrt
26
- regions: [li]
27
- function: easter(year)
28
- function_modifier: 39
29
- - name: Pfingstmontag
30
- regions: [li]
31
- function: easter(year)
32
- function_modifier: 50
33
- - name: Fronleichnam
34
- regions: [li]
35
- function: easter(year)
36
- function_modifier: 60
37
- 1:
38
- - name: Neujahrstag
39
- regions: [li]
40
- mday: 1
41
- - name: Heilige Drei Könige
42
- regions: [li, li]
43
- mday: 6
44
- 2:
45
- - name: Maria Lichtmess
46
- regions: [li]
47
- mday: 2
48
- 3:
49
- - name: St. Josef
50
- regions: [li]
51
- mday: 19
52
- 5:
53
- - name: Tag der Arbeit
54
- regions: [li]
55
- mday: 1
56
- 8:
57
- - name: Staatsfeiertag
58
- regions: [li]
59
- mday: 15
60
- 9:
61
- - name: Maria Geburt
62
- regions: [li]
63
- mday: 8
64
- 11:
65
- - name: Allerheiligen
66
- regions: [li]
67
- mday: 1
68
- 12:
69
- - name: Maria Empfängnis
70
- regions: [li]
71
- mday: 8
72
- - name: Heilig Abend
73
- regions: [li]
74
- mday: 24
75
- - name: Weihnachten
76
- regions: [li]
77
- mday: 25
78
- - name: Stefanstag
79
- regions: [li]
80
- mday: 26
81
- - name: Silvester
82
- regions: [li]
83
- mday: 31
84
- tests: |
85
- {Date.civil(2009,1,1) => 'Neujahrstag',
86
- Date.civil(2011,3,8) => 'Fasnachtsdienstag',
87
- Date.civil(2009,4,10) => 'Karfreitag',
88
- Date.civil(2009,4,12) => 'Ostern',
89
- Date.civil(2009,4,13) => 'Ostermontag',
90
- Date.civil(2009,5,21) => 'Auffahrt',
91
- Date.civil(2009,6,1) => 'Pfingstmontag',
92
- Date.civil(2009,12,25) => 'Weihnachten',
93
- Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
94
- assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
95
- end
96
-
97
- [:li].each do |r|
98
- assert_equal 'Fronleichnam', Holidays.on(Date.civil(2009,6,11), r)[0][:name]
99
- end
100
-
101
- [:li].each do |r|
102
- assert_equal 'Staatsfeiertag', Holidays.on(Date.civil(2009,8,15), r)[0][:name]
103
- end
104
-
105
- [:li].each do |r|
106
- assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009,11,1), r)[0][:name]
107
- end
data/definitions/lt.yaml DELETED
@@ -1,89 +0,0 @@
1
- # Lithuanian holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2014-10-02
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Lithuania
6
- # - http://day.lt/sventes/nedarbo
7
- ---
8
- months:
9
- 0:
10
- - name: Šv. Velykos
11
- regions: [lt]
12
- function: easter(year)
13
- - name: Antroji Velykų diena
14
- regions: [lt]
15
- function: easter(year)
16
- function_modifier: 1
17
- 1:
18
- - name: Naujieji metai
19
- regions: [lt]
20
- mday: 1
21
- 2:
22
- - name: Valstybės atkūrimo diena
23
- regions: [lt]
24
- mday: 16
25
- 3:
26
- - name: Nepriklausomybės atkūrimo diena
27
- regions: [lt]
28
- mday: 11
29
- 5:
30
- - name: Darbininkų diena
31
- regions: [lt]
32
- mday: 1
33
- 6:
34
- - name: Joninės
35
- regions: [lt]
36
- mday: 24
37
- 7:
38
- - name: Valstybės diena
39
- regions: [lt]
40
- mday: 6
41
- 8:
42
- - name: Žolinė
43
- regions: [lt]
44
- mday: 15
45
- 11:
46
- - name: Visų šventųjų diena
47
- regions: [lt]
48
- mday: 1
49
- 12:
50
- - name: Šv. Kūčios
51
- regions: [lt]
52
- mday: 24
53
- - name: Šv. Kalėdos
54
- regions: [lt]
55
- mday: 25
56
- - name: Antroji Kalėdų diena
57
- regions: [lt]
58
- mday: 26
59
- tests: |
60
- {Date.civil(2008,1,1) => 'Naujieji metai',
61
- Date.civil(2008,2,16) => 'Valstybės atkūrimo diena',
62
- Date.civil(2008,3,11) => 'Nepriklausomybės atkūrimo diena',
63
- Date.civil(2008,3,23) => 'Šv. Velykos',
64
- Date.civil(2008,3,24) => 'Antroji Velykų diena',
65
- Date.civil(2008,5,1) => 'Darbininkų diena',
66
- Date.civil(2008,6,24) => 'Joninės',
67
- Date.civil(2008,7,6) => 'Valstybės diena',
68
- Date.civil(2008,8,15) => 'Žolinė',
69
- Date.civil(2008,11,1) => 'Visų šventųjų diena',
70
- Date.civil(2008,12,24) => 'Šv. Kūčios',
71
- Date.civil(2008,12,25) => 'Šv. Kalėdos',
72
- Date.civil(2008,12,26) => 'Antroji Kalėdų diena'}.each do |date, name|
73
- assert_equal name, (Holidays.on(date, :lt)[0] || {})[:name]
74
- end
75
- {Date.civil(2012,1,1) => 'Naujieji metai',
76
- Date.civil(2012,2,16) => 'Valstybės atkūrimo diena',
77
- Date.civil(2012,3,11) => 'Nepriklausomybės atkūrimo diena',
78
- Date.civil(2012,4,8) => 'Šv. Velykos',
79
- Date.civil(2012,4,9) => 'Antroji Velykų diena',
80
- Date.civil(2012,5,1) => 'Darbininkų diena',
81
- Date.civil(2012,6,24) => 'Joninės',
82
- Date.civil(2012,7,6) => 'Valstybės diena',
83
- Date.civil(2012,8,15) => 'Žolinė',
84
- Date.civil(2012,11,1) => 'Visų šventųjų diena',
85
- Date.civil(2012,12,24) => 'Šv. Kūčios',
86
- Date.civil(2012,12,25) => 'Šv. Kalėdos',
87
- Date.civil(2012,12,26) => 'Antroji Kalėdų diena'}.each do |date, name|
88
- assert_equal name, (Holidays.on(date, :lt)[0] || {})[:name]
89
- end
data/definitions/ma.yaml DELETED
@@ -1,52 +0,0 @@
1
- # Morocco holiday (incomplete)definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2013-07-01.
4
- # Some dates in Islamic Calendar are missing.
5
- # Sources:
6
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Morocco
7
- ---
8
- months:
9
- 1:
10
- - name: Ras l' âm
11
- regions: [ma]
12
- mday: 1
13
- - name: Takdim watikat al-istiqlal
14
- regions: [ma]
15
- mday: 11
16
- 5:
17
- - name: Eid Ash-Shughl
18
- regions: [ma]
19
- mday: 1
20
- 7:
21
- - name: Eid Al-Ârch
22
- regions: [ma]
23
- mday: 30
24
- 8:
25
- - name: Zikra Oued Ed-Dahab
26
- regions: [ma]
27
- mday: 14
28
- - name: Thawrat al malik wa shâab
29
- regions: [ma]
30
- mday: 20
31
- - name: Eid Al Milad
32
- regions: [ma]
33
- mday: 21
34
- 11:
35
- - name: Eid Al Massira Al Khadra
36
- regions: [ma]
37
- mday: 6
38
- - name: Eid Al Istiqulal
39
- regions: [ma]
40
- mday: 18
41
- tests: |
42
- {Date.civil(2007,1,1) => 'Ras l\' âm',
43
- Date.civil(2007,1,11) => 'Takdim watikat al-istiqlal',
44
- Date.civil(2007,5,1) => 'Eid Ash-Shughl',
45
- Date.civil(2007,7,30) => 'Eid Al-Ârch',
46
- Date.civil(2007,8,14) => 'Zikra Oued Ed-Dahab',
47
- Date.civil(2007,8,20) => 'Thawrat al malik wa shâab',
48
- Date.civil(2007,8,21) => 'Eid Al Milad',
49
- Date.civil(2007,11,6) => 'Eid Al Massira Al Khadra',
50
- Date.civil(2007,11,18) => 'Eid Al Istiqulal'}.each do |date, name|
51
- assert_equal name, (Holidays.on(date, :ma, :informal)[0] || {})[:name]
52
- end
data/definitions/mx.yaml DELETED
@@ -1,106 +0,0 @@
1
- # Mexican holiday definitions for the Ruby Holiday gem.
2
- # Updated 2008-12-05.
3
- # Sources:
4
- # - http://www.britishembassy.gov.uk/servlet/Front?pagename=OpenMarket/Xcelerate/ShowPage&c=Page&cid=1125561634963
5
- # - http://www.usembassy-mexico.gov/eng/holidays.html
6
- ---
7
- months:
8
- 1:
9
- - name: Año nuevo
10
- regions: [mx]
11
- mday: 1
12
- - name: Dia de los Santos Reyes
13
- regions: [mx]
14
- mday: 6
15
- 2:
16
- - name: Día de la Constitución
17
- week: 1
18
- regions: [mx]
19
- wday: 1
20
- 3:
21
- - name: Natalicio de Benito Juárez
22
- week: 3
23
- regions: [mx]
24
- wday: 1
25
- 4:
26
- - name: Día del Niño
27
- regions: [mx]
28
- mday: 30
29
- type: informal
30
- 5:
31
- - name: Día del Trabajo
32
- regions: [mx]
33
- mday: 1
34
- - name: Cinco de Mayo
35
- regions: [mx]
36
- mday: 5
37
- type: informal
38
- - name: La Batalla de Puebla
39
- regions: [mx_pue]
40
- mday: 5
41
- - name: Día de la Madre
42
- regions: [mx]
43
- mday: 10
44
- type: informal
45
- - name: Día del Maestro
46
- regions: [mx]
47
- mday: 15
48
- type: informal
49
- 6:
50
- - name: Día del Padre
51
- regions: [mx]
52
- wday: 0
53
- week: 3
54
- type: informal
55
- 9:
56
- - name: Grito de Dolores
57
- regions: [mx]
58
- mday: 15
59
- - name: Día de la Independencia
60
- regions: [mx]
61
- mday: 16
62
- 10:
63
- - name: Día de la Raza
64
- regions: [mx]
65
- mday: 12
66
- type: informal
67
- 11:
68
- - name: Todos los Santos
69
- regions: [mx]
70
- mday: 1
71
- type: informal
72
- - name: Los Fieles Difuntos
73
- regions: [mx]
74
- mday: 2
75
- type: informal
76
- - name: Día de la Revolución
77
- week: 3
78
- regions: [mx]
79
- wday: 1
80
- 12:
81
- - name: Día de la Virgen de Guadalupe
82
- regions: [mx]
83
- mday: 12
84
- type: informal
85
- - name: Nochebuena
86
- regions: [mx]
87
- mday: 24
88
- type: informal
89
- - name: Navidad
90
- regions: [mx]
91
- mday: 25
92
- - name: Los Santos Inocentes
93
- regions: [mx]
94
- mday: 28
95
- tests: |
96
- {Date.civil(2007,1,1) => 'Año nuevo',
97
- Date.civil(2007,2,5) => 'Día de la Constitución',
98
- Date.civil(2007,5,1) => 'Día del Trabajo',
99
- Date.civil(2007,5,5) => 'Cinco de Mayo',
100
- Date.civil(2007,9,16) => 'Día de la Independencia',
101
- Date.civil(2007,11,1) => 'Todos los Santos',
102
- Date.civil(2007,11,2) => 'Los Fieles Difuntos',
103
- Date.civil(2007,11,19) => 'Día de la Revolución',
104
- Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
105
- assert_equal name, (Holidays.on(date, :mx, :informal)[0] || {})[:name]
106
- end