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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c74b677a9819268733c692afe11958c2cf1ccaed
4
- data.tar.gz: faedba7eb3f149f92de77ddb7ec567cc708a2485
2
+ SHA256:
3
+ metadata.gz: 52c9a215e254d58739f7d8a48d4e1c4057ce10fa146604ed10dd062155103ed1
4
+ data.tar.gz: 0b5c0c77a7dc1135b516ae88196db1def87813f29d69dcbf15f787d75aee2363
5
5
  SHA512:
6
- metadata.gz: 7530fa6ee86e2c3fe1136eac771c0d307d89cdb4e870c7fc2f4de8d14af8a967055c1c75ee6299a3e0f6238f3c50ea832c6db715c854a1a09814e32bdd397276
7
- data.tar.gz: 9a608809435239e4ae5a7b7d6f97e3ae085afdd40eac49808b9947287f404442af265bd529508b3c1dfeae3b5f90c209fe967d78615de28906a327dd4222ee26
6
+ metadata.gz: b6534de20527e1359dfa809b3cdfd4bb9f1a8b4b2ea6fb5593ff28c0d875b8b271bc2009a308d3ee03b936ab6d56e02be82c1b675859f22cedbd69be42ac0790
7
+ data.tar.gz: c6ca55b847d05375cc6f4d90046d84d2afce8a93b3e4598ca5be36c01a6c9ef0fa68c98f6a2540d1a04fd8071d1073aa5dece5deb033ee725c41d96f3ba9e805
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "definitions"]
2
+ path = definitions
3
+ url = https://github.com/holidays/definitions
data/CHANGELOG.md CHANGED
@@ -1,5 +1,200 @@
1
1
  # Ruby Holidays Gem CHANGELOG
2
2
 
