holidays 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -1
- data/{CHANGELOG → CHANGELOG.rdoc} +29 -3
- data/LICENSE +2 -2
- data/README.rdoc +41 -28
- data/data/ar.yaml +82 -0
- data/data/au.yaml +40 -4
- data/data/be.yaml +65 -0
- data/data/br.yaml +12 -12
- data/data/ca.yaml +30 -17
- data/data/ch.yaml +187 -0
- data/data/federal_reserve.yaml +151 -0
- data/data/fi.yaml +19 -0
- data/data/fr.yaml +5 -5
- data/data/gb.yaml +19 -14
- data/data/hr.yaml +77 -0
- data/data/ie.yaml +36 -8
- data/data/index.yaml +12 -2
- data/data/ma.yaml +52 -0
- data/data/nerc.yaml +51 -0
- data/data/north_america_informal.yaml +13 -1
- data/data/pt.yaml +14 -13
- data/data/ro.yaml +76 -0
- data/data/sk.yaml +74 -0
- data/data/us.yaml +5 -1
- data/data/ve.yaml +70 -0
- data/holidays.gemspec +41 -9
- data/lib/holidays.rb +57 -34
- data/lib/holidays/MANIFEST +35 -24
- data/lib/holidays/ar.rb +42 -0
- data/lib/holidays/at.rb +3 -3
- data/lib/holidays/au.rb +28 -4
- data/lib/holidays/be.rb +40 -0
- data/lib/holidays/br.rb +1 -1
- data/lib/holidays/ca.rb +7 -3
- data/lib/holidays/ch.rb +92 -0
- data/lib/holidays/europe.rb +173 -53
- data/lib/holidays/federal_reserve.rb +50 -0
- data/lib/holidays/fi.rb +14 -1
- data/lib/holidays/fr.rb +1 -1
- data/lib/holidays/gb.rb +1 -1
- data/lib/holidays/hr.rb +42 -0
- data/lib/holidays/hu.rb +38 -0
- data/lib/holidays/ie.rb +16 -7
- data/lib/holidays/ma.rb +37 -0
- data/lib/holidays/mx.rb +3 -1
- data/lib/holidays/nerc.rb +34 -0
- data/lib/holidays/north_america.rb +9 -4
- data/lib/holidays/pt.rb +1 -1
- data/lib/holidays/ro.rb +40 -0
- data/lib/holidays/scandinavia.rb +13 -0
- data/lib/holidays/sk.rb +42 -0
- data/lib/holidays/us.rb +6 -3
- data/lib/holidays/ve.rb +40 -0
- data/rakefile.rb +1 -1
- data/test/defs/test_defs_ar.rb +27 -0
- data/test/defs/test_defs_au.rb +10 -0
- data/test/defs/test_defs_be.rb +25 -0
- data/test/defs/test_defs_br.rb +5 -5
- data/test/defs/test_defs_ca.rb +22 -2
- data/test/defs/test_defs_ch.rb +39 -0
- data/test/defs/test_defs_europe.rb +160 -10
- data/test/defs/test_defs_federal_reserve.rb +84 -0
- data/test/defs/test_defs_fi.rb +5 -0
- data/test/defs/test_defs_fr.rb +1 -1
- data/test/defs/test_defs_gb.rb +7 -2
- data/test/defs/test_defs_hr.rb +31 -0
- data/test/defs/test_defs_hu.rb +29 -0
- data/test/defs/test_defs_ie.rb +18 -3
- data/test/defs/test_defs_ma.rb +22 -0
- data/test/defs/test_defs_mx.rb +13 -0
- data/test/defs/test_defs_nerc.rb +23 -0
- data/test/defs/test_defs_north_america.rb +23 -2
- data/test/defs/test_defs_pt.rb +4 -3
- data/test/defs/test_defs_ro.rb +37 -0
- data/test/defs/test_defs_scandinavia.rb +5 -0
- data/test/defs/test_defs_sk.rb +28 -0
- data/test/defs/test_defs_us.rb +14 -0
- data/test/defs/test_defs_ve.rb +28 -0
- data/test/test_all_regions.rb +10 -0
- metadata +40 -6
data/data/ca.yaml
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
# Canadian holiday definitions for the Ruby Holiday gem.
|
2
2
|
# Updated 2008-11-21.
|
3
|
-
---
|
3
|
+
---
|
4
4
|
months:
|
5
|
-
0:
|
5
|
+
0:
|
6
6
|
- name: Good Friday
|
7
7
|
regions: [ca]
|
8
8
|
function: easter(year)-2
|
9
|
+
- name: Easter Sunday
|
10
|
+
regions: [ca]
|
11
|
+
function: easter(year)
|
9
12
|
- name: Easter Monday
|
10
13
|
regions: [ca]
|
11
14
|
function: easter(year)+1
|
12
15
|
type: informal
|
13
|
-
1:
|
16
|
+
1:
|
14
17
|
- name: New Year's Day
|
15
18
|
regions: [ca]
|
16
19
|
mday: 1
|
17
20
|
- name: New Year's
|
18
21
|
regions: [ca_qc]
|
19
22
|
mday: 2
|
20
|
-
2:
|
23
|
+
2:
|
21
24
|
- name: Family Day
|
22
25
|
regions: [ca_ab, ca_on, ca_sk]
|
23
26
|
wday: 1
|
@@ -26,22 +29,26 @@ months:
|
|
26
29
|
regions: [ca_mb]
|
27
30
|
wday: 1
|
28
31
|
week: 3
|
29
|
-
|
32
|
+
- name: BC Family Day
|
33
|
+
regions: [ca_bc]
|
34
|
+
wday: 1
|
35
|
+
week: 2
|
36
|
+
3:
|
30
37
|
- name: St. Patrick's Day
|
31
38
|
regions: [ca_nf]
|
32
39
|
mday: 17
|
33
|
-
3:
|
40
|
+
3:
|
34
41
|
- name: St. George's Day
|
35
42
|
regions: [ca_nf]
|
36
43
|
mday: 23
|
37
|
-
5:
|
44
|
+
5:
|
38
45
|
- name: Victoria Day
|
39
46
|
regions: [ca]
|
40
47
|
function: ca_victoria_day(year)
|
41
48
|
- name: National Patriotes Day
|
42
49
|
regions: [ca_qc]
|
43
50
|
function: ca_victoria_day(year)
|
44
|
-
6:
|
51
|
+
6:
|
45
52
|
- name: Discovery Day
|
46
53
|
regions: [ca_nf]
|
47
54
|
mday: 24
|
@@ -51,7 +58,7 @@ months:
|
|
51
58
|
- name: National Aboriginal Day
|
52
59
|
regions: [ca_nt]
|
53
60
|
mday: 21
|
54
|
-
7:
|
61
|
+
7:
|
55
62
|
- name: Canada Day
|
56
63
|
regions: [ca]
|
57
64
|
mday: 1
|
@@ -62,7 +69,7 @@ months:
|
|
62
69
|
- name: Nunavut Day
|
63
70
|
regions: [ca_nu]
|
64
71
|
mday: 9
|
65
|
-
8:
|
72
|
+
8:
|
66
73
|
- name: BC Day
|
67
74
|
week: 1
|
68
75
|
regions: [ca_bc]
|
@@ -87,21 +94,21 @@ months:
|
|
87
94
|
week: 3
|
88
95
|
regions: [ca_yk]
|
89
96
|
wday: 1
|
90
|
-
9:
|
97
|
+
9:
|
91
98
|
- name: Labour Day
|
92
99
|
week: 1
|
93
100
|
regions: [ca]
|
94
101
|
wday: 1
|
95
|
-
10:
|
102
|
+
10:
|
96
103
|
- name: Thanksgiving
|
97
104
|
week: 2
|
98
105
|
regions: [ca]
|
99
106
|
wday: 1
|
100
|
-
11:
|
107
|
+
11:
|
101
108
|
- name: Remembrance Day
|
102
109
|
regions: [ca]
|
103
110
|
mday: 11
|
104
|
-
12:
|
111
|
+
12:
|
105
112
|
- name: Christmas Day
|
106
113
|
regions: [ca]
|
107
114
|
mday: 25
|
@@ -121,8 +128,9 @@ methods:
|
|
121
128
|
date
|
122
129
|
end
|
123
130
|
tests: |
|
124
|
-
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
125
|
-
Date.civil(2008,3,21) => 'Good Friday',
|
131
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
132
|
+
Date.civil(2008,3,21) => 'Good Friday',
|
133
|
+
Date.civil(2013,3,31) => 'Easter Sunday',
|
126
134
|
Date.civil(2008,3,24) => 'Easter Monday',
|
127
135
|
Date.civil(2008,5,19) => 'Victoria Day',
|
128
136
|
Date.civil(2008,7,1) => 'Canada Day',
|
@@ -134,8 +142,13 @@ tests: |
|
|
134
142
|
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
135
143
|
end
|
136
144
|
|
145
|
+
# Family Day in BC
|
146
|
+
[ Date.civil(2013,2,11), Date.civil(2014,2,10) ].each do |date|
|
147
|
+
assert_equal 'BC Family Day', Holidays.on(date, :ca_bc)[0][:name]
|
148
|
+
end
|
149
|
+
|
137
150
|
# Victoria Day
|
138
151
|
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
139
152
|
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
140
153
|
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
141
|
-
end
|
154
|
+
end
|
data/data/ch.yaml
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
# Swiss holiday definitions for the Ruby Holiday gem.
|
2
|
+
#
|
3
|
+
# Updated: 2012-03-16.
|
4
|
+
# Sources:
|
5
|
+
# http://www.bj.admin.ch/content/dam/data/staat_buerger/zivilprozessrecht/kant-feiertage.pdf
|
6
|
+
#
|
7
|
+
# Word of warning:
|
8
|
+
# ================
|
9
|
+
# As the holidays are defined on a state level and sometimes even on a district / village level,
|
10
|
+
# this holiday definition is an approximation of the reality. It should be accurate for most of the cases but
|
11
|
+
# no guarantee is given that it is correct for all the special cases :-).
|
12
|
+
# Considers both official holidays and holidays that are handled as if they were official holidays.
|
13
|
+
#
|
14
|
+
# Holiday names are in German in case they are celebrated in the German speaking area and in French / Italian otherwise.
|
15
|
+
#
|
16
|
+
# Known Issues:
|
17
|
+
# * ch_ur: 26th of December is not celebrated in case the 25th is a Monday or a Friday.
|
18
|
+
# * ch_fr: Fronleichnam, Maria Himmelfahrt, Allerheiligen, Maria Empfaengnis is celebrated in all villages except
|
19
|
+
# some villages of the district of See.
|
20
|
+
# * ch_so: - There are a lot of village holidays not included here.
|
21
|
+
# - 1st of May is holiday only starting at noon; not included here.
|
22
|
+
# - 19th of March is celebrated only in a couple of villages
|
23
|
+
# * ch_ar: 26th of December is not celebrated in case the 25th is a Monday or a Friday.
|
24
|
+
# * ch_ai: - 22nd of September is celebrated only in part of the state.
|
25
|
+
# - 26th of December is not celebrated in case the 25th is a Monday or a Friday.
|
26
|
+
# * ch_ne: 26th of December and 2nd of January are only celebrated in case 25th of December and 1st of January are Sundays
|
27
|
+
#
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# all regions [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,
|
31
|
+
# ch_sh, ch_ar, ch_ai, ch_sg, ch_gr, ch_ag, ch_tg, ch_ti, ch_vd, ch_vs, ch_ne, ch_ge, ch_ju]
|
32
|
+
#
|
33
|
+
---
|
34
|
+
months:
|
35
|
+
0:
|
36
|
+
- name: Karfreitag
|
37
|
+
regions: [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]
|
38
|
+
function: easter(year)-2
|
39
|
+
- name: Ostermontag
|
40
|
+
regions: [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_vs, ch_ge, ch_ju]
|
41
|
+
function: easter(year)+1
|
42
|
+
# State holiday but observed in all the states
|
43
|
+
- name: Auffahrt
|
44
|
+
regions: [ch]
|
45
|
+
function: easter(year)+39
|
46
|
+
- name: Pfingstmontag
|
47
|
+
regions: [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_vs, ch_ge, ch_ju]
|
48
|
+
function: easter(year)+50
|
49
|
+
- name: Fronleichnam
|
50
|
+
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_zg, ch_fr, ch_so, ch_ai, ch_ag, ch_ti, ch_vs, ch_ne, ch_ju]
|
51
|
+
function: easter(year)+60
|
52
|
+
- name: Lundi du Jeûne fédéral
|
53
|
+
regions: [ch_vd]
|
54
|
+
function: ch_vd_lundi_du_jeune_federal(year)
|
55
|
+
- name: Jeûne genevois
|
56
|
+
regions: [ch_ge]
|
57
|
+
function: ch_ge_jeune_genevois(year)
|
58
|
+
1:
|
59
|
+
- name: Neujahrstag
|
60
|
+
regions: [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_vd, ch_vs, ch_ne, ch_ge, ch_ju, ch_ti]
|
61
|
+
mday: 1
|
62
|
+
- name: Berchtoldstag
|
63
|
+
regions: [ch_zh, ch_be, ch_lu, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_sh, ch_sg, ch_ag, ch_tg, ch_vd, ch_vs, ch_ne, ch_ju]
|
64
|
+
mday: 2
|
65
|
+
- name: Dreikönigstag
|
66
|
+
regions: [ch_ur, ch_sz, ch_ti]
|
67
|
+
mday: 6
|
68
|
+
3:
|
69
|
+
- name: Instauration de la République
|
70
|
+
regions: [ch_ne]
|
71
|
+
mday: 1
|
72
|
+
- name: Josephstag
|
73
|
+
regions: [ch_ur, ch_sz, ch_nw, ch_ti, ch_vs]
|
74
|
+
mday: 19
|
75
|
+
4:
|
76
|
+
- name: Näfelser Fahrt
|
77
|
+
regions: [ch_gl]
|
78
|
+
function: ch_gl_naefelser_fahrt(year)
|
79
|
+
5:
|
80
|
+
- name: Tag der Arbeit
|
81
|
+
regions: [ch_zh, ch_bs, ch_bl, ch_sh, ch_ag, ch_tg, ch_ti, ch_ne, ch_ju]
|
82
|
+
mday: 1
|
83
|
+
6:
|
84
|
+
- name: Commémoration du plébiscite jurassien
|
85
|
+
regions: [ch_ju]
|
86
|
+
mday: 23
|
87
|
+
- name: San Pietro e Paolo
|
88
|
+
regions: [ch_ti]
|
89
|
+
mday: 29
|
90
|
+
8:
|
91
|
+
# Federal holiday
|
92
|
+
- name: Bundesfeiertag
|
93
|
+
regions: [ch]
|
94
|
+
mday: 1
|
95
|
+
- name: Mariä Himmelfahrt
|
96
|
+
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_zg, ch_fr, ch_so, ch_ai, ch_ag, ch_ti, ch_vs, ch_ju]
|
97
|
+
mday: 15
|
98
|
+
9:
|
99
|
+
- name: Mauritiustag
|
100
|
+
regions: [ch_ai]
|
101
|
+
mday: 22
|
102
|
+
- name: Bruderklausenfest
|
103
|
+
regions: [ch_ow]
|
104
|
+
mday: 25
|
105
|
+
11:
|
106
|
+
- name: Allerheiligen
|
107
|
+
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_gl, ch_zg, ch_fr, ch_so, ch_ai, ch_sg, ch_ag, ch_ti, ch_vs, ch_ju]
|
108
|
+
mday: 1
|
109
|
+
12:
|
110
|
+
- name: Maria Empfängnis
|
111
|
+
regions: [ch_lu, ch_ur, ch_sz, ch_ow, ch_nw, ch_zg, ch_fr, ch_ai, ch_ag, ch_ti, ch_vs]
|
112
|
+
mday: 8
|
113
|
+
# State holiday but observed in all the states
|
114
|
+
- name: Weihnachten
|
115
|
+
regions: [ch]
|
116
|
+
mday: 25
|
117
|
+
- name: Stefanstag
|
118
|
+
regions: [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_vs, ch_ne]
|
119
|
+
mday: 26
|
120
|
+
- name: Restauration de la République
|
121
|
+
regions: [ch_ge]
|
122
|
+
mday: 31
|
123
|
+
methods:
|
124
|
+
ch_vd_lundi_du_jeune_federal: |
|
125
|
+
# Monday after the third Sunday of September
|
126
|
+
def self.ch_vd_lundi_du_jeune_federal(year)
|
127
|
+
date = Date.civil(year,9,1)
|
128
|
+
# Find the first Sunday of September
|
129
|
+
until date.wday.eql? 0 do
|
130
|
+
date += 1
|
131
|
+
end
|
132
|
+
# There are 15 days between the first Sunday
|
133
|
+
# and the Monday after the third Sunday
|
134
|
+
date + 15
|
135
|
+
end
|
136
|
+
ch_ge_jeune_genevois: |
|
137
|
+
# Thursday after the first Sunday of September
|
138
|
+
def self.ch_ge_jeune_genevois(year)
|
139
|
+
date = Date.civil(year,9,1)
|
140
|
+
# Find the first Sunday of September
|
141
|
+
until date.wday.eql? 0 do
|
142
|
+
date += 1
|
143
|
+
end
|
144
|
+
# Thursday is four days after Sunday
|
145
|
+
date + 4
|
146
|
+
end
|
147
|
+
ch_gl_naefelser_fahrt: |
|
148
|
+
# First Thursday of April. If the first Thursday of April is in the week before easter, then a week later.
|
149
|
+
def self.ch_gl_naefelser_fahrt(year)
|
150
|
+
date = Date.civil(year,4,1)
|
151
|
+
# Find the first Thursday of April
|
152
|
+
until date.wday.eql? 4 do
|
153
|
+
date += 1
|
154
|
+
end
|
155
|
+
if date.eql?(easter(year)-3)
|
156
|
+
date += 7
|
157
|
+
end
|
158
|
+
date
|
159
|
+
end
|
160
|
+
tests: |
|
161
|
+
{ Date.civil(2012,8,1) => 'Bundesfeiertag',
|
162
|
+
Date.civil(2012,12,25) => 'Weihnachten',
|
163
|
+
Date.civil(2012,05,17) => 'Auffahrt'
|
164
|
+
}.each do |date, name|
|
165
|
+
assert_equal name, (Holidays.on(date, :ch)[0] || {})[:name]
|
166
|
+
end
|
167
|
+
|
168
|
+
{ Date.civil(2012,8,1) => 'Bundesfeiertag',
|
169
|
+
Date.civil(2012,12,25) => 'Weihnachten',
|
170
|
+
Date.civil(2012,05,17) => 'Auffahrt',
|
171
|
+
Date.civil(2012,5,1) => 'Tag der Arbeit',
|
172
|
+
Date.civil(2012,12,26) => 'Stefanstag'
|
173
|
+
}.each do |date, name|
|
174
|
+
assert_equal name, (Holidays.on(date, :ch_zh)[0] || {})[:name]
|
175
|
+
end
|
176
|
+
|
177
|
+
[Date.civil(2012,9,17), Date.civil(2013,9,16), Date.civil(2014,9,22)].each do |date|
|
178
|
+
assert_equal 'Lundi du Jeûne fédéral', (Holidays.on(date, :ch_vd)[0] || {})[:name]
|
179
|
+
end
|
180
|
+
|
181
|
+
[Date.civil(2012,9,6), Date.civil(2013,9,5), Date.civil(2014,9,11)].each do |date|
|
182
|
+
assert_equal 'Jeûne genevois', (Holidays.on(date, :ch_ge)[0] || {})[:name]
|
183
|
+
end
|
184
|
+
|
185
|
+
[Date.civil(2012,4,12), Date.civil(2013,4,4), Date.civil(2014,4,3)].each do |date|
|
186
|
+
assert_equal 'Näfelser Fahrt', (Holidays.on(date, :ch_gl)[0] || {})[:name]
|
187
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
# Federal reserve holidays definition for the Ruby Holiday gem.
|
2
|
+
#
|
3
|
+
# Updated: 2012-08-17
|
4
|
+
#
|
5
|
+
# Sources:
|
6
|
+
# -
|
7
|
+
---
|
8
|
+
months:
|
9
|
+
0:
|
10
|
+
- name: Good Friday
|
11
|
+
function: easter(year)-2
|
12
|
+
regions: [federal_reserve]
|
13
|
+
1:
|
14
|
+
- name: New Year's Day
|
15
|
+
regions: [federal_reserve]
|
16
|
+
mday: 1
|
17
|
+
observed: to_monday_if_sunday
|
18
|
+
- name: Birthday of Martin Luther King, Jr
|
19
|
+
week: 3
|
20
|
+
wday: 1
|
21
|
+
regions: [federal_reserve]
|
22
|
+
- name: Inauguration Day
|
23
|
+
function: us_inauguration_day(year)
|
24
|
+
regions: [federal_reserve]
|
25
|
+
2:
|
26
|
+
- name: Washington's Birthday
|
27
|
+
week: 3
|
28
|
+
wday: 1
|
29
|
+
regions: [federal_reserve]
|
30
|
+
5:
|
31
|
+
- name: Memorial Day
|
32
|
+
week: -1
|
33
|
+
wday: 1
|
34
|
+
regions: [federal_reserve]
|
35
|
+
7:
|
36
|
+
- name: Independence Day
|
37
|
+
regions: [federal_reserve]
|
38
|
+
mday: 4
|
39
|
+
observed: to_monday_if_sunday
|
40
|
+
9:
|
41
|
+
- name: Labor Day
|
42
|
+
week: 1
|
43
|
+
regions: [federal_reserve]
|
44
|
+
wday: 1
|
45
|
+
10:
|
46
|
+
- name: Columbus Day
|
47
|
+
week: 2
|
48
|
+
regions: [federal_reserve]
|
49
|
+
wday: 1
|
50
|
+
11:
|
51
|
+
- name: Veterans Day
|
52
|
+
regions: [federal_reserve]
|
53
|
+
mday: 11
|
54
|
+
observed: to_monday_if_sunday
|
55
|
+
- name: Thanksgiving Day
|
56
|
+
week: 4
|
57
|
+
wday: 4
|
58
|
+
regions: [federal_reserve]
|
59
|
+
12:
|
60
|
+
- name: Christmas Eve
|
61
|
+
regions: [federal_reserve]
|
62
|
+
mday: 24
|
63
|
+
observed: to_monday_if_sunday
|
64
|
+
- name: Christmas Day
|
65
|
+
regions: [federal_reserve]
|
66
|
+
mday: 25
|
67
|
+
observed: to_monday_if_sunday
|
68
|
+
- name: New Year's Eve
|
69
|
+
regions: [federal_reserve]
|
70
|
+
mday: 31
|
71
|
+
methods:
|
72
|
+
us_inauguration_day: |
|
73
|
+
# January 20, every fourth year, following Presidential election
|
74
|
+
def self.us_inauguration_day(year)
|
75
|
+
year % 4 == 1 ? 20 : nil
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
tests: |
|
80
|
+
{Date.civil(2012,1,2) => "New Year's Day",
|
81
|
+
Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
|
82
|
+
Date.civil(2012,2,20) => "Washington's Birthday",
|
83
|
+
Date.civil(2012,4,6) => "Good Friday",
|
84
|
+
Date.civil(2012,5,28) => "Memorial Day",
|
85
|
+
Date.civil(2012,7,4) => "Independence Day",
|
86
|
+
Date.civil(2012,9,3) => "Labor Day",
|
87
|
+
Date.civil(2012,10,8) => "Columbus Day",
|
88
|
+
Date.civil(2012,11,12) => "Veterans Day",
|
89
|
+
Date.civil(2012,11,22) => "Thanksgiving Day",
|
90
|
+
Date.civil(2012,12,24) => "Christmas Eve",
|
91
|
+
Date.civil(2012,12,25) => "Christmas Day",
|
92
|
+
Date.civil(2012,12,31) => "New Year's Eve",
|
93
|
+
|
94
|
+
Date.civil(2013,1,1) => "New Year's Day",
|
95
|
+
Date.civil(2013,1,21) => "Birthday of Martin Luther King, Jr",
|
96
|
+
Date.civil(2013,2,18) => "Washington's Birthday",
|
97
|
+
Date.civil(2013,3,29) => "Good Friday",
|
98
|
+
Date.civil(2013,5,27) => "Memorial Day",
|
99
|
+
Date.civil(2013,7,4) => "Independence Day",
|
100
|
+
Date.civil(2013,9,2) => "Labor Day",
|
101
|
+
Date.civil(2013,10,14) => "Columbus Day",
|
102
|
+
Date.civil(2013,11,11) => "Veterans Day",
|
103
|
+
Date.civil(2013,11,28) => "Thanksgiving Day",
|
104
|
+
Date.civil(2013,12,24) => "Christmas Eve",
|
105
|
+
Date.civil(2013,12,25) => "Christmas Day",
|
106
|
+
Date.civil(2013,12,31) => "New Year's Eve",
|
107
|
+
|
108
|
+
Date.civil(2014,1,1) => "New Year's Day",
|
109
|
+
Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
|
110
|
+
Date.civil(2014,2,17) => "Washington's Birthday",
|
111
|
+
Date.civil(2014,4,18) => "Good Friday",
|
112
|
+
Date.civil(2014,5,26) => "Memorial Day",
|
113
|
+
Date.civil(2014,7,4) => "Independence Day",
|
114
|
+
Date.civil(2014,9,1) => "Labor Day",
|
115
|
+
Date.civil(2014,10,13) => "Columbus Day",
|
116
|
+
Date.civil(2014,11,11) => "Veterans Day",
|
117
|
+
Date.civil(2014,11,27) => "Thanksgiving Day",
|
118
|
+
Date.civil(2014,12,24) => "Christmas Eve",
|
119
|
+
Date.civil(2014,12,25) => "Christmas Day",
|
120
|
+
Date.civil(2014,12,31) => "New Year's Eve",
|
121
|
+
|
122
|
+
Date.civil(2015,1,1) => "New Year's Day",
|
123
|
+
Date.civil(2015,1,19) => "Birthday of Martin Luther King, Jr",
|
124
|
+
Date.civil(2015,2,16) => "Washington's Birthday",
|
125
|
+
Date.civil(2015,4,3) => "Good Friday",
|
126
|
+
Date.civil(2015,5,25) => "Memorial Day",
|
127
|
+
Date.civil(2015,7,4) => "Independence Day",
|
128
|
+
Date.civil(2015,9,7) => "Labor Day",
|
129
|
+
Date.civil(2015,10,12) => "Columbus Day",
|
130
|
+
Date.civil(2015,11,11) => "Veterans Day",
|
131
|
+
Date.civil(2015,11,26) => "Thanksgiving Day",
|
132
|
+
Date.civil(2015,12,24) => "Christmas Eve",
|
133
|
+
Date.civil(2015,12,25) => "Christmas Day",
|
134
|
+
Date.civil(2015,12,31) => "New Year's Eve",
|
135
|
+
|
136
|
+
Date.civil(2016,1,1) => "New Year's Day",
|
137
|
+
Date.civil(2016,1,18) => "Birthday of Martin Luther King, Jr",
|
138
|
+
Date.civil(2016,2,15) => "Washington's Birthday",
|
139
|
+
Date.civil(2016,3,25) => "Good Friday",
|
140
|
+
Date.civil(2016,5,30) => "Memorial Day",
|
141
|
+
Date.civil(2016,7,4) => "Independence Day",
|
142
|
+
Date.civil(2016,9,5) => "Labor Day",
|
143
|
+
Date.civil(2016,10,10) => "Columbus Day",
|
144
|
+
Date.civil(2016,11,11) => "Veterans Day",
|
145
|
+
Date.civil(2016,11,24) => "Thanksgiving Day",
|
146
|
+
Date.civil(2016,12,24) => "Christmas Eve",
|
147
|
+
Date.civil(2016,12,26) => "Christmas Day",
|
148
|
+
Date.civil(2016,12,31) => "New Year's Eve",
|
149
|
+
}.each do |date, name|
|
150
|
+
assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
|
151
|
+
end
|