holidays 1.0.8 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +19 -0
- data/Rakefile +1 -2
- data/data/au.yaml +81 -1
- data/data/ca.yaml +40 -3
- data/data/cr.yaml +63 -0
- data/data/federal_reserve.yaml +4 -28
- data/data/fedex.yaml +56 -0
- data/data/index.yaml +2 -0
- data/data/jp.yaml +8 -1
- data/lib/holidays.rb +219 -0
- data/lib/holidays/MANIFEST +2 -0
- data/lib/holidays/ar.rb +1 -1
- data/lib/holidays/at.rb +1 -1
- data/lib/holidays/au.rb +27 -4
- data/lib/holidays/be.rb +1 -1
- data/lib/holidays/br.rb +1 -1
- data/lib/holidays/ca.rb +6 -3
- data/lib/holidays/ch.rb +1 -1
- data/lib/holidays/cl.rb +1 -1
- data/lib/holidays/cr.rb +39 -0
- data/lib/holidays/cz.rb +1 -1
- data/lib/holidays/de.rb +2 -2
- data/lib/holidays/dk.rb +1 -1
- data/lib/holidays/ecb_target.rb +1 -1
- data/lib/holidays/el.rb +1 -1
- data/lib/holidays/es.rb +1 -1
- data/lib/holidays/europe.rb +75 -32
- data/lib/holidays/fed_ex.rb +36 -0
- data/lib/holidays/federal_reserve.rb +5 -8
- data/lib/holidays/fi.rb +1 -1
- data/lib/holidays/fr.rb +1 -1
- data/lib/holidays/gb.rb +1 -1
- data/lib/holidays/hr.rb +1 -1
- data/lib/holidays/hu.rb +1 -1
- data/lib/holidays/ie.rb +1 -1
- data/lib/holidays/is.rb +1 -1
- data/lib/holidays/it.rb +1 -1
- data/lib/holidays/jp.rb +3 -2
- data/lib/holidays/li.rb +1 -1
- data/lib/holidays/lt.rb +1 -1
- data/lib/holidays/ma.rb +1 -1
- data/lib/holidays/mx.rb +1 -1
- data/lib/holidays/nerc.rb +1 -1
- data/lib/holidays/nl.rb +1 -1
- data/lib/holidays/no.rb +1 -1
- data/lib/holidays/north_america.rb +8 -5
- data/lib/holidays/nyse.rb +1 -1
- data/lib/holidays/nz.rb +1 -1
- data/lib/holidays/pl.rb +1 -1
- data/lib/holidays/pt.rb +1 -1
- data/lib/holidays/ro.rb +1 -1
- data/lib/holidays/scandinavia.rb +18 -11
- data/lib/holidays/se.rb +1 -1
- data/lib/holidays/sg.rb +1 -1
- data/lib/holidays/si.rb +1 -1
- data/lib/holidays/sk.rb +1 -1
- data/lib/holidays/united_nations.rb +3 -3
- data/lib/holidays/ups.rb +1 -1
- data/lib/holidays/us.rb +1 -1
- data/lib/holidays/ve.rb +1 -1
- data/lib/holidays/version.rb +1 -1
- data/lib/holidays/vi.rb +1 -1
- data/lib/holidays/za.rb +1 -1
- data/test/data/test_custom_govt_holiday_defs.yaml +5 -0
- data/test/data/test_multiple_custom_holiday_defs.yaml +9 -0
- data/test/data/test_single_custom_holiday_defs.yaml +9 -0
- data/test/defs/test_defs_au.rb +32 -0
- data/test/defs/test_defs_ca.rb +25 -0
- data/test/defs/test_defs_cr.rb +22 -0
- data/test/defs/test_defs_de.rb +6 -6
- data/test/defs/test_defs_europe.rb +24 -0
- data/test/defs/test_defs_fed_ex.rb +21 -0
- data/test/defs/test_defs_federal_reserve.rb +2 -15
- data/test/defs/test_defs_jp.rb +1 -0
- data/test/defs/test_defs_north_america.rb +25 -0
- data/test/defs/test_defs_united_nations.rb +12 -0
- data/test/test_custom_holidays.rb +35 -0
- data/test/test_parse_definitions.rb +24 -0
- metadata +22 -3
- data/data/build_defs.rb +0 -157
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6ab4b51615aa61fac469c01fb99d7d94ad6d876
|
4
|
+
data.tar.gz: 4ee8ff425142c2e74de1ca88784679af0a0c99a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e430c6651f9fd96b2c5ec24fccc1e3f8ac93d11e7726e5f6d4c9265296cfd2ad4bc41da5b629f93d883f0ef05f90471f5a37215585747d76d89be708ad78d259
|
7
|
+
data.tar.gz: e586b641f155808fbfd03ce5a0af6207a890aa55c7fbb514be390e6082110a894d1fa69f82af44ac999b80bca568298c18468227646ff46a49dbc3a8e86d33c9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Ruby Holidays Gem CHANGELOG
|
2
2
|
|
3
|
+
## 1.1.0
|
4
|
+
|
5
|
+
* Add support to load custom holidays on the fly
|
6
|
+
* Add hobart & launceston show days (https://github.com/ghiculescu)
|
7
|
+
* Add Melbourne Cup day (https://github.com/ghiculescu)
|
8
|
+
* Add Hobart Regatte Day (https://github.com/ghiculescu)
|
9
|
+
* Add Costa Rican holidays (https://github.com/kevinwmerritt)
|
10
|
+
* Update Canadian Holidays (https://github.com/KevinBrowne)
|
11
|
+
* Add substitute holidays for Japan (https://github.com/YoshiyukiHirano)
|
12
|
+
* Fix USA Federal Reserve Holidays
|
13
|
+
* Add FedEx holidays (https://github.com/adamrunner)
|
14
|
+
|
3
15
|
## 1.0.7
|
4
16
|
|
5
17
|
* Load parent region even when sub region is not explicitly defined (https://github.com/csage)
|
data/README.md
CHANGED
@@ -53,6 +53,25 @@ Get informal holidays in February.
|
|
53
53
|
Holidays.between(from, to, :informal)
|
54
54
|
=> [{:name => 'Valentine\'s Day',...}]
|
55
55
|
|
56
|
+
### Loading Custom Definitions on the fly
|
57
|
+
|
58
|
+
Load custom definitions file on the fly and use them immediately.
|
59
|
+
|
60
|
+
Load custom 'Company Founding' holiday on June 1st:
|
61
|
+
|
62
|
+
Holidays.load_custom('/home/user/holiday_definitions/custom_holidays.yaml')
|
63
|
+
|
64
|
+
date = Date.civil(2013,6,1)
|
65
|
+
|
66
|
+
Holidays.on(date, :my_custom_region)
|
67
|
+
=> [{:name => 'Company Founding',...}]
|
68
|
+
|
69
|
+
Custom definition files must match the format of the existing definition YAML files location in the 'data' directory.
|
70
|
+
|
71
|
+
Multiple files can also be passed:
|
72
|
+
|
73
|
+
Holidays.load_custom('/home/user/holidays/custom_holidays1.yaml', '/home/user/holidays/custom_holidays2.yaml')
|
74
|
+
|
56
75
|
### Extending Ruby's Date class
|
57
76
|
|
58
77
|
Check which holidays occur in Iceland on January 1, 2008.
|
data/Rakefile
CHANGED
@@ -5,7 +5,6 @@ require 'rake/testtask'
|
|
5
5
|
require 'yaml'
|
6
6
|
require 'fileutils'
|
7
7
|
require 'holidays'
|
8
|
-
require File.expand_path('data/build_defs')
|
9
8
|
|
10
9
|
Rake::TestTask.new(:test) do |t|
|
11
10
|
t.libs << 'test'
|
@@ -29,7 +28,7 @@ namespace :generate do
|
|
29
28
|
puts "Building #{region} definition module:"
|
30
29
|
files = files.collect { |f| "#{DATA_PATH}/#{f}" }.uniq
|
31
30
|
|
32
|
-
module_src, test_src =
|
31
|
+
module_src, test_src = Holidays.parse_definition_files_and_return_source(region, files)
|
33
32
|
File.open("lib/holidays/#{region.downcase.to_s}.rb","w") do |file|
|
34
33
|
file.puts module_src
|
35
34
|
end
|
data/data/au.yaml
CHANGED
@@ -12,7 +12,7 @@ months:
|
|
12
12
|
regions: [au]
|
13
13
|
function: easter(year)-2
|
14
14
|
- name: Easter Saturday
|
15
|
-
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa, au_qld_brisbane]
|
15
|
+
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa, au_qld_brisbane, au_qld_cairns]
|
16
16
|
function: easter(year)-1
|
17
17
|
- name: Easter Sunday
|
18
18
|
regions: [au_nsw]
|
@@ -32,6 +32,11 @@ months:
|
|
32
32
|
regions: [au]
|
33
33
|
mday: 26
|
34
34
|
observed: to_monday_if_weekend
|
35
|
+
2:
|
36
|
+
- name: Royal Hobart Regatta
|
37
|
+
regions: [au_tas_south]
|
38
|
+
week: 2
|
39
|
+
wday: 1
|
35
40
|
3:
|
36
41
|
- name: Labour Day
|
37
42
|
regions: [au_wa]
|
@@ -71,11 +76,25 @@ months:
|
|
71
76
|
regions: [au_qld]
|
72
77
|
mday: 6
|
73
78
|
type: informal
|
79
|
+
7:
|
80
|
+
- name: Cairns Show
|
81
|
+
regions: [au_qld_cairns]
|
82
|
+
week: 3
|
83
|
+
wday: 5
|
74
84
|
8:
|
75
85
|
- name: Ekka
|
76
86
|
regions: [au_qld_brisbane]
|
77
87
|
week: -3
|
78
88
|
wday: 3
|
89
|
+
9:
|
90
|
+
- name: Queen's Birthday
|
91
|
+
regions: [au_wa]
|
92
|
+
week: -1
|
93
|
+
wday: 1
|
94
|
+
- name: "Family & Community Day"
|
95
|
+
regions: [au_act]
|
96
|
+
week: -1
|
97
|
+
wday: 1
|
79
98
|
10:
|
80
99
|
- name: Labour Day
|
81
100
|
regions: [au_act, au_nsw, au_sa]
|
@@ -89,6 +108,21 @@ months:
|
|
89
108
|
regions: [au_qld]
|
90
109
|
function: qld_queens_bday_october(year)
|
91
110
|
observed: to_monday_if_weekend
|
111
|
+
- name: Royal Hobart Show
|
112
|
+
regions: [au_tas_south]
|
113
|
+
function: hobart_show_day(year)
|
114
|
+
11:
|
115
|
+
- name: G20 Day
|
116
|
+
regions: [au_qld_brisbane]
|
117
|
+
function: g20_day_2014_only(year)
|
118
|
+
- name: Recreation Day # http://www.timeanddate.com/holidays/australia/recreation-day
|
119
|
+
regions: [au_tas_north]
|
120
|
+
wday: 1
|
121
|
+
week: 1
|
122
|
+
- name: Melbourne Cup Day
|
123
|
+
regions: [au_vic]
|
124
|
+
week: 1
|
125
|
+
wday: 2
|
92
126
|
12:
|
93
127
|
- name: Christmas Day
|
94
128
|
regions: [au]
|
@@ -117,6 +151,19 @@ methods:
|
|
117
151
|
def self.qld_labour_day_october(year)
|
118
152
|
year <= 2012 ? nil : Date.calculate_mday(year, 10, 1, 1)
|
119
153
|
end
|
154
|
+
g20_day_2014_only: |
|
155
|
+
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
|
156
|
+
# G20 day in brisbane, in 2014, on november 14
|
157
|
+
def self.g20_day_2014_only(year)
|
158
|
+
year == 2014 ? 14 : nil
|
159
|
+
end
|
160
|
+
hobart_show_day: |
|
161
|
+
# http://worksafe.tas.gov.au/__data/assets/pdf_file/0008/287036/Public_Holidays_2014.pdf
|
162
|
+
# The Thursday before the fourth Saturday in October.
|
163
|
+
def self.hobart_show_day(year)
|
164
|
+
fourth_sat_in_oct = Date.civil(year, 10, Date.calculate_mday(year, 10, 4, :saturday))
|
165
|
+
fourth_sat_in_oct - 2 # the thursday before
|
166
|
+
end
|
120
167
|
tests: |
|
121
168
|
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
122
169
|
Date.civil(2007,1,26) => 'Australia Day',
|
@@ -153,5 +200,38 @@ tests: |
|
|
153
200
|
assert_equal "Queen's Birthday", Date.civil(2012,10,1).holidays(:au_qld)[0][:name]
|
154
201
|
assert_equal "Queen's Birthday", Date.civil(2013,6,10).holidays(:au_qld)[0][:name]
|
155
202
|
|
203
|
+
assert_equal "Queen's Birthday", Date.civil(2014, 9, 29).holidays(:au_wa)[0][:name]
|
204
|
+
assert_equal "Queen's Birthday", Date.civil(2015, 9, 28).holidays(:au_wa)[0][:name]
|
205
|
+
assert_equal "Queen's Birthday", Date.civil(2016, 9, 26).holidays(:au_wa)[0][:name]
|
206
|
+
|
207
|
+
assert_equal "Family & Community Day", Date.civil(2014, 9, 29).holidays(:au_act)[0][:name]
|
208
|
+
assert_equal "Family & Community Day", Date.civil(2015, 9, 28).holidays(:au_act)[0][:name]
|
209
|
+
assert_equal "Family & Community Day", Date.civil(2016, 9, 26).holidays(:au_act)[0][:name]
|
210
|
+
|
156
211
|
assert_equal 'Australia Day', Date.civil(2014,1,26).holidays(:au_qld)[0][:name]
|
157
212
|
assert_equal 'Australia Day', Date.civil(2014,1,27).holidays(:au_qld, :observed)[0][:name]
|
213
|
+
|
214
|
+
assert_equal 'Cairns Show', Date.civil(2014,7,18).holidays(:au_qld_cairns)[0][:name]
|
215
|
+
assert_equal 'Cairns Show', Date.civil(2013,7,19).holidays(:au_qld_cairns)[0][:name]
|
216
|
+
|
217
|
+
assert_equal 'Royal Hobart Show', Date.civil(2013, 10, 24).holidays(:au_tas_south)[0][:name]
|
218
|
+
assert_equal 'Royal Hobart Show', Date.civil(2014, 10, 23).holidays(:au_tas_south)[0][:name]
|
219
|
+
assert_equal 'Royal Hobart Show', Date.civil(2015, 10, 22).holidays(:au_tas_south)[0][:name]
|
220
|
+
assert_equal 'Royal Hobart Show', Date.civil(2016, 10, 20).holidays(:au_tas_south)[0][:name]
|
221
|
+
|
222
|
+
assert_equal 'Recreation Day', Date.civil(2013, 11, 4).holidays(:au_tas_north)[0][:name]
|
223
|
+
assert_equal 'Recreation Day', Date.civil(2014, 11, 3).holidays(:au_tas_north)[0][:name]
|
224
|
+
assert_equal 'Recreation Day', Date.civil(2015, 11, 2).holidays(:au_tas_north)[0][:name]
|
225
|
+
assert_equal 'Recreation Day', Date.civil(2016, 11, 7).holidays(:au_tas_north)[0][:name]
|
226
|
+
|
227
|
+
assert_equal 'G20 Day', Date.civil(2014,11,14).holidays(:au_qld_brisbane)[0][:name]
|
228
|
+
assert_equal [], Date.civil(2014,11,14).holidays(:au_qld)
|
229
|
+
assert_equal [], Date.civil(2015,11,14).holidays(:au_qld_brisbane)
|
230
|
+
|
231
|
+
assert_equal 'Melbourne Cup Day', Date.civil(2014,11,4).holidays(:au_vic)[0][:name]
|
232
|
+
assert_equal 'Melbourne Cup Day', Date.civil(2015,11,3).holidays(:au_vic)[0][:name]
|
233
|
+
|
234
|
+
assert_equal 'Royal Hobart Regatta', Date.civil(2012, 2, 13).holidays(:au_tas_south)[0][:name]
|
235
|
+
assert_equal 'Royal Hobart Regatta', Date.civil(2014, 2, 10).holidays(:au_tas_south)[0][:name]
|
236
|
+
assert_equal 'Royal Hobart Regatta', Date.civil(2015, 2, 9).holidays(:au_tas_south)[0][:name]
|
237
|
+
assert_equal 'Royal Hobart Regatta', Date.civil(2016, 2, 8).holidays(:au_tas_south)[0][:name]
|
data/data/ca.yaml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Canadian holiday definitions for the Ruby Holiday gem.
|
2
|
-
# Updated
|
2
|
+
# Updated 2014-11-12.
|
3
3
|
---
|
4
4
|
months:
|
5
5
|
0:
|
@@ -29,7 +29,15 @@ months:
|
|
29
29
|
regions: [ca_mb]
|
30
30
|
wday: 1
|
31
31
|
week: 3
|
32
|
-
- name:
|
32
|
+
- name: Nova Scotia Heritage Day # Ideally would be restricted to 2015 or later
|
33
|
+
regions: [ca_ns]
|
34
|
+
wday: 1
|
35
|
+
week: 3
|
36
|
+
- name: Islander Day
|
37
|
+
regions: [ca_pe]
|
38
|
+
wday: 1
|
39
|
+
week: 3
|
40
|
+
- name: BC Family Day # Ideally would be restricted to 2013 or later
|
33
41
|
regions: [ca_bc]
|
34
42
|
wday: 1
|
35
43
|
week: 2
|
@@ -88,7 +96,11 @@ months:
|
|
88
96
|
wday: 1
|
89
97
|
- name: Civic Holiday
|
90
98
|
week: 1
|
91
|
-
regions: [ca_on]
|
99
|
+
regions: [ca_on, ca_nt, ca_nu, ca_pe] # Appears to be a holiday in Ontario by convention
|
100
|
+
wday: 1
|
101
|
+
- name: New Brunswick Day
|
102
|
+
week: 1
|
103
|
+
regions: [ca_nb]
|
92
104
|
wday: 1
|
93
105
|
- name: Discovery Day
|
94
106
|
week: 3
|
@@ -147,8 +159,33 @@ tests: |
|
|
147
159
|
assert_equal 'BC Family Day', Holidays.on(date, :ca_bc)[0][:name]
|
148
160
|
end
|
149
161
|
|
162
|
+
# Nova Scotia Heritage Day
|
163
|
+
[ Date.civil(2015,2,16), Date.civil(2016,2,15) ].each do |date|
|
164
|
+
assert_equal 'Nova Scotia Heritage Day', Holidays.on(date, :ca_ns)[0][:name]
|
165
|
+
end
|
166
|
+
|
167
|
+
# Islander Day in PE
|
168
|
+
[ Date.civil(2013,2,18), Date.civil(2014,2,17) ].each do |date|
|
169
|
+
assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
|
170
|
+
end
|
171
|
+
|
150
172
|
# Victoria Day
|
151
173
|
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
152
174
|
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
153
175
|
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
154
176
|
end
|
177
|
+
|
178
|
+
# First Monday in August
|
179
|
+
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
180
|
+
{ :ca_bc => 'BC Day',
|
181
|
+
:ca_sk => 'Saskatchewan Day',
|
182
|
+
:ca_ab => 'Heritage Day',
|
183
|
+
:ca_ns => 'Natal Day',
|
184
|
+
:ca_on => 'Civic Holiday',
|
185
|
+
:ca_nt => 'Civic Holiday',
|
186
|
+
:ca_nu => 'Civic Holiday',
|
187
|
+
:ca_pe => 'Civic Holiday',
|
188
|
+
:ca_nb => 'New Brunswick Day' }.each do |region, name|
|
189
|
+
assert_equal name, Holidays.on(date, region)[0][:name]
|
190
|
+
end
|
191
|
+
end
|
data/data/cr.yaml
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Costa Rican holiday definitions for the Ruby Holiday gem.
|
2
|
+
#
|
3
|
+
#
|
4
|
+
# Updated: 2014-11-22.
|
5
|
+
#
|
6
|
+
# Sources:
|
7
|
+
# - http://en.wikipedia.org/wiki/Public_holidays_in_Costa_Rica
|
8
|
+
#
|
9
|
+
months:
|
10
|
+
0:
|
11
|
+
- name: Jueves Santo
|
12
|
+
regions: [cr]
|
13
|
+
function: easter(year)-3
|
14
|
+
- name: Viernes Santo
|
15
|
+
regions: [cr]
|
16
|
+
function: easter(year)-2
|
17
|
+
1:
|
18
|
+
- name: Año Nuevo
|
19
|
+
regions: [cr]
|
20
|
+
mday: 1
|
21
|
+
4:
|
22
|
+
- name: Día de Juan Santamaría
|
23
|
+
regions: [cr]
|
24
|
+
mday: 11
|
25
|
+
5:
|
26
|
+
- name: Día del Trabajador
|
27
|
+
regions: [cr]
|
28
|
+
mday: 1
|
29
|
+
7:
|
30
|
+
- name: Día de la Anexión de Guanacaste
|
31
|
+
regions: [cr]
|
32
|
+
mday: 25
|
33
|
+
8:
|
34
|
+
- name: Día de la Virgen de los Angeles
|
35
|
+
regions: [cr]
|
36
|
+
mday: 2
|
37
|
+
- name: Día de la Madre
|
38
|
+
regions: [cr]
|
39
|
+
mday: 15
|
40
|
+
9:
|
41
|
+
- name: Día de la Independencia
|
42
|
+
regions: [cr]
|
43
|
+
mday: 15
|
44
|
+
10:
|
45
|
+
- name: Día de las Culturas
|
46
|
+
regions: [cr]
|
47
|
+
mday: 12
|
48
|
+
12:
|
49
|
+
- name: Navidad
|
50
|
+
regions: [cr]
|
51
|
+
mday: 25
|
52
|
+
tests: |
|
53
|
+
{Date.civil(2015,1,1) => 'Año Nuevo',
|
54
|
+
Date.civil(2015,4,11) => 'Día de Juan Santamaría',
|
55
|
+
Date.civil(2015,5,1) => 'Día del Trabajador',
|
56
|
+
Date.civil(2015,7,25) => 'Día de la Anexión de Guanacaste',
|
57
|
+
Date.civil(2015,8,2) => 'Día de la Virgen de los Angeles',
|
58
|
+
Date.civil(2015,8,15) => 'Día de la Madre',
|
59
|
+
Date.civil(2015,9,15) => 'Día de la Independencia',
|
60
|
+
Date.civil(2015,10,12) => 'Día de las Culturas',
|
61
|
+
Date.civil(2016,12,25) => 'Navidad'}.each do |date, name|
|
62
|
+
assert_equal name, (Holidays.on(date, :cr)[0] || {})[:name]
|
63
|
+
end
|
data/data/federal_reserve.yaml
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
# Federal reserve holidays definition for the Ruby Holiday gem.
|
2
2
|
#
|
3
|
-
# Updated:
|
3
|
+
# Updated: 2015-03-16
|
4
4
|
#
|
5
5
|
# Sources:
|
6
|
-
# -
|
6
|
+
# - http://www.federalreserve.gov/aboutthefed/k8.htm
|
7
7
|
---
|
8
8
|
months:
|
9
|
-
0:
|
10
|
-
- name: Good Friday
|
11
|
-
function: easter(year)-2
|
12
|
-
regions: [federal_reserve]
|
13
9
|
1:
|
14
10
|
- name: New Year's Day
|
15
11
|
regions: [federal_reserve]
|
@@ -57,17 +53,10 @@ months:
|
|
57
53
|
wday: 4
|
58
54
|
regions: [federal_reserve]
|
59
55
|
12:
|
60
|
-
- name: Christmas Eve
|
61
|
-
regions: [federal_reserve]
|
62
|
-
mday: 24
|
63
|
-
observed: to_monday_if_sunday
|
64
56
|
- name: Christmas Day
|
65
57
|
regions: [federal_reserve]
|
66
58
|
mday: 25
|
67
59
|
observed: to_monday_if_sunday
|
68
|
-
- name: New Year's Eve
|
69
|
-
regions: [federal_reserve]
|
70
|
-
mday: 31
|
71
60
|
methods:
|
72
61
|
us_inauguration_day: |
|
73
62
|
# January 20, every fourth year, following Presidential election
|
@@ -80,72 +69,59 @@ tests: |
|
|
80
69
|
{Date.civil(2012,1,2) => "New Year's Day",
|
81
70
|
Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
|
82
71
|
Date.civil(2012,2,20) => "Washington's Birthday",
|
83
|
-
Date.civil(2012,4,6) => "Good Friday",
|
84
72
|
Date.civil(2012,5,28) => "Memorial Day",
|
85
73
|
Date.civil(2012,7,4) => "Independence Day",
|
86
74
|
Date.civil(2012,9,3) => "Labor Day",
|
87
75
|
Date.civil(2012,10,8) => "Columbus Day",
|
88
76
|
Date.civil(2012,11,12) => "Veterans Day",
|
89
77
|
Date.civil(2012,11,22) => "Thanksgiving Day",
|
90
|
-
Date.civil(2012,12,24) => "Christmas Eve",
|
91
78
|
Date.civil(2012,12,25) => "Christmas Day",
|
92
|
-
Date.civil(2012,12,31) => "New Year's Eve",
|
93
79
|
|
94
80
|
Date.civil(2013,1,1) => "New Year's Day",
|
95
81
|
Date.civil(2013,1,21) => "Birthday of Martin Luther King, Jr",
|
96
82
|
Date.civil(2013,2,18) => "Washington's Birthday",
|
97
|
-
Date.civil(2013,3,29) => "Good Friday",
|
98
83
|
Date.civil(2013,5,27) => "Memorial Day",
|
99
84
|
Date.civil(2013,7,4) => "Independence Day",
|
100
85
|
Date.civil(2013,9,2) => "Labor Day",
|
101
86
|
Date.civil(2013,10,14) => "Columbus Day",
|
102
87
|
Date.civil(2013,11,11) => "Veterans Day",
|
103
88
|
Date.civil(2013,11,28) => "Thanksgiving Day",
|
104
|
-
Date.civil(2013,12,24) => "Christmas Eve",
|
105
89
|
Date.civil(2013,12,25) => "Christmas Day",
|
106
|
-
Date.civil(2013,12,31) => "New Year's Eve",
|
107
90
|
|
108
91
|
Date.civil(2014,1,1) => "New Year's Day",
|
109
92
|
Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
|
110
93
|
Date.civil(2014,2,17) => "Washington's Birthday",
|
111
|
-
Date.civil(2014,4,18) => "Good Friday",
|
112
94
|
Date.civil(2014,5,26) => "Memorial Day",
|
113
95
|
Date.civil(2014,7,4) => "Independence Day",
|
114
96
|
Date.civil(2014,9,1) => "Labor Day",
|
115
97
|
Date.civil(2014,10,13) => "Columbus Day",
|
116
98
|
Date.civil(2014,11,11) => "Veterans Day",
|
117
99
|
Date.civil(2014,11,27) => "Thanksgiving Day",
|
118
|
-
Date.civil(2014,12,24) => "Christmas Eve",
|
119
100
|
Date.civil(2014,12,25) => "Christmas Day",
|
120
|
-
Date.civil(2014,12,31) => "New Year's Eve",
|
121
101
|
|
122
102
|
Date.civil(2015,1,1) => "New Year's Day",
|
123
103
|
Date.civil(2015,1,19) => "Birthday of Martin Luther King, Jr",
|
124
104
|
Date.civil(2015,2,16) => "Washington's Birthday",
|
125
|
-
Date.civil(2015,4,3) => "Good Friday",
|
126
105
|
Date.civil(2015,5,25) => "Memorial Day",
|
127
106
|
Date.civil(2015,7,4) => "Independence Day",
|
128
107
|
Date.civil(2015,9,7) => "Labor Day",
|
129
108
|
Date.civil(2015,10,12) => "Columbus Day",
|
130
109
|
Date.civil(2015,11,11) => "Veterans Day",
|
131
110
|
Date.civil(2015,11,26) => "Thanksgiving Day",
|
132
|
-
Date.civil(2015,12,24) => "Christmas Eve",
|
133
111
|
Date.civil(2015,12,25) => "Christmas Day",
|
134
|
-
Date.civil(2015,12,31) => "New Year's Eve",
|
135
112
|
|
136
113
|
Date.civil(2016,1,1) => "New Year's Day",
|
137
114
|
Date.civil(2016,1,18) => "Birthday of Martin Luther King, Jr",
|
138
115
|
Date.civil(2016,2,15) => "Washington's Birthday",
|
139
|
-
Date.civil(2016,3,25) => "Good Friday",
|
140
116
|
Date.civil(2016,5,30) => "Memorial Day",
|
141
117
|
Date.civil(2016,7,4) => "Independence Day",
|
142
118
|
Date.civil(2016,9,5) => "Labor Day",
|
143
119
|
Date.civil(2016,10,10) => "Columbus Day",
|
144
120
|
Date.civil(2016,11,11) => "Veterans Day",
|
145
121
|
Date.civil(2016,11,24) => "Thanksgiving Day",
|
146
|
-
Date.civil(2016,12,24) => "Christmas Eve",
|
147
122
|
Date.civil(2016,12,26) => "Christmas Day",
|
148
|
-
|
123
|
+
|
124
|
+
Date.civil(2017,1, 20) => "Inauguration Day",
|
149
125
|
}.each do |date, name|
|
150
126
|
assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
|
151
127
|
end
|
data/data/fedex.yaml
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# FedEx holiday definitions for the Ruby Holiday gem.
|
2
|
+
#
|
3
|
+
# By Adam Runner
|
4
|
+
#
|
5
|
+
# Updated: 2015-03-09.
|
6
|
+
# Source: http://www.fedex.com/us/service-guide/holiday-schedule.html
|
7
|
+
---
|
8
|
+
months:
|
9
|
+
1:
|
10
|
+
- name: New Year's Day
|
11
|
+
regions: [fedex]
|
12
|
+
mday: 1
|
13
|
+
observed: to_weekday_if_weekend
|
14
|
+
5:
|
15
|
+
- name: Memorial Day
|
16
|
+
week: -1
|
17
|
+
regions: [fedex]
|
18
|
+
wday: 1
|
19
|
+
7:
|
20
|
+
- name: Independence Day
|
21
|
+
regions: [fedex]
|
22
|
+
mday: 4
|
23
|
+
observed: to_weekday_if_weekend
|
24
|
+
9:
|
25
|
+
- name: Labor Day
|
26
|
+
week: 1
|
27
|
+
regions: [fedex]
|
28
|
+
wday: 1
|
29
|
+
11:
|
30
|
+
- name: Thanksgiving
|
31
|
+
week: 4
|
32
|
+
regions: [fedex]
|
33
|
+
wday: 4
|
34
|
+
- name: Day After Thanksgiving
|
35
|
+
week: 4
|
36
|
+
regions: [fedex]
|
37
|
+
wday: 5
|
38
|
+
12:
|
39
|
+
- name: Christmas Day
|
40
|
+
regions: [fedex]
|
41
|
+
mday: 25
|
42
|
+
observed: to_weekday_if_weekend
|
43
|
+
- name: New Year's Eve
|
44
|
+
regions: [fedex]
|
45
|
+
mday: 31
|
46
|
+
tests: |
|
47
|
+
{Date.civil(2015,1,1) => 'New Year\'s Day',
|
48
|
+
Date.civil(2015,5,25) => 'Memorial Day',
|
49
|
+
Date.civil(2015,7,4) => 'Independence Day',
|
50
|
+
Date.civil(2015,9,7) => 'Labor Day',
|
51
|
+
Date.civil(2015,11,26) => 'Thanksgiving',
|
52
|
+
Date.civil(2015,11,27) => 'Day After Thanksgiving',
|
53
|
+
Date.civil(2015,12,25) => 'Christmas Day',
|
54
|
+
Date.civil(2015,12,31) => 'New Year\'s Eve',}.each do |date, name|
|
55
|
+
assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
|
56
|
+
end
|