3
+ ## 8.4.1
4
+
5
+ * Fix jp holidays from 2022.
6
+
7
+ ## 8.4.0
8
+
9
+ * Update submodule definitions.
10
+ * Thanks to contributors!!
11
+
12
+
13
+ ## 8.3.0
14
+
15
+ * Update submodule definitions.
16
+ * Remove test about feb 29 on non leap year.
17
+ * Thanks to contributors!!
18
+
19
+ ## 8.2.0
20
+
21
+ * Update submodule definitions. Thanks to contributors!!
22
+
23
+ ## 8.1.0
24
+
25
+ * Update submodule definitions, so that the newest holidays from the definition
26
+ gem are represent here.
27
+
28
+ ## 8.0.0
29
+
30
+ * Remove support for ruby 2.2 and ruby 2.3.
31
+ * Add support for latest ruby 2.6
32
+ * Update to [v5.0.1 definitions](https://github.com/holidays/definitions/releases/tag/v5.0.1). Please see the changelog for the definition details.
33
+
34
+ ## 7.1.0
35
+
36
+ * Update to [v4.1.0 definitions](https://github.com/holidays/definitions/releases/tag/v4.1.0). Please see the changelog for the definition details.
37
+
38
+ ## 7.0.0
39
+
40
+ Major semver bump due to the major version change in the [definitions](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400). Several non ISO regions have been modified in order to provide more clarity for parent and sub-regions.
41
+
42
+ Affected regions:
43
+
44
+ * `ecb_target` region changed to `ecbtarget`
45
+ * `federal_reserve` region changed to `federalreserve`
46
+ * `federalreservebanks` region changed to `federalreservebanks`
47
+ * `north_america_informal` region changed to `northamericainformal`
48
+ * `united_nations` region changed to `unitednations`
49
+ * `north_america` region changed to `northamerica`
50
+ * `south_america` region changed to `southamerica`
51
+
52
+ Please see the [definitions v4.0.0 CHANGELOG](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400) for the full change list.
53
+
54
+ ## 6.6.1
55
+
56
+ * Fixes `any_holidays_during_work_week?` so that it actually does what it says it does [issue-264](https://github.com/holidays/holidays/issues/264)
57
+
58
+ ## 6.6.0
59
+
60
+ * Update to [v3.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v3.0.0). This required updates to the custom method parser but no behavior changes.
61
+ * Remove unused `simplecov-rcov` from gemspec dev dependencies
62
+ * Fix parent region loading bug [PR](https://github.com/holidays/holidays/pull/320) (thanks to chadrschroeder)
63
+ * Fix `ruby-head` build caused by new 'endless range' feature in ruby 2.6.0 [PR](https://github.com/holidays/holidays/pull/321)
64
+ * Refactor definition search logic for improved readability [PR](https://github.com/holidays/holidays/pull/318) (thanks to https://github.com/guizma)
65
+ * Reorganize most documentation into the `docs/` directory
66
+ * Fix list of covered rubies in README
67
+
68
+ ## 6.5.0
69
+
70
+ * Update to [v2.5.2 definitions](https://github.com/holidays/definitions/releases/tag/v2.5.2). Please see the changelog for the definition details.
71
+ * Fix permissions on `bin` executables (thanks to github.com/JuanitoFatas)
72
+
73
+ ## 6.4.0
74
+
75
+ * Update to [v2.4.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.4.0). Please see the changelog for the definition details.
76
+
77
+ ## 6.3.0
78
+
79
+ * Update to [v2.3.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.3.0). Please see the changelog for the definition details.
80
+
81
+ ## 6.2.0
82
+
83
+ * Update to [v2.2.1 definitions](https://github.com/holidays/definitions/releases/tag/v2.2.1). Please see the changelog for the definition details.
84
+ * README update to add `:federal_reserve` examples (thanks to https://github.com/aahmad)
85
+
86
+ ## 6.1.0
87
+
88
+ * Update to [v2.1.1 definitions](https://github.com/holidays/definitions/releases/tag/v2.1.1). Please see the changelog for
89
+ the definitions for details.
90
+
91
+ ## 6.0.0
92
+
93
+ * Remove support for ruby 2.1.0 since it is [no longer officially supported](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/). This is the cause of the major
94
+ version bump.
95
+ * Update to [v2.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.0.0). This changes the format
96
+ of definition tests and requires the other changes.
97
+ * Rewrite test generation logic to consume new YAML format.
98
+
99
+ To be crystal clear: this version should not behave differently in terms of holiday results than v5.7.0 of the gem. Any
100
+ differences are a bug that should be addressed.
101
+
102
+ ## 5.7.0
103
+
104
+ * Update to [v1.7.1 definitions](https://github.com/holidays/definitions/releases/tag/v1.7.1). Please see the
105
+ definitions repository for the list of changes.
106
+ * Remove 'coveralls'. We never looked at the reports. We will we simplecov to enforce test coverage. It will
107
+ start off being set to require 99% and above.
108
+
109
+ ## 5.6.0
110
+
111
+ * Update to v1.6.1 definitions, which includes updates for the `:ca` region (and subregions)
112
+
113
+ ## 5.5.1
114
+
115
+ * Update to v1.5.1 definitions, which includes bugfix in `fedex` custom method
116
+
117
+ ## 5.5.0
118
+
119
+ * Fix [#251](https://github.com/holidays/holidays/issues/251): `load_custom` would override all other definitions
120
+ * Fix [#266](https://github.com/holidays/holidays/issues/266): `:any` does not return expected results
121
+ * Fix [#265](https://github.com/holidays/holidays/issues/265): Jersey/je not loaded as expected when pulling `:gb`
122
+ * Add lunar date calculations, which are used in `:kr` and `:vi` definitions (thanks to https://github.com/jonathanpike)
123
+ * Improve cache performance (thanks to https://github.com/mzruya)
124
+ * Remove incorrect comments in definition generation (thanks to https://github.com/morrme)
125
+ * Fix bug related to definition functions inadvertently affecting subsequent date calculations
126
+ * Point to latest version (1.5.0) of definitions, which includes:
127
+ * Add Vietnamese holidays
128
+ * Updates Australian holidays
129
+ * Updates Korean holidays to use native language and fancy lunar date calculations
130
+ * Fix NYSE definitions to correctly calculate observed "New Year's Day"
131
+
132
+ ## 5.4.0
133
+
134
+ * Add support for ruby 2.4.0 (added it to the required tests in Travis CI)
135
+ * Fix issue [#250](https://github.com/holidays/holidays/issues/250), which was that subregions were 'lost' if there was more than one underscore in it (thanks to https://github.com/chinito)
136
+ * Fix caching when using Date extensions (thanks to https://github.com/alexgerstein)
137
+ * Remove unused weekend date calculator method (thanks to https://github.com/ttwo32)
138
+ * Use FULL_DEFINITIONS_PATH when loading definitions to avoid NameErrors when iterating whole LOAD_PATH (thanks to https://github.com/burke)
139
+ * Point to latest version (1.3.0) of definitions, which includes:
140
+ * Add Tunisian (tn) holidays (thanks to https://github.com/achr3f)
141
+ * Corrects various Australian holidays
142
+ * Update certain German regions for accuracy
143
+ * Change 'yk' to 'yt'
144
+
145
+ ## 5.3.0
146
+
147
+ * Fix `ca` province/territory codes for 'Newfoundland and Labrador' and 'Yukon' (thanks to https://github.com/slucaskim)
148
+
149
+ ## 5.2.1
150
+
151
+ * Fix caching (i.e. calls to `cache_between`) to...you know, actually cache correctly and give
152
+ performance improvements. Thanks to https://github.com/AnotherJoSmith for the fix!
153
+
154
+ ## 5.2.0
155
+
156
+ * Point to latest (v1.2.0 of definitions)
157
+ * updates `jp` defs to fix 'Foundation Day' name
158
+ * Fix `ca` defs for observed holidays
159
+ * Update `au` defs to have Christmas and Boxing Day for all of Australia instead of just individual territories
160
+ * Update `ie` defs to consolidate St Stephen's Day to use common method instead of custom method
161
+
162
+ ## 5.1.0
163
+
164
+ * Add `load_all` method to `Holidays` namespace to preload all definitions (i.e. no lazy loading)
165
+ * Fix issue-234: correctly load available regions so there is no error on `Holidays.available_regions` call
166
+
167
+ ## 5.0.0
168
+
169
+ * Remove support for jruby 1.7 (this is the main reason for the major semver bump)
170
+ * Remove support for ruby 2.0 (since it is no longer being supported by the core ruby team)
171
+ * Add back the lazy loading of regions (this was removed in the 4.0.0 bump) instead of loading upon require (this should have
172
+ no outward repercussions for users)
173
+ * Move definitions into their own repository and add as submodule. This will allow for more flexibility for tools written
174
+ in other languages.
175
+ * Rename `DateCalculatorFactory` to `Factory::DateCalculator`
176
+
177
+ ## 4.7.0
178
+
179
+ * Fix issue-225 (`LocalJumpError` for certain `jp` definition combinations) (https://github.com/ttwo32)
180
+ * Add Korean Lunar holidays (https://github.com/jonathanpike)
181
+
182
+ ## 4.6.0
183
+
184
+ * Add holidays for 'Luxembourg' (https://github.com/dunyakirkali)
185
+
186
+ ## 4.5.0
187
+
188
+ * Add `Holidays.year_holidays` method to obtain all holidays occuring from date to end of year, inclusively (thanks to https://github.com/jonathanpike)
189
+
190
+ ## 4.4.0
191
+
192
+ * Add Peruvian holiday definitions (https://github.com/Xosmond)
193
+
194
+ ## 4.3.0
195
+
196
+ * Update Portuguese holidays to restore 4 holidays (https://github.com/ruippeixotog)
197
+
3
198
  ## 4.2.0
4
199
 
5
200
  * BUGFIX Issue-194: correctly calculate `next_holidays` if next holiday is far in the future
data/Makefile ADDED
@@ -0,0 +1,45 @@
1
+ default: test
2
+
3
+ setup: update-defs
4
+ bundle install
5
+
6
+ generate:
7
+ bundle exec rake generate
8
+
9
+ test:
10
+ bundle exec rake test
11
+
12
+ console:
13
+ bundle exec rake console
14
+
15
+ test-region:
16
+ bundle exec rake test_region $(REGION)
17
+
18
+ build: clean
19
+ bundle exec gem build holidays.gemspec
20
+
21
+ push:
22
+ bundle exec gem push $(GEM)
23
+
24
+ update-defs: definitions/
25
+ git submodule update --init --remote --recursive
26
+
27
+ definitions: point-to-defs-master
28
+
29
+ point-to-defs-branch:
30
+ git submodule add -b $(BRANCH) git@github.com:$(USER)/definitions.git definitions/
31
+
32
+ point-to-defs-master:
33
+ git submodule add https://github.com/holidays/definitions definitions/
34
+
35
+ clean-defs:
36
+ git rm -f definitions
37
+ rm -rf .git/modules/definitions
38
+ git config -f .git/config --remove-section submodule.definitions 2> /dev/null
39
+
40
+ clean:
41
+ rm -rf holidays-*.gem
42
+ rm -rf reports
43
+ rm -rf coverage
44
+
45
+ .PHONY: setup test generate console build push update-defs test-region clean-defs point-to-defs-master point-to-defs-branch clean definitions
data/README.md CHANGED
@@ -1,146 +1,322 @@
1
- # Ruby Holidays Gem [![Build Status](https://travis-ci.org/holidays/holidays.svg?branch=master)](https://travis-ci.org/holidays/holidays) [![Coverage Status](https://coveralls.io/repos/github/holidays/holidays/badge.svg?branch=master)](https://coveralls.io/github/holidays/holidays?branch=master)
1
+ # Ruby Holidays Gem [![Build Status](https://travis-ci.org/holidays/holidays.svg?branch=master)](https://travis-ci.org/holidays/holidays)
2
2
 
3
- A set of functions to deal with holidays in Ruby.
3
+ Functionality to deal with holidays in Ruby.
4
4
 
5
- Extends Ruby's built-in Date class and supports custom holiday definition lists.
6
-
7
- Full documentation can be found [here](http://www.rubydoc.info/github/alexdunae/holidays/master/frames).
5
+ Extends Ruby's built-in Date and Time classes and supports custom holiday definition lists.
8
6
 
9
7
  ## Installation
10
8
 
11
- To install the gem from RubyGems:
9
+ ```
10
+ gem install holidays
11
+ ```
12
+
13
+ ## Tested versions
14
+
15
+ This gem is tested with the following ruby versions:
12
16
 
13
- gem install holidays
17
+ * 2.4.5
18
+ * 2.5.3
19
+ * 2.6.1
20
+ * JRuby 9.2.5.0
14
21
 
15
- The Holidays gem is tested on Ruby 2.0.0, 2.1.0, 2.2.0, 2.3.0 and JRuby.
22
+ ## Semver
16
23
 
17
- This gem follows [semantic versioning](http://semver.org/). The only methods covered by this guarantee are under the
18
- `Holidays` namespace specifically. Anything that is not a method off of `Holidays` or the core extension is not covered by
19
- semver. Please take this into account when relying on this gem as a dependency.
24
+ This gem follows [semantic versioning](http://semver.org/). The guarantee specifically covers:
25
+
26
+ * methods in the top-most `Holidays` namespace e.g. `Holidays.<method>`
27
+ * the [core extensions](#extending-rubys-date-and-time-classes)
28
+
29
+ Please note that we consider definition changes to be 'minor' bumps, meaning they are backwards compatible with your code but might give different holiday results!
20
30
 
21
31
  ## Time zones
22
32
 
23
33
  Time zones are ignored. This library assumes that all dates are within the same time zone.
24
34
 
25
- ### Using the Holidays class
35
+ ## Usage
26
36
 
27
- Get all holidays on April 25, 2008 in Australia.
37
+ This gem offers multiple ways to check for holidays for a variety of scenarios.
28
38
 
29
- date = Date.civil(2008,4,25)
39
+ #### Checking a specific date
30
40
 
31
- Holidays.on(date, :au)
32
- => [{:name => 'ANZAC Day',...}]
41
+ Get all holidays on April 25, 2008 in Australia:
33
42
 
34
- Get holidays that are observed on July 2, 2007 in British Columbia, Canada.
43
+ ```
44
+ Holidays.on(Date.civil(2008, 4, 25), :au)
45
+ => [{:name => 'ANZAC Day',...}]
46
+ ```
35
47
 
36
- date = Date.civil(2007,7,2)
48
+ You can check multiple regions in a single call:
37
49
 
38
- Holidays.on(date, :ca_bc, :observed)
39
- => [{:name => 'Canada Day',...}]
50
+ ```
51
+ Holidays.on(Date.civil(2008, 1, 1), :us, :fr)
52
+ => [{:name=>"New Year's Day", :regions=>[:us],...},
53
+ {:name=>"Jour de l'an", :regions=>[:fr],...}]
54
+ ```
40
55
 
41
- Get all holidays in July, 2008 in Canada and the US.
56
+ You can leave off 'regions' to get holidays for any region in our [definitions](https://github.com/holidays/definitions):
42
57
 
43
- from = Date.civil(2008,7,1)
44
- to = Date.civil(2008,7,31)
58
+ ```
59
+ Holidays.on(Date.civil(2007, 4, 25))
60
+ => [{:name=>"ANZAC Day", :regions=>[:au],...},
61
+ {:name=>"Festa della Liberazione", :regions=>[:it],...},
62
+ {:name=>"Dia da Liberdade", :regions=>[:pt],...}
63
+ ...
64
+ ]
65
+ ```
45
66
 
46
- Holidays.between(from, to, :ca, :us)
47
- => [{:name => 'Canada Day',...}
48
- {:name => 'Independence Day',...}]
67
+ #### Checking a date range
49
68
 
50
- Get informal holidays in February.
69
+ Get all holidays during the month of July 2008 in Canada and the US:
51
70
 
52
- from = Date.civil(2008,2,1)
53
- to = Date.civil(2008,2,15)
71
+ ```
72
+ from = Date.civil(2008,7,1)
73
+ to = Date.civil(2008,7,31)
54
74
 
55
- Holidays.between(from, to, :informal)
56
- => [{:name => 'Valentine\'s Day',...}]
75
+ Holidays.between(from, to, :ca, :us)
76
+ => [{:name => 'Canada Day',...}
77
+ {:name => 'Independence Day',...}]
78
+ ```
57
79
 
58
- Return all available regions:
80
+ #### Check for 'informal' holidays
81
+
82
+ You can pass the 'informal' flag to include holidays specified as informal in your results. See [here](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md#formalinformal) for information on what constitutes 'informal' vs 'formal'.
83
+
84
+ By default this flag is turned off, meaning no informal holidays will be returned.
85
+
86
+ Get Valentine's Day in the US:
87
+
88
+ ```
89
+ Holidays.on(Date.new(2018, 2, 14), :us, :informal)
90
+ => [{:name=>"Valentine's Day",...}]
91
+ ```
92
+
93
+ Leaving off 'informal' will mean that Valentine's Day is not returned:
94
+
95
+ ```
96
+ Holidays.on(Date.new(2018, 2, 14), :us)
97
+ => []
98
+ ```
99
+
100
+ Get informal holidays during the month of February 2008 for any region:
101
+
102
+ ```
103
+ from = Date.civil(2008,2,1)
104
+ to = Date.civil(2008,2,15)
105
+
106
+ Holidays.between(from, to, :informal)
107
+ => [{:name => 'Valentine\'s Day',...}]
108
+ ```
109
+
110
+ #### Check for 'observed' holidays
111
+
112
+ You can pass the 'observed' flag to include holidays that are observed on different days than they actually occur. See [here](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md#observed) for further explanation of 'observed'.
113
+
114
+ By default this flag is turned off, meaning no observed logic will be applied.
115
+
116
+ Get holidays that are observed on Monday July 2, 2007 in British Columbia, Canada:
117
+
118
+ ```
119
+ Holidays.on(Date.civil(2007, 7, 2), :ca_bc, :observed)
120
+ => [{:name => 'Canada Day',...}]
121
+ ```
122
+
123
+ Leaving off the 'observed' flag will mean that 'Canada Day' is not returned since it actually falls on Sunday July 1:
59
124
 
60
- Holidays.available_regions
61
- => [:ar, :at, ..., :sg] # this will be a big array
125
+ ```
126
+ Holidays.on(Date.civil(2007, 7, 2), :ca_bc)
127
+ => []
128
+ Holidays.on(Date.civil(2007, 7, 1), :ca_bc)
129
+ => [{:name=>"Canada Day", :regions=>[:ca],...}]
130
+ ```
62
131
 
63
- To check if there are any holidays taking place during a specified work week:
132
+ Get all observed US Federal holidays between 2018 and 2019:
64
133
 
65
- Holidays.any_holidays_during_work_week?(Date.civil(2016, 1, 1))
66
- => true
134
+ ```
135
+ from = Date.civil(2018,1,1)
136
+ to = Date.civil(2019,12,31)
67
137
 
68
- To find and return the next holidays occurring from date, inclusively:
138
+ Holidays.between(from, to, :federalreserve, :observed)
139
+ => [{:name => "New Year's Day"....}
140
+ {:name => "Birthday of Martin Luther King, Jr"....}]
141
+ ```
69
142
 
70
- Holidays.next_holidays(3, [:us, :informal], Date.civil(2016, 2, 23))
71
- => [{:name => "St. Patrick's Day",...}, {:name => "Good Friday",...}, {:name => "Easter Sunday",...}]
143
+ #### Check whether any holidays occur during work week
72
144
 
73
- Will default to `Date.today` if no date is provided.
145
+ Check if there are any holidays taking place during a specified work week. 'Work week' is defined as the period of Monday through Friday of the week specified by the date.
74
146
 
75
- ### Loading Custom Definitions on the fly
147
+ Check whether a holiday falls during first week of the year for any region:
76
148
 
77
- Load custom definitions file on the fly and use them immediately.
149
+ ```
150
+ Holidays.any_holidays_during_work_week?(Date.civil(2016, 1, 1))
151
+ => true
152
+ ```
78
153
 
79
- Load custom 'Company Founding' holiday on June 1st:
154
+ You can also pass in `informal` or `observed`:
80
155
 
81
- Holidays.load_custom('/home/user/holiday_definitions/custom_holidays.yaml')
156
+ ```
157
+ # Returns true since Valentine's Day falls on a Wednesday
158
+ holidays.any_holidays_during_work_week?(date.civil(2018, 2, 14), :us, :informal)
159
+ => true
160
+ # Returns false if you don't specify informal
161
+ irb(main):006:0> Holidays.any_holidays_during_work_week?(Date.civil(2018, 2, 14), :us)
162
+ => false
163
+ # Returns true since Veteran's Day is observed on Monday November 12, 2018
164
+ holidays.any_holidays_during_work_week?(date.civil(2018, 11, 12), :us, :observed)
165
+ => true
166
+ # Returns false if you don't specify observed since the actual holiday is on Sunday November 11th 2018
167
+ irb(main):005:0> Holidays.any_holidays_during_work_week?(Date.civil(2018, 11, 12), :us)
168
+ => false
169
+ ```
82
170
 
83
- date = Date.civil(2013,6,1)
171
+ #### Find the next holiday(s) that will occur from a specific date
84
172
 
85
- Holidays.on(date, :my_custom_region)
86
- => [{:name => 'Company Founding',...}]
173
+ Get the next holidays occurring from February 23, 2016 for the US:
87
174
 
88
- Custom definition files must match the format of the existing definition YAML files location in the 'definitions' directory.
175
+ ```
176
+ Holidays.next_holidays(3, [:us, :informal], Date.civil(2016, 2, 23))
177
+ => [{:name => "St. Patrick's Day",...}, {:name => "Good Friday",...}, {:name => "Easter Sunday",...}]
178
+ ```
89
179
 
90
- Multiple files can also be passed:
180
+ You can specify the number of holidays to return. This method will default to `Date.today` if no date is provided.
91
181
 
92
- Holidays.load_custom('/home/user/holidays/custom_holidays1.yaml', '/home/user/holidays/custom_holidays2.yaml')
182
+ #### Find all holidays occuring starting from a specific date to the end of the year
93
183
 
94
- ### Extending Ruby's Date class
184
+ Get all holidays starting from February 23, 2016 to end of year in the US:
185
+
186
+ ```
187
+ Holidays.year_holidays([:ca_on], Date.civil(2016, 2, 23))
188
+ => [{:name=>"Good Friday",...},
189
+ {name=>"Easter Sunday",...},
190
+ {:name=>"Victoria Day",...},
191
+ {:name=>"Canada Day",...},
192
+ {:name=>"Civic Holiday",...},
193
+ {:name=>"Labour Day",...},
194
+ {:name=>"Thanksgiving",...},
195
+ {:name=>"Remembrance Day",...},
196
+ {:name=>"Christmas Day",...},
197
+ {:name=>"Boxing Day",...}]
198
+ ```
199
+
200
+ This method will default to `Date.today` if no date is provided.
201
+
202
+ #### Return all available regions
203
+
204
+ Return all available regions:
205
+
206
+ ```
207
+ Holidays.available_regions
208
+ => [:ar, :at, ..., :sg] # this will be a big array
209
+ ```
210
+
211
+ ## Loading Custom Definitions on the fly
212
+
213
+ In addition to the [provided definitions](https://github.com/holidays/definitions) you can load custom definitions file on the fly and use them immediately.
214
+
215
+ To load custom 'Company Founding' holiday on June 1st:
216
+
217
+ ```
218
+ Holidays.load_custom('/home/user/holiday_definitions/custom_holidays.yaml')
219
+ Holidays.on(Date.civil(2013, 6, 1), :my_custom_region)
220
+ => [{:name => 'Company Founding',...}]
221
+ ```
222
+
223
+ Custom definition files must match the [syntax of the existing definition files](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md).
224
+
225
+ Multiple files can be loaded at the same time:
226
+
227
+ ```
228
+ Holidays.load_custom('/home/user/holidays/custom_holidays1.yaml', '/home/user/holidays/custom_holidays2.yaml')
229
+ ```
230
+
231
+ ## Extending Ruby's Date and Time classes
232
+
233
+ ### Date
95
234
 
96
235
  To extend the 'Date' class:
97
236
 
98
- require 'holidays/core_extensions/date'
99
- class Date
100
- include Holidays::CoreExtensions::Date
101
- end
237
+ ```
238
+ require 'holidays/core_extensions/date'
239
+ class Date
240
+ include Holidays::CoreExtensions::Date
241
+ end
242
+ ```
102
243
 
103
244
  Now you can check which holidays occur in Iceland on January 1, 2008:
104
245
 
105
- d = Date.civil(2008,7,1)
246
+ ```
247
+ d = Date.civil(2008,7,1)
106
248
 
107
- d.holidays(:is)
108
- => [{:name => 'Nýársdagur'}...]
249
+ d.holidays(:is)
250
+ => [{:name => 'Nýársdagur'}...]
251
+ ```
109
252
 
110
253
  Or lookup Canada Day in different regions:
111
254
 
112
- d = Date.civil(2008,7,1)
255
+ ```
256
+ d = Date.civil(2008,7,1)
257
+
258
+ d.holiday?(:ca) # Canada
259
+ => true
113
260
 
114
- d.holiday?(:ca) # Canada
115
- => true
261
+ d.holiday?(:ca_bc) # British Columbia, Canada
262
+ => true
116
263
 
117
- d.holiday?(:ca_bc) # British Columbia, Canada
118
- => true
264
+ d.holiday?(:fr) # France
265
+ => false
266
+ ```
119
267
 
120
- d.holiday?(:fr) # France
121
- => false
268
+ Or return the new date based on the options:
269
+
270
+ ```
271
+ d = Date.civil(2008,7,1)
272
+ d.change(:year => 2016, :month => 1, :day => 1)
273
+ => #<Date: 2016-01-01 ((2457389j,0s,0n),+0s,2299161j)>
274
+ ```
122
275
 
123
276
  Or you can calculate the day of the month:
124
277
 
125
- Date.calculate_mday(2015, 4, :first, 2)
126
- => 7
278
+ ```
279
+ Date.calculate_mday(2015, 4, :first, 2)
280
+ => 7
281
+ ```
282
+
283
+ ### Time
284
+
285
+ ```
286
+ require 'holidays/core_extensions/time'
287
+ class Time
288
+ include Holidays::CoreExtensions::Time
289
+ end
290
+ ```
291
+
292
+ Find end of month for given date:
293
+
294
+ ```
295
+ d = Date.civil(2016,8,1)
296
+ d.end_of_month
297
+ => #<Date: 2016-08-31 ((2457632j,0s,0n),+0s,2299161j)>
298
+ ```
127
299
 
128
- ### Caching Holiday Lookups
300
+ ## Caching Holiday Lookups
129
301
 
130
- If you are checking holidays regularly you can cache your results for improved performance. Run this before looking up a holiday (eg. in an initializer):
302
+ If you are checking holidays regularly you can cache your results for improved performance. Run this before looking up a holiday (e.g. in an initializer):
131
303
 
132
- Holidays.cache_between(Time.now, 2.years.from_now, :ca, :us, :observed)
304
+ ```
305
+ YEAR = 365 * 24 * 60 * 60
306
+ Holidays.cache_between(Time.now, Time.now + 2 * YEAR, :ca, :us, :observed)
307
+ ```
133
308
 
134
309
  Holidays for the regions specified within the dates specified will be pre-calculated and stored in-memory. Future lookups will be much faster.
135
310
 
136
- ### How to contribute
311
+ ## How to contribute
137
312
 
138
- See our [contribution guidelines](CONTRIBUTING.md) for information on how to help out!
313
+ See our [contribution guidelines](doc/CONTRIBUTING.md) for information on how to help out!
139
314
 
140
- ### Credits and code
315
+ ## Credits and code
141
316
 
142
- * Started by [Alex Dunae](http://dunae.ca) (e-mail 'code' at the same domain), 2007-12
143
- * Maintained by [Hana Wang](https://github.com/hahahana), 2013
144
- * Maintained by [Phil Trimble](https://github.com/ptrimble), 2014-present
317
+ * Started by [@alexdunae](http://github.com/alexdunae) 2007-2012
318
+ * Maintained by [@hahahana](https://github.com/hahahana), 2013
319
+ * Maintained by [@ppeble](https://github.com/ppeble), 2014-present
320
+ * Maintained by [@ttwo32](https://github.com/ttwo32), 2016-present
145
321
 
146
322
  Plus all of these [wonderful contributors!](https://github.com/holidays/holidays/contributors)