holidays 6.6.1 → 8.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +25 -0
- data/CHANGELOG.md +76 -0
- data/README.md +74 -60
- data/doc/CONTRIBUTING.md +2 -1
- data/holidays.gemspec +10 -5
- data/lib/generated_definitions/MANIFEST +13 -5
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/ar.rb +28 -9
- data/lib/generated_definitions/at.rb +2 -2
- data/lib/generated_definitions/au.rb +60 -12
- data/lib/generated_definitions/be_fr.rb +2 -2
- data/lib/generated_definitions/be_nl.rb +2 -2
- data/lib/generated_definitions/bg.rb +2 -2
- data/lib/generated_definitions/br.rb +4 -3
- data/lib/generated_definitions/ca.rb +25 -17
- data/lib/generated_definitions/ch.rb +15 -3
- data/lib/generated_definitions/cl.rb +7 -7
- data/lib/generated_definitions/co.rb +2 -2
- data/lib/generated_definitions/cr.rb +2 -2
- data/lib/generated_definitions/cz.rb +2 -2
- data/lib/generated_definitions/de.rb +12 -7
- data/lib/generated_definitions/dk.rb +3 -3
- data/lib/generated_definitions/{ecb_target.rb → ecbtarget.rb} +10 -10
- data/lib/generated_definitions/ee.rb +2 -2
- data/lib/generated_definitions/el.rb +2 -2
- data/lib/generated_definitions/es.rb +6 -4
- data/lib/generated_definitions/europe.rb +135 -46
- data/lib/generated_definitions/{federal_reserve.rb → federalreserve.rb} +15 -14
- data/lib/generated_definitions/federalreservebanks.rb +35 -0
- data/lib/generated_definitions/fedex.rb +2 -2
- data/lib/generated_definitions/fi.rb +2 -2
- data/lib/generated_definitions/fr.rb +4 -4
- data/lib/generated_definitions/gb.rb +15 -7
- data/lib/generated_definitions/ge.rb +2 -2
- data/lib/generated_definitions/gr.rb +38 -0
- data/lib/generated_definitions/hk.rb +2 -2
- data/lib/generated_definitions/hr.rb +10 -8
- data/lib/generated_definitions/hu.rb +4 -3
- data/lib/generated_definitions/ie.rb +2 -2
- data/lib/generated_definitions/is.rb +2 -2
- data/lib/generated_definitions/it.rb +16 -7
- data/lib/generated_definitions/jp.rb +31 -16
- data/lib/generated_definitions/ke.rb +34 -0
- data/lib/generated_definitions/kr.rb +2 -2
- data/lib/generated_definitions/kz.rb +38 -0
- data/lib/generated_definitions/li.rb +2 -2
- data/lib/generated_definitions/lt.rb +4 -3
- data/lib/generated_definitions/lu.rb +4 -2
- data/lib/generated_definitions/lv.rb +56 -0
- data/lib/generated_definitions/ma.rb +2 -2
- data/lib/generated_definitions/mt_en.rb +2 -2
- data/lib/generated_definitions/mt_mt.rb +2 -2
- data/lib/generated_definitions/mx.rb +7 -7
- data/lib/generated_definitions/my.rb +2 -2
- data/lib/generated_definitions/nerc.rb +2 -2
- data/lib/generated_definitions/ng.rb +33 -0
- data/lib/generated_definitions/nl.rb +2 -2
- data/lib/generated_definitions/no.rb +2 -2
- data/lib/generated_definitions/{north_america.rb → northamerica.rb} +34 -26
- data/lib/generated_definitions/nyse.rb +3 -2
- data/lib/generated_definitions/nz.rb +43 -4
- data/lib/generated_definitions/pe.rb +2 -2
- data/lib/generated_definitions/ph.rb +2 -2
- data/lib/generated_definitions/pl.rb +2 -2
- data/lib/generated_definitions/pt.rb +2 -2
- data/lib/generated_definitions/ro.rb +6 -3
- data/lib/generated_definitions/rs_cyrl.rb +3 -3
- data/lib/generated_definitions/rs_la.rb +3 -3
- data/lib/generated_definitions/ru.rb +2 -2
- data/lib/generated_definitions/scandinavia.rb +3 -3
- data/lib/generated_definitions/se.rb +2 -2
- data/lib/generated_definitions/sg.rb +2 -2
- data/lib/generated_definitions/si.rb +4 -3
- data/lib/generated_definitions/sk.rb +2 -2
- data/lib/generated_definitions/{south_america.rb → southamerica.rb} +33 -13
- data/lib/generated_definitions/th.rb +36 -0
- data/lib/generated_definitions/tn.rb +2 -2
- data/lib/generated_definitions/tr.rb +7 -5
- data/lib/generated_definitions/ua.rb +37 -0
- data/lib/generated_definitions/{united_nations.rb → unitednations.rb} +61 -61
- data/lib/generated_definitions/ups.rb +2 -2
- data/lib/generated_definitions/us.rb +9 -9
- data/lib/generated_definitions/ve.rb +2 -2
- data/lib/generated_definitions/vi.rb +2 -2
- data/lib/generated_definitions/za.rb +3 -3
- data/lib/holidays/definition/context/generator.rb +23 -70
- data/lib/holidays/definition/generator/module.rb +54 -0
- data/lib/holidays/definition/generator/regions.rb +1 -1
- data/lib/holidays/definition/repository/holidays_by_month.rb +9 -1
- data/lib/holidays/factory/definition.rb +7 -0
- data/lib/holidays/finder/context/search.rb +35 -31
- data/lib/holidays/finder/rules/year_range.rb +30 -54
- data/lib/holidays/version.rb +1 -1
- data/lib/holidays.rb +2 -0
- data/test/coverage_report.rb +23 -5
- data/test/data/test_custom_year_range_holiday_defs.yaml +6 -10
- 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/defs/test_defs_ar.rb +20 -4
- data/test/defs/test_defs_au.rb +33 -0
- data/test/defs/test_defs_br.rb +4 -0
- data/test/defs/test_defs_ca.rb +71 -8
- data/test/defs/test_defs_ch.rb +4 -0
- data/test/defs/test_defs_co.rb +3 -3
- data/test/defs/test_defs_de.rb +10 -0
- data/test/defs/test_defs_dk.rb +4 -0
- data/test/defs/{test_defs_ecb_target.rb → test_defs_ecbtarget.rb} +11 -11
- data/test/defs/test_defs_es.rb +2 -0
- data/test/defs/test_defs_europe.rb +262 -39
- data/test/defs/test_defs_federalreserve.rb +119 -0
- data/test/defs/test_defs_federalreservebanks.rb +251 -0
- data/test/defs/test_defs_fr.rb +3 -3
- data/test/defs/test_defs_gb.rb +42 -0
- data/test/defs/{test_defs_el.rb → test_defs_gr.rb} +18 -18
- data/test/defs/test_defs_hr.rb +6 -6
- data/test/defs/test_defs_hu.rb +12 -4
- data/test/defs/test_defs_it.rb +20 -0
- data/test/defs/test_defs_jp.rb +22 -2
- data/test/defs/test_defs_ke.rb +31 -0
- data/test/defs/test_defs_kz.rb +39 -0
- data/test/defs/test_defs_lt.rb +2 -0
- data/test/defs/test_defs_lu.rb +6 -0
- data/test/defs/test_defs_lv.rb +98 -0
- data/test/defs/test_defs_mx.rb +3 -1
- data/test/defs/test_defs_ng.rb +29 -0
- data/test/defs/{test_defs_north_america.rb → test_defs_northamerica.rb} +85 -20
- data/test/defs/test_defs_nyse.rb +7 -0
- data/test/defs/test_defs_nz.rb +8 -0
- data/test/defs/test_defs_ro.rb +14 -0
- data/test/defs/test_defs_rs_cyrl.rb +1 -1
- data/test/defs/test_defs_rs_la.rb +1 -1
- data/test/defs/test_defs_scandinavia.rb +4 -0
- data/test/defs/{test_defs_south_america.rb → test_defs_southamerica.rb} +29 -9
- data/test/defs/test_defs_th.rb +33 -0
- data/test/defs/test_defs_tr.rb +7 -0
- data/test/defs/test_defs_ua.rb +41 -0
- data/test/defs/{test_defs_united_nations.rb → test_defs_unitednations.rb} +3 -3
- data/test/defs/test_defs_us.rb +11 -11
- data/test/holidays/core_extensions/test_date.rb +3 -2
- data/test/holidays/definition/context/test_generator.rb +17 -20
- data/test/holidays/definition/generator/test_module.rb +268 -0
- data/test/holidays/definition/repository/test_holidays_by_month.rb +121 -1
- data/test/holidays/finder/rules/test_year_range.rb +43 -47
- data/test/integration/test_available_regions.rb +1 -1
- data/test/integration/test_custom_year_range_holidays.rb +0 -7
- data/test/integration/test_holidays.rb +2 -36
- data/test/integration/test_holidays_between.rb +11 -1
- data/test/integration/test_multiple_regions_with_conflict.rb +29 -0
- data/test/integration/test_nonstandard_regions.rb +25 -0
- metadata +71 -35
- data/test/defs/test_defs_federal_reserve.rb +0 -113
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 541f4a1cdcc966e2a4fcd290406ce35e0fe5318066ecfbe5dc3e3c7808fc6462
|
4
|
+
data.tar.gz: a0344504afac759b54975ce9e32c0148382f1623fa2e6bd59ca908f41c43a6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e898308850d254f87f84c9a3eb664f81f5306654737c82268c294b8f55764cd6fc5ae152e8e6d4936cf0b509ff9beeb4189ec89ec9579e19d85d6a86d840b3a
|
7
|
+
data.tar.gz: d73797c2f24d6026de777dcd2a3b8d0e4fcbe84e2d1cad68db59f53f9054d43e41922f810491e9317e48b2f42cce3056ac7af8bdb18d19969a0b26639759acf7
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Ruby
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ "master" ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ "master" ]
|
7
|
+
permissions:
|
8
|
+
contents: read
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head']
|
15
|
+
env:
|
16
|
+
BUNDLER_NO_OLD_RUBYGEMS_WARNING: true
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
|
+
- name: Run tests
|
25
|
+
run: make test
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,81 @@
|
|
1
1
|
# Ruby Holidays Gem CHANGELOG
|
2
2
|
|
3
|
+
## 8.8.0
|
4
|
+
|
5
|
+
* Update to [v5.7.4 definitions](https://github.com/holidays/definitions/releases/tag/v5.7.4). Please see the changelog for the definition details.
|
6
|
+
|
7
|
+
## 8.7.1
|
8
|
+
|
9
|
+
* Fix testing issues and github action config, no behavior changes
|
10
|
+
* Remove Travis CI config
|
11
|
+
|
12
|
+
## 8.7.0
|
13
|
+
|
14
|
+
* Update to [v5.6.2 definitions](https://github.com/holidays/definitions/releases/tag/v5.6.2). Please see the changelog for the definition details.
|
15
|
+
* Add support for ruby 2.7, 3.0, 3.1, 3.2, 3.3
|
16
|
+
* Add GitHub actions support since Travis CI is not free for OSS anymore
|
17
|
+
|
18
|
+
## 8.6.0
|
19
|
+
|
20
|
+
* Update to [v5.5.0 definitions](https://github.com/holidays/definitions/releases/tag/v5.5.0). Please see the changelog for the definition details.
|
21
|
+
* Temporarily remove jruby from required jobs due to test coverage issues
|
22
|
+
|
23
|
+
## 8.5.0
|
24
|
+
|
25
|
+
* Update submodule definitions.
|
26
|
+
* Thanks to contributors!!
|
27
|
+
|
28
|
+
## 8.4.1
|
29
|
+
|
30
|
+
* Fix jp holidays from 2022.
|
31
|
+
|
32
|
+
## 8.4.0
|
33
|
+
|
34
|
+
* Update submodule definitions
|
35
|
+
* Thanks to contributors!!
|
36
|
+
|
37
|
+
|
38
|
+
## 8.3.0
|
39
|
+
|
40
|
+
* Update submodule definitions
|
41
|
+
* Remove test about feb 29 on non leap year.
|
42
|
+
* Thanks to contributors!!
|
43
|
+
|
44
|
+
## 8.2.0
|
45
|
+
|
46
|
+
* Update submodule definitions. Thanks to contributors!!
|
47
|
+
|
48
|
+
## 8.1.0
|
49
|
+
|
50
|
+
* Update submodule definitions, so that the newest holidays from the definition
|
51
|
+
gem are represent here.
|
52
|
+
|
53
|
+
## 8.0.0
|
54
|
+
|
55
|
+
* Remove support for ruby 2.2 and ruby 2.3.
|
56
|
+
* Add support for latest ruby 2.6
|
57
|
+
* Update to [v5.0.1 definitions](https://github.com/holidays/definitions/releases/tag/v5.0.1). Please see the changelog for the definition details.
|
58
|
+
|
59
|
+
## 7.1.0
|
60
|
+
|
61
|
+
* Update to [v4.1.0 definitions](https://github.com/holidays/definitions/releases/tag/v4.1.0). Please see the changelog for the definition details.
|
62
|
+
|
63
|
+
## 7.0.0
|
64
|
+
|
65
|
+
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.
|
66
|
+
|
67
|
+
Affected regions:
|
68
|
+
|
69
|
+
* `ecb_target` region changed to `ecbtarget`
|
70
|
+
* `federal_reserve` region changed to `federalreserve`
|
71
|
+
* `federalreservebanks` region changed to `federalreservebanks`
|
72
|
+
* `north_america_informal` region changed to `northamericainformal`
|
73
|
+
* `united_nations` region changed to `unitednations`
|
74
|
+
* `north_america` region changed to `northamerica`
|
75
|
+
* `south_america` region changed to `southamerica`
|
76
|
+
|
77
|
+
Please see the [definitions v4.0.0 CHANGELOG](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400) for the full change list.
|
78
|
+
|
3
79
|
## 6.6.1
|
4
80
|
|
5
81
|
* 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)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ruby Holidays Gem [![Build Status](https://
|
1
|
+
# Ruby Holidays Gem [![Build Status](https://github.com/holidays/holidays/actions/workflows/ruby.yml/badge.svg)](https://github.com/holidays/holidays/actions/workflows/ruby.yml)
|
2
2
|
|
3
3
|
Functionality to deal with holidays in Ruby.
|
4
4
|
|
@@ -14,11 +14,16 @@ gem install holidays
|
|
14
14
|
|
15
15
|
This gem is tested with the following ruby versions:
|
16
16
|
|
17
|
-
* 2.
|
18
|
-
* 2.3
|
19
|
-
* 2.
|
20
|
-
* 2.
|
21
|
-
*
|
17
|
+
* 2.4.5
|
18
|
+
* 2.5.3
|
19
|
+
* 2.6.1
|
20
|
+
* 2.7.7
|
21
|
+
* 3.0.6
|
22
|
+
* 3.1.4
|
23
|
+
* 3.2.2
|
24
|
+
* 3.3.0
|
25
|
+
* JRuby 9.2.21.0
|
26
|
+
* JRuby 9.4.2.0
|
22
27
|
|
23
28
|
## Semver
|
24
29
|
|
@@ -41,23 +46,23 @@ This gem offers multiple ways to check for holidays for a variety of scenarios.
|
|
41
46
|
|
42
47
|
Get all holidays on April 25, 2008 in Australia:
|
43
48
|
|
44
|
-
```
|
45
|
-
Holidays.on(Date.
|
49
|
+
```ruby
|
50
|
+
Holidays.on(Date.new(2008, 4, 25), :au)
|
46
51
|
=> [{:name => 'ANZAC Day',...}]
|
47
52
|
```
|
48
53
|
|
49
54
|
You can check multiple regions in a single call:
|
50
55
|
|
51
|
-
```
|
52
|
-
Holidays.on(Date.
|
56
|
+
```ruby
|
57
|
+
Holidays.on(Date.new(2008, 1, 1), :us, :fr)
|
53
58
|
=> [{:name=>"New Year's Day", :regions=>[:us],...},
|
54
59
|
{:name=>"Jour de l'an", :regions=>[:fr],...}]
|
55
60
|
```
|
56
61
|
|
57
62
|
You can leave off 'regions' to get holidays for any region in our [definitions](https://github.com/holidays/definitions):
|
58
63
|
|
59
|
-
```
|
60
|
-
Holidays.on(Date.
|
64
|
+
```ruby
|
65
|
+
Holidays.on(Date.new(2007, 4, 25))
|
61
66
|
=> [{:name=>"ANZAC Day", :regions=>[:au],...},
|
62
67
|
{:name=>"Festa della Liberazione", :regions=>[:it],...},
|
63
68
|
{:name=>"Dia da Liberdade", :regions=>[:pt],...}
|
@@ -69,9 +74,9 @@ You can leave off 'regions' to get holidays for any region in our [definitions](
|
|
69
74
|
|
70
75
|
Get all holidays during the month of July 2008 in Canada and the US:
|
71
76
|
|
72
|
-
```
|
73
|
-
from = Date.
|
74
|
-
to = Date.
|
77
|
+
```ruby
|
78
|
+
from = Date.new(2008,7,1)
|
79
|
+
to = Date.new(2008,7,31)
|
75
80
|
|
76
81
|
Holidays.between(from, to, :ca, :us)
|
77
82
|
=> [{:name => 'Canada Day',...}
|
@@ -86,23 +91,23 @@ By default this flag is turned off, meaning no informal holidays will be returne
|
|
86
91
|
|
87
92
|
Get Valentine's Day in the US:
|
88
93
|
|
89
|
-
```
|
94
|
+
```ruby
|
90
95
|
Holidays.on(Date.new(2018, 2, 14), :us, :informal)
|
91
96
|
=> [{:name=>"Valentine's Day",...}]
|
92
97
|
```
|
93
98
|
|
94
99
|
Leaving off 'informal' will mean that Valentine's Day is not returned:
|
95
100
|
|
96
|
-
```
|
101
|
+
```ruby
|
97
102
|
Holidays.on(Date.new(2018, 2, 14), :us)
|
98
103
|
=> []
|
99
104
|
```
|
100
105
|
|
101
106
|
Get informal holidays during the month of February 2008 for any region:
|
102
107
|
|
103
|
-
```
|
104
|
-
from = Date.
|
105
|
-
to = Date.
|
108
|
+
```ruby
|
109
|
+
from = Date.new(2008,2,1)
|
110
|
+
to = Date.new(2008,2,15)
|
106
111
|
|
107
112
|
Holidays.between(from, to, :informal)
|
108
113
|
=> [{:name => 'Valentine\'s Day',...}]
|
@@ -116,27 +121,28 @@ By default this flag is turned off, meaning no observed logic will be applied.
|
|
116
121
|
|
117
122
|
Get holidays that are observed on Monday July 2, 2007 in British Columbia, Canada:
|
118
123
|
|
119
|
-
```
|
120
|
-
Holidays.on(Date.
|
124
|
+
```ruby
|
125
|
+
Holidays.on(Date.new(2007, 7, 2), :ca_bc, :observed)
|
121
126
|
=> [{:name => 'Canada Day',...}]
|
122
127
|
```
|
123
128
|
|
124
129
|
Leaving off the 'observed' flag will mean that 'Canada Day' is not returned since it actually falls on Sunday July 1:
|
125
130
|
|
126
|
-
```
|
127
|
-
Holidays.on(Date.
|
131
|
+
```ruby
|
132
|
+
Holidays.on(Date.new(2007, 7, 2), :ca_bc)
|
128
133
|
=> []
|
129
|
-
|
134
|
+
|
135
|
+
Holidays.on(Date.new(2007, 7, 1), :ca_bc)
|
130
136
|
=> [{:name=>"Canada Day", :regions=>[:ca],...}]
|
131
137
|
```
|
132
138
|
|
133
139
|
Get all observed US Federal holidays between 2018 and 2019:
|
134
140
|
|
135
|
-
```
|
136
|
-
from = Date.
|
137
|
-
to = Date.
|
141
|
+
```ruby
|
142
|
+
from = Date.new(2018,1,1)
|
143
|
+
to = Date.new(2019,12,31)
|
138
144
|
|
139
|
-
Holidays.between(from, to, :
|
145
|
+
Holidays.between(from, to, :federalreserve, :observed)
|
140
146
|
=> [{:name => "New Year's Day"....}
|
141
147
|
{:name => "Birthday of Martin Luther King, Jr"....}]
|
142
148
|
```
|
@@ -147,25 +153,28 @@ Check if there are any holidays taking place during a specified work week. 'Work
|
|
147
153
|
|
148
154
|
Check whether a holiday falls during first week of the year for any region:
|
149
155
|
|
150
|
-
```
|
151
|
-
Holidays.any_holidays_during_work_week?(Date.
|
156
|
+
```ruby
|
157
|
+
Holidays.any_holidays_during_work_week?(Date.new(2016, 1, 1))
|
152
158
|
=> true
|
153
159
|
```
|
154
160
|
|
155
161
|
You can also pass in `informal` or `observed`:
|
156
162
|
|
157
|
-
```
|
163
|
+
```ruby
|
158
164
|
# Returns true since Valentine's Day falls on a Wednesday
|
159
|
-
|
165
|
+
Holidays.any_holidays_during_work_week?(Date.new(2018, 2, 14), :us, :informal)
|
160
166
|
=> true
|
167
|
+
|
161
168
|
# Returns false if you don't specify informal
|
162
|
-
|
169
|
+
Holidays.any_holidays_during_work_week?(Date.new(2018, 2, 14), :us)
|
163
170
|
=> false
|
171
|
+
|
164
172
|
# Returns true since Veteran's Day is observed on Monday November 12, 2018
|
165
|
-
|
173
|
+
Holidays.any_holidays_during_work_week?(Date.new(2018, 11, 12), :us, :observed)
|
166
174
|
=> true
|
175
|
+
|
167
176
|
# Returns false if you don't specify observed since the actual holiday is on Sunday November 11th 2018
|
168
|
-
|
177
|
+
Holidays.any_holidays_during_work_week?(Date.new(2018, 11, 12), :us)
|
169
178
|
=> false
|
170
179
|
```
|
171
180
|
|
@@ -173,21 +182,21 @@ irb(main):005:0> Holidays.any_holidays_during_work_week?(Date.civil(2018, 11, 12
|
|
173
182
|
|
174
183
|
Get the next holidays occurring from February 23, 2016 for the US:
|
175
184
|
|
176
|
-
```
|
177
|
-
Holidays.next_holidays(3, [:us, :informal], Date.
|
185
|
+
```ruby
|
186
|
+
Holidays.next_holidays(3, [:us, :informal], Date.new(2016, 2, 23))
|
178
187
|
=> [{:name => "St. Patrick's Day",...}, {:name => "Good Friday",...}, {:name => "Easter Sunday",...}]
|
179
188
|
```
|
180
189
|
|
181
190
|
You can specify the number of holidays to return. This method will default to `Date.today` if no date is provided.
|
182
191
|
|
183
|
-
#### Find all holidays
|
192
|
+
#### Find all holidays occurring starting from a specific date to the end of the year
|
184
193
|
|
185
194
|
Get all holidays starting from February 23, 2016 to end of year in the US:
|
186
195
|
|
187
|
-
```
|
188
|
-
Holidays.year_holidays([:ca_on], Date.
|
196
|
+
```ruby
|
197
|
+
Holidays.year_holidays([:ca_on], Date.new(2016, 2, 23))
|
189
198
|
=> [{:name=>"Good Friday",...},
|
190
|
-
{name=>"Easter Sunday",...},
|
199
|
+
{:name=>"Easter Sunday",...},
|
191
200
|
{:name=>"Victoria Day",...},
|
192
201
|
{:name=>"Canada Day",...},
|
193
202
|
{:name=>"Civic Holiday",...},
|
@@ -204,7 +213,7 @@ This method will default to `Date.today` if no date is provided.
|
|
204
213
|
|
205
214
|
Return all available regions:
|
206
215
|
|
207
|
-
```
|
216
|
+
```ruby
|
208
217
|
Holidays.available_regions
|
209
218
|
=> [:ar, :at, ..., :sg] # this will be a big array
|
210
219
|
```
|
@@ -215,18 +224,21 @@ In addition to the [provided definitions](https://github.com/holidays/definition
|
|
215
224
|
|
216
225
|
To load custom 'Company Founding' holiday on June 1st:
|
217
226
|
|
218
|
-
```
|
227
|
+
```ruby
|
219
228
|
Holidays.load_custom('/home/user/holiday_definitions/custom_holidays.yaml')
|
220
|
-
Holidays.on(Date.
|
221
|
-
|
229
|
+
Holidays.on(Date.new(2013, 6, 1), :my_custom_region)
|
230
|
+
=> [{:name => 'Company Founding',...}]
|
222
231
|
```
|
223
232
|
|
224
233
|
Custom definition files must match the [syntax of the existing definition files](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md).
|
225
234
|
|
226
235
|
Multiple files can be loaded at the same time:
|
227
236
|
|
228
|
-
```
|
229
|
-
Holidays.load_custom(
|
237
|
+
```ruby
|
238
|
+
Holidays.load_custom(
|
239
|
+
'/home/user/holidays/custom_holidays1.yaml',
|
240
|
+
'/home/user/holidays/custom_holidays2.yaml'
|
241
|
+
)
|
230
242
|
```
|
231
243
|
|
232
244
|
## Extending Ruby's Date and Time classes
|
@@ -235,8 +247,9 @@ Holidays.load_custom('/home/user/holidays/custom_holidays1.yaml', '/home/user/ho
|
|
235
247
|
|
236
248
|
To extend the 'Date' class:
|
237
249
|
|
238
|
-
```
|
250
|
+
```ruby
|
239
251
|
require 'holidays/core_extensions/date'
|
252
|
+
|
240
253
|
class Date
|
241
254
|
include Holidays::CoreExtensions::Date
|
242
255
|
end
|
@@ -244,8 +257,8 @@ end
|
|
244
257
|
|
245
258
|
Now you can check which holidays occur in Iceland on January 1, 2008:
|
246
259
|
|
247
|
-
```
|
248
|
-
d = Date.
|
260
|
+
```ruby
|
261
|
+
d = Date.new(2008,7,1)
|
249
262
|
|
250
263
|
d.holidays(:is)
|
251
264
|
=> [{:name => 'Nýársdagur'}...]
|
@@ -253,8 +266,8 @@ d.holidays(:is)
|
|
253
266
|
|
254
267
|
Or lookup Canada Day in different regions:
|
255
268
|
|
256
|
-
```
|
257
|
-
d = Date.
|
269
|
+
```ruby
|
270
|
+
d = Date.new(2008,7,1)
|
258
271
|
|
259
272
|
d.holiday?(:ca) # Canada
|
260
273
|
=> true
|
@@ -268,23 +281,24 @@ d.holiday?(:fr) # France
|
|
268
281
|
|
269
282
|
Or return the new date based on the options:
|
270
283
|
|
271
|
-
```
|
272
|
-
d = Date.
|
284
|
+
```ruby
|
285
|
+
d = Date.new(2008,7,1)
|
273
286
|
d.change(:year => 2016, :month => 1, :day => 1)
|
274
287
|
=> #<Date: 2016-01-01 ((2457389j,0s,0n),+0s,2299161j)>
|
275
288
|
```
|
276
289
|
|
277
290
|
Or you can calculate the day of the month:
|
278
291
|
|
279
|
-
```
|
292
|
+
```ruby
|
280
293
|
Date.calculate_mday(2015, 4, :first, 2)
|
281
294
|
=> 7
|
282
295
|
```
|
283
296
|
|
284
297
|
### Time
|
285
298
|
|
286
|
-
```
|
299
|
+
```ruby
|
287
300
|
require 'holidays/core_extensions/time'
|
301
|
+
|
288
302
|
class Time
|
289
303
|
include Holidays::CoreExtensions::Time
|
290
304
|
end
|
@@ -292,8 +306,8 @@ end
|
|
292
306
|
|
293
307
|
Find end of month for given date:
|
294
308
|
|
295
|
-
```
|
296
|
-
d = Date.
|
309
|
+
```ruby
|
310
|
+
d = Date.new(2016,8,1)
|
297
311
|
d.end_of_month
|
298
312
|
=> #<Date: 2016-08-31 ((2457632j,0s,0n),+0s,2299161j)>
|
299
313
|
```
|
@@ -302,7 +316,7 @@ d.end_of_month
|
|
302
316
|
|
303
317
|
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):
|
304
318
|
|
305
|
-
```
|
319
|
+
```ruby
|
306
320
|
YEAR = 365 * 24 * 60 * 60
|
307
321
|
Holidays.cache_between(Time.now, Time.now + 2 * YEAR, :ca, :us, :observed)
|
308
322
|
```
|
data/doc/CONTRIBUTING.md
CHANGED
@@ -51,7 +51,7 @@ make point-to-defs-master
|
|
51
51
|
## For non-definition functionality
|
52
52
|
|
53
53
|
* Fork this repository
|
54
|
-
* Make your changes
|
54
|
+
* Make your changes. Don't forget to run `make test` to execute the test suite!
|
55
55
|
* Create a PR pointing back to `master`
|
56
56
|
|
57
57
|
Don't worry about versioning, we'll handle it on our end.
|
@@ -63,6 +63,7 @@ Don't worry about versioning, we'll handle it on our end.
|
|
63
63
|
We have included a few handy tasks to help you troubleshoot and test:
|
64
64
|
|
65
65
|
* `make test` - runs the entire suite
|
66
|
+
* `bundle exec ruby <test-file-to-run>` - runs just the tests in the specified file
|
66
67
|
* `REGION=<region> make test-region` - runs the tests for just that region
|
67
68
|
* `make console` - launches an IRB session with the 'holidays' gem loaded for quick testing
|
68
69
|
* `make update-defs` - runs the appropriate git submodule commands to pull the latest definitions
|
data/holidays.gemspec
CHANGED
@@ -12,15 +12,20 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.homepage = 'https://github.com/holidays/holidays'
|
13
13
|
gem.description = %q(A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!)
|
14
14
|
gem.summary = %q(A collection of Ruby methods to deal with statutory and other holidays.)
|
15
|
+
gem.metadata = {
|
16
|
+
'changelog_uri' => "https://github.com/holidays/holidays/blob/master/CHANGELOG.md",
|
17
|
+
'source_code_uri' => 'https://github.com/holidays/holidays',
|
18
|
+
'bug_tracker_uri' => 'https://github.com/holidays/holidays/issues'
|
19
|
+
}
|
15
20
|
gem.files = `git ls-files`.split("\n") - ['.gitignore', '.travis.yml']
|
16
21
|
gem.test_files = gem.files.grep(/^test/)
|
17
22
|
gem.require_paths = ['lib']
|
18
23
|
gem.licenses = ['MIT']
|
19
|
-
gem.required_ruby_version = '
|
20
|
-
gem.add_development_dependency 'bundler', '~>
|
24
|
+
gem.required_ruby_version = '>= 2.4'
|
25
|
+
gem.add_development_dependency 'bundler', '~> 2'
|
21
26
|
gem.add_development_dependency 'rake', '~> 12'
|
22
27
|
gem.add_development_dependency 'simplecov', '~> 0.16'
|
23
|
-
gem.add_development_dependency 'test-unit', '~> 3
|
24
|
-
gem.add_development_dependency 'mocha', '~> 1
|
25
|
-
gem.add_development_dependency 'pry', '~> 0.
|
28
|
+
gem.add_development_dependency 'test-unit', '~> 3'
|
29
|
+
gem.add_development_dependency 'mocha', '~> 1'
|
30
|
+
gem.add_development_dependency 'pry', '~> 0.12'
|
26
31
|
end
|
@@ -18,17 +18,19 @@ The following definition files are included in this installation:
|
|
18
18
|
* generated_definitions/cz
|
19
19
|
* generated_definitions/de
|
20
20
|
* generated_definitions/dk
|
21
|
-
* generated_definitions/
|
21
|
+
* generated_definitions/ecbtarget
|
22
22
|
* generated_definitions/ee
|
23
23
|
* generated_definitions/el
|
24
24
|
* generated_definitions/es
|
25
25
|
* generated_definitions/europe
|
26
|
-
* generated_definitions/
|
26
|
+
* generated_definitions/federalreserve
|
27
|
+
* generated_definitions/federalreservebanks
|
27
28
|
* generated_definitions/fedex
|
28
29
|
* generated_definitions/fi
|
29
30
|
* generated_definitions/fr
|
30
31
|
* generated_definitions/gb
|
31
32
|
* generated_definitions/ge
|
33
|
+
* generated_definitions/gr
|
32
34
|
* generated_definitions/hk
|
33
35
|
* generated_definitions/hr
|
34
36
|
* generated_definitions/hu
|
@@ -36,19 +38,23 @@ The following definition files are included in this installation:
|
|
36
38
|
* generated_definitions/is
|
37
39
|
* generated_definitions/it
|
38
40
|
* generated_definitions/jp
|
41
|
+
* generated_definitions/ke
|
39
42
|
* generated_definitions/kr
|
43
|
+
* generated_definitions/kz
|
40
44
|
* generated_definitions/li
|
41
45
|
* generated_definitions/lt
|
42
46
|
* generated_definitions/lu
|
47
|
+
* generated_definitions/lv
|
43
48
|
* generated_definitions/ma
|
44
49
|
* generated_definitions/mt_en
|
45
50
|
* generated_definitions/mt_mt
|
46
51
|
* generated_definitions/mx
|
47
52
|
* generated_definitions/my
|
48
53
|
* generated_definitions/nerc
|
54
|
+
* generated_definitions/ng
|
49
55
|
* generated_definitions/nl
|
50
56
|
* generated_definitions/no
|
51
|
-
* generated_definitions/
|
57
|
+
* generated_definitions/northamerica
|
52
58
|
* generated_definitions/nyse
|
53
59
|
* generated_definitions/nz
|
54
60
|
* generated_definitions/pe
|
@@ -64,10 +70,12 @@ The following definition files are included in this installation:
|
|
64
70
|
* generated_definitions/sg
|
65
71
|
* generated_definitions/si
|
66
72
|
* generated_definitions/sk
|
67
|
-
* generated_definitions/
|
73
|
+
* generated_definitions/southamerica
|
74
|
+
* generated_definitions/th
|
68
75
|
* generated_definitions/tn
|
69
76
|
* generated_definitions/tr
|
70
|
-
* generated_definitions/
|
77
|
+
* generated_definitions/ua
|
78
|
+
* generated_definitions/unitednations
|
71
79
|
* generated_definitions/ups
|
72
80
|
* generated_definitions/us
|
73
81
|
* generated_definitions/ve
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Holidays
|
3
|
-
REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be_fr, :be_nl, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :us, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cl, :co, :cr, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath, :de_sn, :de_st, :
|
3
|
+
REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be_fr, :be_nl, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :us, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cl, :co, :cr, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :ecbtarget, :ee, :es_pv, :es_na, :es_an, :es_ib, :es_cm, :es_mu, :es_m, :es_ar, :es_cl, :es_cn, :es_lo, :es_ga, :es_ce, :es_o, :es_ex, :es, :es_ct, :es_v, :es_vc, :federalreserve, :federalreservebanks, :fedex, :fi, :fr_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :gb_con, :im, :gb_iom, :ge, :gr, :hr, :hk, :hu, :ie, :is, :it, :it_ve, :it_tv, :it_vr, :it_pd, :it_fi, :it_ge, :it_to, :it_rm, :it_vi, :it_bl, :it_ro, :ke, :kr, :kz, :li, :lt, :lv, :ma, :mt_mt, :mt_en, :mx, :mx_pue, :nerc, :nl, :lu, :no, :nyse, :nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ne, :nz_ot, :nz_ta, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl, :pe, :ph, :pl, :pt, :pt_li, :pt_po, :ro, :rs_cyrl, :rs_la, :ru, :se, :tn, :tr, :ua, :us_fl, :us_la, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pr, :us_tn, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_al, :us_ga, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_il, :us_mt, :us_nm, :us_ny, :us_oh, :us_pa, :us_mi, :us_mn, :us_nv, :us_or, :us_sd, :us_wa, :us_wi, :us_wy, :us_ia, :us_ks, :us_nh, :us_ok, :unitednations, :ups, :za, :ve, :sk, :si, :jp, :vi, :sg, :my, :th, :ng]
|
4
4
|
|
5
|
-
PARENT_REGION_LOOKUP = {:ar=>:ar, :at=>:at, :au=>:au, :au_nsw=>:au, :au_vic=>:au, :au_qld=>:au, :au_nt=>:au, :au_act=>:au, :au_sa=>:au, :au_wa=>:au, :au_tas=>:au, :au_tas_south=>:au, :au_qld_cairns=>:au, :au_qld_brisbane=>:au, :au_tas_north=>:au, :au_vic_melbourne=>:au, :be_fr=>:be_fr, :be_nl=>:be_nl, :br=>:br, :bg_en=>:bg, :bg_bg=>:bg, :ca=>:ca, :ca_qc=>:ca, :ca_ab=>:ca, :ca_sk=>:ca, :ca_on=>:ca, :ca_bc=>:ca, :ca_nb=>:ca, :ca_mb=>:ca, :ca_ns=>:ca, :ca_pe=>:ca, :ca_nl=>:ca, :ca_nt=>:ca, :ca_nu=>:ca, :ca_yt=>:ca, :us=>:us, :ch_zh=>:ch, :ch_be=>:ch, :ch_lu=>:ch, :ch_ur=>:ch, :ch_sz=>:ch, :ch_ow=>:ch, :ch_nw=>:ch, :ch_gl=>:ch, :ch_zg=>:ch, :ch_fr=>:ch, :ch_so=>:ch, :ch_bs=>:ch, :ch_bl=>:ch, :ch_sh=>:ch, :ch_ar=>:ch, :ch_ai=>:ch, :ch_sg=>:ch, :ch_gr=>:ch, :ch_ag=>:ch, :ch_tg=>:ch, :ch_ti=>:ch, :ch_vd=>:ch, :ch_ne=>:ch, :ch_ge=>:ch, :ch_ju=>:ch, :ch_vs=>:ch, :ch=>:ch, :cl=>:cl, :co=>:co, :cr=>:cr, :cz=>:cz, :dk=>:dk, :de=>:de, :de_bw=>:de, :de_by=>:de, :de_he=>:de, :de_nw=>:de, :de_rp=>:de, :de_sl=>:de, :de_sn_sorbian=>:de, :de_th_cath=>:de, :de_sn=>:de, :de_st=>:de, :
|
5
|
+
PARENT_REGION_LOOKUP = {:ar=>:ar, :at=>:at, :au=>:au, :au_nsw=>:au, :au_vic=>:au, :au_qld=>:au, :au_nt=>:au, :au_act=>:au, :au_sa=>:au, :au_wa=>:au, :au_tas=>:au, :au_tas_south=>:au, :au_qld_cairns=>:au, :au_qld_brisbane=>:au, :au_tas_north=>:au, :au_vic_melbourne=>:au, :be_fr=>:be_fr, :be_nl=>:be_nl, :br=>:br, :bg_en=>:bg, :bg_bg=>:bg, :ca=>:ca, :ca_qc=>:ca, :ca_ab=>:ca, :ca_sk=>:ca, :ca_on=>:ca, :ca_bc=>:ca, :ca_nb=>:ca, :ca_mb=>:ca, :ca_ns=>:ca, :ca_pe=>:ca, :ca_nl=>:ca, :ca_nt=>:ca, :ca_nu=>:ca, :ca_yt=>:ca, :us=>:us, :ch_zh=>:ch, :ch_be=>:ch, :ch_lu=>:ch, :ch_ur=>:ch, :ch_sz=>:ch, :ch_ow=>:ch, :ch_nw=>:ch, :ch_gl=>:ch, :ch_zg=>:ch, :ch_fr=>:ch, :ch_so=>:ch, :ch_bs=>:ch, :ch_bl=>:ch, :ch_sh=>:ch, :ch_ar=>:ch, :ch_ai=>:ch, :ch_sg=>:ch, :ch_gr=>:ch, :ch_ag=>:ch, :ch_tg=>:ch, :ch_ti=>:ch, :ch_vd=>:ch, :ch_ne=>:ch, :ch_ge=>:ch, :ch_ju=>:ch, :ch_vs=>:ch, :ch=>:ch, :cl=>:cl, :co=>:co, :cr=>:cr, :cz=>:cz, :dk=>:dk, :de=>:de, :de_bw=>:de, :de_by=>:de, :de_he=>:de, :de_nw=>:de, :de_rp=>:de, :de_sl=>:de, :de_sn_sorbian=>:de, :de_th_cath=>:de, :de_sn=>:de, :de_st=>:de, :de_be=>:de, :de_mv=>:de, :de_by_cath=>:de, :de_by_augsburg=>:de, :de_th=>:de, :de_bb=>:de, :de_hb=>:de, :de_hh=>:de, :de_ni=>:de, :de_sh=>:de, :ecbtarget=>:ecbtarget, :ee=>:ee, :es_pv=>:es, :es_na=>:es, :es_an=>:es, :es_ib=>:es, :es_cm=>:es, :es_mu=>:es, :es_m=>:es, :es_ar=>:es, :es_cl=>:es, :es_cn=>:es, :es_lo=>:es, :es_ga=>:es, :es_ce=>:es, :es_o=>:es, :es_ex=>:es, :es=>:es, :es_ct=>:es, :es_v=>:es, :es_vc=>:es, :federalreserve=>:federalreserve, :federalreservebanks=>:federalreservebanks, :fedex=>:fedex, :fi=>:fi, :fr_a=>:fr, :fr_m=>:fr, :fr=>:fr, :gb=>:gb, :gb_eng=>:gb, :gb_wls=>:gb, :gb_eaw=>:gb, :gb_nir=>:gb, :je=>:gb, :gb_jsy=>:gb, :gg=>:gb, :gb_gsy=>:gb, :gb_sct=>:gb, :gb_con=>:gb, :im=>:gb, :gb_iom=>:gb, :ge=>:ge, :gr=>:gr, :hr=>:hr, :hk=>:hk, :hu=>:hu, :ie=>:ie, :is=>:is, :it=>:it, :it_ve=>:it, :it_tv=>:it, :it_vr=>:it, :it_pd=>:it, :it_fi=>:it, :it_ge=>:it, :it_to=>:it, :it_rm=>:it, :it_vi=>:it, :it_bl=>:it, :it_ro=>:it, :ke=>:ke, :kr=>:kr, :kz=>:kz, :li=>:li, :lt=>:lt, :lv=>:lv, :ma=>:ma, :mt_mt=>:mt_mt, :mt_en=>:mt_en, :mx=>:mx, :mx_pue=>:mx, :nerc=>:nerc, :nl=>:nl, :lu=>:lu, :no=>:no, :nyse=>:nyse, :nz=>:nz, :nz_sl=>:nz, :nz_we=>:nz, :nz_ak=>:nz, :nz_nl=>:nz, :nz_ne=>:nz, :nz_ot=>:nz, :nz_ta=>:nz, :nz_sc=>:nz, :nz_hb=>:nz, :nz_mb=>:nz, :nz_ca=>:nz, :nz_ch=>:nz, :nz_wl=>:nz, :pe=>:pe, :ph=>:ph, :pl=>:pl, :pt=>:pt, :pt_li=>:pt, :pt_po=>:pt, :ro=>:ro, :rs_cyrl=>:rs_cyrl, :rs_la=>:rs_la, :ru=>:ru, :se=>:se, :tn=>:tn, :tr=>:tr, :ua=>:ua, :us_fl=>:us, :us_la=>:us, :us_ct=>:us, :us_de=>:us, :us_gu=>:us, :us_hi=>:us, :us_in=>:us, :us_ky=>:us, :us_nj=>:us, :us_nc=>:us, :us_nd=>:us, :us_pr=>:us, :us_tn=>:us, :us_ms=>:us, :us_id=>:us, :us_ar=>:us, :us_tx=>:us, :us_dc=>:us, :us_md=>:us, :us_va=>:us, :us_vt=>:us, :us_ak=>:us, :us_ca=>:us, :us_me=>:us, :us_ma=>:us, :us_al=>:us, :us_ga=>:us, :us_ne=>:us, :us_mo=>:us, :us_sc=>:us, :us_wv=>:us, :us_vi=>:us, :us_ut=>:us, :us_ri=>:us, :us_az=>:us, :us_co=>:us, :us_il=>:us, :us_mt=>:us, :us_nm=>:us, :us_ny=>:us, :us_oh=>:us, :us_pa=>:us, :us_mi=>:us, :us_mn=>:us, :us_nv=>:us, :us_or=>:us, :us_sd=>:us, :us_wa=>:us, :us_wi=>:us, :us_wy=>:us, :us_ia=>:us, :us_ks=>:us, :us_nh=>:us, :us_ok=>:us, :unitednations=>:unitednations, :ups=>:ups, :za=>:za, :ve=>:southamerica, :sk=>:europe, :si=>:europe, :jp=>:jp, :vi=>:vi, :sg=>:sg, :my=>:my, :th=>:th, :ng=>:ng}
|
6
6
|
end
|
@@ -12,29 +12,48 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Viernes Santo", :regions => [:ar]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -48, :name => "Carnaval Lunes", :regions => [:ar]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Carnaval Martes", :regions => [:ar]}],
|
18
18
|
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:ar]}],
|
19
19
|
3 => [{:mday => 24, :name => "Día Nacional de la Memoria por la Verdad y la Justicia", :regions => [:ar]}],
|
20
20
|
4 => [{:mday => 2, :name => "Día del Veterano y de los Caídos en la Guerra de Malvinas", :regions => [:ar]}],
|
21
21
|
5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:ar]},
|
22
|
-
{:mday => 25, :name => "Día de la Revolución de Mayo", :regions => [:ar]}
|
23
|
-
|
24
|
-
|
22
|
+
{:mday => 25, :name => "Día de la Revolución de Mayo", :regions => [:ar]},
|
23
|
+
{:mday => 24, :year_ranges => { :limited => [2021] },:name => "Feriado con fines turísticos", :regions => [:ar]}],
|
24
|
+
6 => [{:mday => 17, :function => "to_nearest_monday(date)", :function_arguments => [:date], :name => "Paso a la Inmortalidad del General Martín Miguel de Güemes", :regions => [:ar]},
|
25
|
+
{:mday => 20, :name => "Día de la Bandera", :regions => [:ar]}],
|
26
|
+
7 => [{:mday => 8, :year_ranges => { :limited => [2016] },:name => "Feriado con fines turísticos", :regions => [:ar]},
|
25
27
|
{:mday => 9, :name => "Día de la Independencia", :regions => [:ar]}],
|
26
|
-
8 => [{:mday =>
|
27
|
-
10 => [{:mday => 12, :name => "Día del Respeto a la Diversidad Cultural", :regions => [:ar]}
|
28
|
-
|
28
|
+
8 => [{:mday => 17, :function => "to_nearest_monday(date)", :function_arguments => [:date], :name => "Paso a la Inmortalidad del General José de San Martín", :regions => [:ar]}],
|
29
|
+
10 => [{:mday => 12, :function => "to_nearest_monday(date)", :function_arguments => [:date], :name => "Día del Respeto a la Diversidad Cultural", :regions => [:ar]},
|
30
|
+
{:mday => 8, :year_ranges => { :limited => [2021] },:name => "Feriado con fines turísticos", :regions => [:ar]}],
|
31
|
+
11 => [{:mday => 20, :name => "Día de la Soberanía Nacional", :regions => [:ar]},
|
32
|
+
{:mday => 22, :year_ranges => { :limited => [2021] },:name => "Feriado con fines turísticos", :regions => [:ar]}],
|
29
33
|
12 => [{:mday => 8, :name => "Inmaculada Concepción de María", :regions => [:ar]},
|
30
|
-
{:mday => 9, :name => "Feriado
|
34
|
+
{:mday => 9, :year_ranges => { :limited => [2016] },:name => "Feriado con fines turísticos", :regions => [:ar]},
|
31
35
|
{:mday => 25, :name => "Navidad", :regions => [:ar]}]
|
32
36
|
}
|
33
37
|
end
|
34
38
|
|
35
39
|
def self.custom_methods
|
36
40
|
{
|
37
|
-
|
41
|
+
"to_nearest_monday(date)" => Proc.new { |date|
|
42
|
+
case date.wday
|
43
|
+
when 5
|
44
|
+
date += 3
|
45
|
+
when 4
|
46
|
+
date += 4
|
47
|
+
when 3
|
48
|
+
date -= 2
|
49
|
+
when 2
|
50
|
+
date -= 1
|
51
|
+
end
|
52
|
+
|
53
|
+
date
|
54
|
+
},
|
55
|
+
|
56
|
+
|
38
57
|
}
|
39
58
|
end
|
40
59
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Ostermontag", :regions => [:at]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Christi Himmelfahrt", :regions => [:at]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Pfingstmontag", :regions => [:at]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Fronleichnam", :regions => [:at]}],
|
@@ -30,7 +30,7 @@ module Holidays
|
|
30
30
|
|
31
31
|
def self.custom_methods
|
32
32
|
{
|
33
|
-
|
33
|
+
|
34
34
|
}
|
35
35
|
end
|
36
36
|
end
|