holidays 4.2.0 → 8.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitmodules +3 -0
- data/CHANGELOG.md +195 -0
- data/Makefile +45 -0
- data/README.md +253 -77
- data/Rakefile +10 -11
- data/bin/console +0 -0
- data/bin/setup +1 -0
- data/doc/CONTRIBUTING.md +72 -0
- data/doc/MAINTAINERS.md +81 -0
- data/{REFERENCES → doc/REFERENCES} +0 -0
- data/holidays.gemspec +9 -9
- data/lib/generated_definitions/MANIFEST +26 -4
- data/lib/generated_definitions/REGIONS.rb +3 -1
- data/lib/generated_definitions/ar.rb +4 -10
- data/lib/generated_definitions/at.rb +3 -9
- data/lib/generated_definitions/au.rb +32 -25
- data/lib/generated_definitions/be_fr.rb +2 -8
- data/lib/generated_definitions/be_nl.rb +2 -8
- data/lib/generated_definitions/bg.rb +2 -8
- data/lib/generated_definitions/br.rb +2 -8
- data/lib/generated_definitions/ca.rb +33 -32
- data/lib/generated_definitions/ch.rb +17 -11
- data/lib/generated_definitions/cl.rb +38 -12
- data/lib/generated_definitions/co.rb +121 -0
- data/lib/generated_definitions/cr.rb +2 -8
- data/lib/generated_definitions/cz.rb +2 -8
- data/lib/generated_definitions/de.rb +11 -14
- data/lib/generated_definitions/dk.rb +2 -8
- data/lib/generated_definitions/{ecb_target.rb → ecbtarget.rb} +10 -16
- data/lib/generated_definitions/ee.rb +36 -0
- data/lib/generated_definitions/el.rb +2 -8
- data/lib/generated_definitions/es.rb +8 -11
- data/lib/generated_definitions/europe.rb +121 -51
- data/lib/generated_definitions/federalreserve.rb +34 -0
- data/lib/generated_definitions/{federal_reserve.rb → federalreservebanks.rb} +14 -20
- data/lib/generated_definitions/fedex.rb +3 -9
- data/lib/generated_definitions/fi.rb +2 -8
- data/lib/generated_definitions/fr.rb +6 -10
- data/lib/generated_definitions/gb.rb +12 -16
- data/lib/generated_definitions/ge.rb +41 -0
- data/lib/generated_definitions/hk.rb +106 -0
- data/lib/generated_definitions/hr.rb +10 -14
- data/lib/generated_definitions/hu.rb +4 -9
- data/lib/generated_definitions/ie.rb +3 -17
- data/lib/generated_definitions/is.rb +3 -9
- data/lib/generated_definitions/it.rb +16 -13
- data/lib/generated_definitions/jp.rb +47 -36
- data/lib/generated_definitions/kr.rb +40 -0
- data/lib/generated_definitions/kz.rb +38 -0
- data/lib/generated_definitions/li.rb +2 -8
- data/lib/generated_definitions/lt.rb +2 -8
- data/lib/generated_definitions/lu.rb +35 -0
- data/lib/generated_definitions/lv.rb +52 -0
- data/lib/generated_definitions/ma.rb +2 -8
- data/lib/generated_definitions/mt_en.rb +38 -0
- data/lib/generated_definitions/mt_mt.rb +38 -0
- data/lib/generated_definitions/mx.rb +6 -12
- data/lib/generated_definitions/my.rb +30 -0
- data/lib/generated_definitions/nerc.rb +2 -8
- data/lib/generated_definitions/ng.rb +33 -0
- data/lib/generated_definitions/nl.rb +2 -8
- data/lib/generated_definitions/no.rb +2 -8
- data/lib/generated_definitions/northamerica.rb +223 -0
- data/lib/generated_definitions/nyse.rb +3 -9
- data/lib/generated_definitions/nz.rb +2 -9
- data/lib/generated_definitions/pe.rb +43 -0
- data/lib/generated_definitions/ph.rb +4 -10
- data/lib/generated_definitions/pl.rb +2 -8
- data/lib/generated_definitions/pt.rb +12 -12
- data/lib/generated_definitions/ro.rb +6 -9
- data/lib/generated_definitions/rs_cyrl.rb +39 -0
- data/lib/generated_definitions/rs_la.rb +39 -0
- data/lib/generated_definitions/ru.rb +37 -0
- data/lib/generated_definitions/scandinavia.rb +3 -9
- data/lib/generated_definitions/se.rb +2 -8
- data/lib/generated_definitions/sg.rb +2 -8
- data/lib/generated_definitions/si.rb +2 -8
- data/lib/generated_definitions/sk.rb +2 -8
- data/lib/generated_definitions/southamerica.rb +228 -0
- data/lib/generated_definitions/th.rb +36 -0
- data/lib/generated_definitions/tn.rb +32 -0
- data/lib/generated_definitions/tr.rb +64 -0
- data/lib/generated_definitions/ua.rb +37 -0
- data/lib/generated_definitions/{united_nations.rb → unitednations.rb} +61 -67
- data/lib/generated_definitions/ups.rb +3 -9
- data/lib/generated_definitions/us.rb +113 -23
- data/lib/generated_definitions/ve.rb +2 -8
- data/lib/generated_definitions/vi.rb +6 -11
- data/lib/generated_definitions/za.rb +2 -8
- data/lib/holidays/core_extensions/date.rb +21 -3
- data/lib/holidays/core_extensions/time.rb +23 -0
- data/lib/holidays/date_calculator/day_of_month.rb +3 -3
- data/lib/holidays/date_calculator/lunar_date.rb +371 -0
- data/lib/holidays/date_calculator/weekend_modifier.rb +0 -7
- data/lib/holidays/definition/context/function_processor.rb +91 -0
- data/lib/holidays/definition/context/generator.rb +37 -96
- data/lib/holidays/definition/context/load.rb +29 -0
- data/lib/holidays/definition/context/merger.rb +0 -4
- data/lib/holidays/definition/decorator/test.rb +37 -0
- data/lib/holidays/definition/entity/test.rb +11 -0
- data/lib/holidays/definition/generator/module.rb +54 -0
- data/lib/holidays/definition/generator/regions.rb +55 -0
- data/lib/holidays/definition/generator/test.rb +51 -0
- data/lib/holidays/definition/parser/custom_method.rb +3 -5
- data/lib/holidays/definition/parser/test.rb +86 -0
- data/lib/holidays/definition/repository/cache.rb +23 -9
- data/lib/holidays/definition/repository/holidays_by_month.rb +10 -2
- data/lib/holidays/definition/repository/proc_result_cache.rb +1 -1
- data/lib/holidays/definition/repository/regions.rb +23 -13
- data/lib/holidays/definition/validator/custom_method.rb +1 -1
- data/lib/holidays/definition/validator/region.rb +2 -11
- data/lib/holidays/definition/validator/test.rb +71 -0
- data/lib/holidays/errors.rb +5 -0
- data/lib/holidays/factory/date_calculator.rb +42 -0
- data/lib/holidays/factory/definition.rb +143 -0
- data/lib/holidays/factory/finder.rb +70 -0
- data/lib/holidays/finder/context/between.rb +45 -0
- data/lib/holidays/{use_case → finder}/context/dates_driver_builder.rb +11 -15
- data/lib/holidays/finder/context/next_holiday.rb +57 -0
- data/lib/holidays/finder/context/parse_options.rb +104 -0
- data/lib/holidays/finder/context/search.rb +110 -0
- data/lib/holidays/finder/context/year_holiday.rb +57 -0
- data/lib/holidays/finder/rules/in_region.rb +31 -0
- data/lib/holidays/finder/rules/year_range.rb +58 -0
- data/lib/holidays/load_all_definitions.rb +16 -17
- data/lib/holidays/version.rb +1 -1
- data/lib/holidays.rb +50 -125
- data/test/coverage_report.rb +26 -0
- data/test/data/test_custom_informal_holidays_defs.yaml +11 -0
- data/test/data/test_custom_year_range_holiday_defs.yaml +13 -10
- data/test/data/test_invalid_region.rb +15 -0
- data/test/data/test_multiple_custom_holiday_defs.yaml +7 -4
- data/test/data/test_multiple_regions_with_conflicts_region_1.yaml +38 -0
- data/test/data/test_multiple_regions_with_conflicts_region_2.yaml +38 -0
- data/test/data/test_region.rb +15 -0
- data/test/data/test_single_custom_holiday_defs.yaml +7 -4
- data/test/data/test_single_custom_holiday_with_custom_procs.yaml +11 -7
- data/test/defs/test_defs_ar.rb +41 -19
- data/test/defs/test_defs_at.rb +18 -11
- data/test/defs/test_defs_au.rb +185 -126
- data/test/defs/test_defs_be_fr.rb +33 -14
- data/test/defs/test_defs_be_nl.rb +33 -14
- data/test/defs/test_defs_bg.rb +29 -17
- data/test/defs/test_defs_br.rb +33 -19
- data/test/defs/test_defs_ca.rb +246 -136
- data/test/defs/test_defs_ch.rb +35 -23
- data/test/defs/test_defs_cl.rb +57 -27
- data/test/defs/test_defs_co.rb +113 -0
- data/test/defs/test_defs_cr.rb +17 -11
- data/test/defs/test_defs_cz.rb +25 -15
- data/test/defs/test_defs_de.rb +60 -59
- data/test/defs/test_defs_dk.rb +31 -19
- data/test/defs/test_defs_ecbtarget.rb +27 -0
- data/test/defs/test_defs_ee.rb +41 -0
- data/test/defs/test_defs_el.rb +29 -17
- data/test/defs/test_defs_es.rb +116 -52
- data/test/defs/test_defs_europe.rb +1382 -701
- data/test/defs/test_defs_federalreserve.rb +113 -0
- data/test/defs/test_defs_federalreservebanks.rb +247 -0
- data/test/defs/test_defs_fedex.rb +19 -12
- data/test/defs/test_defs_fi.rb +47 -27
- data/test/defs/test_defs_fr.rb +31 -18
- data/test/defs/test_defs_gb.rb +120 -51
- data/test/defs/test_defs_ge.rb +53 -0
- data/test/defs/test_defs_hk.rb +59 -0
- data/test/defs/test_defs_hr.rb +32 -18
- data/test/defs/test_defs_hu.rb +34 -16
- data/test/defs/test_defs_ie.rb +41 -25
- data/test/defs/test_defs_is.rb +39 -22
- data/test/defs/test_defs_it.rb +43 -14
- data/test/defs/test_defs_jp.rb +141 -55
- data/test/defs/test_defs_kr.rb +37 -0
- data/test/defs/test_defs_kz.rb +39 -0
- data/test/defs/test_defs_li.rb +20 -20
- data/test/defs/test_defs_lt.rb +51 -30
- data/test/defs/test_defs_lu.rb +35 -0
- data/test/defs/test_defs_lv.rb +90 -0
- data/test/defs/test_defs_ma.rb +17 -11
- data/test/defs/test_defs_mt_en.rb +41 -0
- data/test/defs/test_defs_mt_mt.rb +41 -0
- data/test/defs/test_defs_mx.rb +34 -23
- data/test/defs/test_defs_my.rb +23 -0
- data/test/defs/test_defs_nerc.rb +17 -11
- data/test/defs/test_defs_ng.rb +29 -0
- data/test/defs/test_defs_nl.rb +21 -13
- data/test/defs/test_defs_no.rb +31 -18
- data/test/defs/test_defs_northamerica.rb +644 -0
- data/test/defs/test_defs_nyse.rb +27 -11
- data/test/defs/test_defs_nz.rb +47 -28
- data/test/defs/test_defs_pe.rb +47 -0
- data/test/defs/test_defs_ph.rb +17 -13
- data/test/defs/test_defs_pl.rb +200 -119
- data/test/defs/test_defs_pt.rb +35 -15
- data/test/defs/test_defs_ro.rb +53 -24
- data/test/defs/test_defs_rs_cyrl.rb +46 -0
- data/test/defs/test_defs_rs_la.rb +46 -0
- data/test/defs/test_defs_ru.rb +34 -0
- data/test/defs/test_defs_scandinavia.rb +193 -116
- data/test/defs/test_defs_se.rb +47 -28
- data/test/defs/test_defs_sg.rb +13 -9
- data/test/defs/test_defs_si.rb +93 -24
- data/test/defs/test_defs_sk.rb +29 -17
- data/test/defs/test_defs_southamerica.rb +307 -0
- data/test/defs/test_defs_th.rb +33 -0
- data/test/defs/test_defs_tn.rb +27 -0
- data/test/defs/test_defs_tr.rb +60 -0
- data/test/defs/test_defs_ua.rb +41 -0
- data/test/defs/{test_defs_united_nations.rb → test_defs_unitednations.rb} +3 -4
- data/test/defs/test_defs_ups.rb +19 -12
- data/test/defs/test_defs_us.rb +370 -30
- data/test/defs/test_defs_ve.rb +23 -16
- data/test/defs/test_defs_vi.rb +10 -6
- data/test/defs/test_defs_za.rb +23 -14
- data/test/holidays/core_extensions/test_date.rb +3 -2
- data/test/holidays/core_extensions/test_date_time.rb +60 -0
- data/test/holidays/date_calculator/test_lunar_date.rb +89 -0
- data/test/holidays/definition/context/test_function_processor.rb +199 -0
- data/test/holidays/definition/context/test_generator.rb +66 -35
- data/test/holidays/definition/context/test_load.rb +37 -0
- data/test/holidays/definition/decorator/test_test.rb +123 -0
- data/test/holidays/definition/generator/test_module.rb +268 -0
- data/test/holidays/definition/generator/test_regions.rb +97 -0
- data/test/holidays/definition/generator/test_test.rb +113 -0
- data/test/holidays/definition/parser/test_custom_method.rb +6 -6
- data/test/holidays/definition/parser/test_test.rb +142 -0
- data/test/holidays/definition/repository/test_cache.rb +47 -6
- data/test/holidays/definition/repository/test_holidays_by_month.rb +121 -1
- data/test/holidays/definition/repository/test_proc_result_cache.rb +8 -1
- data/test/holidays/definition/repository/test_regions.rb +31 -13
- data/test/holidays/definition/validator/test_custom_method.rb +5 -0
- data/test/holidays/definition/validator/test_region.rb +16 -12
- data/test/holidays/definition/validator/test_test.rb +60 -0
- data/test/holidays/finder/context/test_between.rb +172 -0
- data/test/holidays/{use_case → finder}/context/test_dates_driver_builder.rb +2 -2
- data/test/holidays/finder/context/test_next_holiday.rb +156 -0
- data/test/holidays/finder/context/test_parse_options.rb +141 -0
- data/test/holidays/finder/context/test_search.rb +232 -0
- data/test/holidays/finder/context/test_year_holiday.rb +202 -0
- data/test/holidays/finder/rules/test_in_region.rb +42 -0
- data/test/holidays/finder/rules/test_year_range.rb +166 -0
- data/test/integration/README.md +9 -0
- data/test/{test_all_regions.rb → integration/test_all_regions.rb} +18 -4
- data/test/integration/test_any_holidays_during_work_week.rb +90 -0
- data/test/integration/test_available_regions.rb +23 -0
- data/test/{test_custom_holidays.rb → integration/test_custom_holidays.rb} +6 -6
- data/test/integration/test_custom_informal_holidays.rb +15 -0
- data/test/{test_custom_year_range_holidays.rb → integration/test_custom_year_range_holidays.rb} +1 -9
- data/test/{test_holidays.rb → integration/test_holidays.rb} +100 -69
- data/test/{test_holidays_between.rb → integration/test_holidays_between.rb} +19 -17
- data/test/integration/test_multiple_regions.rb +71 -0
- data/test/integration/test_multiple_regions_with_conflict.rb +29 -0
- data/test/integration/test_nonstandard_regions.rb +25 -0
- data/test/test_helper.rb +7 -3
- metadata +204 -132
- data/CONTRIBUTING.md +0 -41
- data/benchmark.rb +0 -8
- data/definitions/README.md +0 -353
- data/definitions/ar.yaml +0 -93
- data/definitions/at.yaml +0 -72
- data/definitions/au.yaml +0 -375
- data/definitions/be_fr.yaml +0 -69
- data/definitions/be_nl.yaml +0 -69
- data/definitions/bg.yaml +0 -127
- data/definitions/br.yaml +0 -77
- data/definitions/ca.yaml +0 -302
- data/definitions/ch.yaml +0 -193
- data/definitions/cl.yaml +0 -94
- data/definitions/cr.yaml +0 -65
- data/definitions/cz.yaml +0 -73
- data/definitions/de.yaml +0 -209
- data/definitions/dk.yaml +0 -130
- data/definitions/ecb_target.yaml +0 -44
- data/definitions/el.yaml +0 -84
- data/definitions/es.yaml +0 -203
- data/definitions/federal_reserve.yaml +0 -114
- data/definitions/fedex.yaml +0 -62
- data/definitions/fi.yaml +0 -115
- data/definitions/fr.yaml +0 -79
- data/definitions/gb.yaml +0 -151
- data/definitions/hr.yaml +0 -79
- data/definitions/hu.yaml +0 -63
- data/definitions/ie.yaml +0 -89
- data/definitions/index.yaml +0 -57
- data/definitions/is.yaml +0 -146
- data/definitions/it.yaml +0 -67
- data/definitions/jp.yaml +0 -316
- data/definitions/li.yaml +0 -107
- data/definitions/lt.yaml +0 -89
- data/definitions/ma.yaml +0 -52
- data/definitions/mx.yaml +0 -106
- data/definitions/nerc.yaml +0 -51
- data/definitions/nl.yaml +0 -73
- data/definitions/no.yaml +0 -90
- data/definitions/north_america_informal.yaml +0 -61
- data/definitions/nyse.yaml +0 -64
- data/definitions/nz.yaml +0 -163
- data/definitions/ph.yaml +0 -94
- data/definitions/pl.yaml +0 -320
- data/definitions/pt.yaml +0 -69
- data/definitions/ro.yaml +0 -78
- data/definitions/se.yaml +0 -120
- data/definitions/sg.yaml +0 -56
- data/definitions/si.yaml +0 -86
- data/definitions/sk.yaml +0 -80
- data/definitions/united_nations.yaml +0 -189
- data/definitions/ups.yaml +0 -62
- data/definitions/us.yaml +0 -103
- data/definitions/ve.yaml +0 -74
- data/definitions/vi.yaml +0 -29
- data/definitions/za.yaml +0 -80
- data/lib/generated_definitions/north_america.rb +0 -126
- data/lib/holidays/date_calculator_factory.rb +0 -35
- data/lib/holidays/definition_factory.rb +0 -86
- data/lib/holidays/option/context/parse_options.rb +0 -106
- data/lib/holidays/option_factory.rb +0 -15
- data/lib/holidays/use_case/context/between.rb +0 -45
- data/lib/holidays/use_case/context/context_common.rb +0 -123
- data/lib/holidays/use_case/context/next_holiday.rb +0 -54
- data/lib/holidays/use_case_factory.rb +0 -31
- data/test/defs/test_defs_ecb_target.rb +0 -23
- data/test/defs/test_defs_federal_reserve.rb +0 -69
- data/test/defs/test_defs_north_america.rb +0 -195
- data/test/holidays/option/context/test_parse_options.rb +0 -74
- data/test/holidays/test_date_calculator_factory.rb +0 -27
- data/test/holidays/test_definition_factory.rb +0 -49
- data/test/holidays/test_option_factory.rb +0 -9
- data/test/holidays/test_use_case_factory.rb +0 -13
- data/test/holidays/use_case/context/test_between.rb +0 -77
- data/test/test_multiple_regions.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 52c9a215e254d58739f7d8a48d4e1c4057ce10fa146604ed10dd062155103ed1
|
4
|
+
data.tar.gz: 0b5c0c77a7dc1135b516ae88196db1def87813f29d69dcbf15f787d75aee2363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6534de20527e1359dfa809b3cdfd4bb9f1a8b4b2ea6fb5593ff28c0d875b8b271bc2009a308d3ee03b936ab6d56e02be82c1b675859f22cedbd69be42ac0790
|
7
|
+
data.tar.gz: c6ca55b847d05375cc6f4d90046d84d2afce8a93b3e4598ca5be36c01a6c9ef0fa68c98f6a2540d1a04fd8071d1073aa5dece5deb033ee725c41d96f3ba9e805
|
data/.gitmodules
ADDED
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)
|
1
|
+
# Ruby Holidays Gem [![Build Status](https://travis-ci.org/holidays/holidays.svg?branch=master)](https://travis-ci.org/holidays/holidays)
|
2
2
|
|
3
|
-
|
3
|
+
Functionality to deal with holidays in Ruby.
|
4
4
|
|
5
|
-
Extends Ruby's built-in Date
|
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
|
-
|
9
|
+
```
|
10
|
+
gem install holidays
|
11
|
+
```
|
12
|
+
|
13
|
+
## Tested versions
|
14
|
+
|
15
|
+
This gem is tested with the following ruby versions:
|
12
16
|
|
13
|
-
|
17
|
+
* 2.4.5
|
18
|
+
* 2.5.3
|
19
|
+
* 2.6.1
|
20
|
+
* JRuby 9.2.5.0
|
14
21
|
|
15
|
-
|
22
|
+
## Semver
|
16
23
|
|
17
|
-
This gem follows [semantic versioning](http://semver.org/). The
|
18
|
-
|
19
|
-
|
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
|
-
|
35
|
+
## Usage
|
26
36
|
|
27
|
-
|
37
|
+
This gem offers multiple ways to check for holidays for a variety of scenarios.
|
28
38
|
|
29
|
-
|
39
|
+
#### Checking a specific date
|
30
40
|
|
31
|
-
|
32
|
-
=> [{:name => 'ANZAC Day',...}]
|
41
|
+
Get all holidays on April 25, 2008 in Australia:
|
33
42
|
|
34
|
-
|
43
|
+
```
|
44
|
+
Holidays.on(Date.civil(2008, 4, 25), :au)
|
45
|
+
=> [{:name => 'ANZAC Day',...}]
|
46
|
+
```
|
35
47
|
|
36
|
-
|
48
|
+
You can check multiple regions in a single call:
|
37
49
|
|
38
|
-
|
39
|
-
|
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
|
-
|
56
|
+
You can leave off 'regions' to get holidays for any region in our [definitions](https://github.com/holidays/definitions):
|
42
57
|
|
43
|
-
|
44
|
-
|
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
|
-
|
47
|
-
=> [{:name => 'Canada Day',...}
|
48
|
-
{:name => 'Independence Day',...}]
|
67
|
+
#### Checking a date range
|
49
68
|
|
50
|
-
Get
|
69
|
+
Get all holidays during the month of July 2008 in Canada and the US:
|
51
70
|
|
52
|
-
|
53
|
-
|
71
|
+
```
|
72
|
+
from = Date.civil(2008,7,1)
|
73
|
+
to = Date.civil(2008,7,31)
|
54
74
|
|
55
|
-
|
56
|
-
|
75
|
+
Holidays.between(from, to, :ca, :us)
|
76
|
+
=> [{:name => 'Canada Day',...}
|
77
|
+
{:name => 'Independence Day',...}]
|
78
|
+
```
|
57
79
|
|
58
|
-
|
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
|
-
|
61
|
-
|
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
|
-
|
132
|
+
Get all observed US Federal holidays between 2018 and 2019:
|
64
133
|
|
65
|
-
|
66
|
-
|
134
|
+
```
|
135
|
+
from = Date.civil(2018,1,1)
|
136
|
+
to = Date.civil(2019,12,31)
|
67
137
|
|
68
|
-
|
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
|
-
|
71
|
-
=> [{:name => "St. Patrick's Day",...}, {:name => "Good Friday",...}, {:name => "Easter Sunday",...}]
|
143
|
+
#### Check whether any holidays occur during work week
|
72
144
|
|
73
|
-
|
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
|
-
|
147
|
+
Check whether a holiday falls during first week of the year for any region:
|
76
148
|
|
77
|
-
|
149
|
+
```
|
150
|
+
Holidays.any_holidays_during_work_week?(Date.civil(2016, 1, 1))
|
151
|
+
=> true
|
152
|
+
```
|
78
153
|
|
79
|
-
|
154
|
+
You can also pass in `informal` or `observed`:
|
80
155
|
|
81
|
-
|
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
|
-
|
171
|
+
#### Find the next holiday(s) that will occur from a specific date
|
84
172
|
|
85
|
-
|
86
|
-
=> [{:name => 'Company Founding',...}]
|
173
|
+
Get the next holidays occurring from February 23, 2016 for the US:
|
87
174
|
|
88
|
-
|
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
|
-
|
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
|
-
|
182
|
+
#### Find all holidays occuring starting from a specific date to the end of the year
|
93
183
|
|
94
|
-
|
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
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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
|
-
|
246
|
+
```
|
247
|
+
d = Date.civil(2008,7,1)
|
106
248
|
|
107
|
-
|
108
|
-
|
249
|
+
d.holidays(:is)
|
250
|
+
=> [{:name => 'Nýársdagur'}...]
|
251
|
+
```
|
109
252
|
|
110
253
|
Or lookup Canada Day in different regions:
|
111
254
|
|
112
|
-
|
255
|
+
```
|
256
|
+
d = Date.civil(2008,7,1)
|
257
|
+
|
258
|
+
d.holiday?(:ca) # Canada
|
259
|
+
=> true
|
113
260
|
|
114
|
-
|
115
|
-
|
261
|
+
d.holiday?(:ca_bc) # British Columbia, Canada
|
262
|
+
=> true
|
116
263
|
|
117
|
-
|
118
|
-
|
264
|
+
d.holiday?(:fr) # France
|
265
|
+
=> false
|
266
|
+
```
|
119
267
|
|
120
|
-
|
121
|
-
|
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
|
-
|
126
|
-
|
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
|
-
|
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 (
|
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
|
-
|
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
|
-
|
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
|
-
|
315
|
+
## Credits and code
|
141
316
|
|
142
|
-
* Started by [
|
143
|
-
* Maintained by [
|
144
|
-
* Maintained by [
|
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)
|