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
@@ -4,22 +4,21 @@ module Holidays
|
|
4
4
|
#
|
5
5
|
# Definitions loaded: data/federal_reserve.yaml
|
6
6
|
#
|
7
|
-
# To use the definitions in this file, load it right after you load the
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
9
9
|
#
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'holidays/federal_reserve'
|
12
12
|
#
|
13
13
|
# All the definitions are available at https://github.com/alexdunae/holidays
|
14
|
-
module
|
14
|
+
module FEDERAL_RESERVE # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:federal_reserve]
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
|
22
|
-
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:federal_reserve]},
|
21
|
+
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:federal_reserve]},
|
23
22
|
{:wday => 1, :week => 3, :name => "Birthday of Martin Luther King, Jr", :regions => [:federal_reserve]},
|
24
23
|
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:federal_reserve]}],
|
25
24
|
2 => [{:wday => 1, :week => 3, :name => "Washington's Birthday", :regions => [:federal_reserve]}],
|
@@ -29,9 +28,7 @@ module Holidays
|
|
29
28
|
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:federal_reserve]}],
|
30
29
|
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Veterans Day", :regions => [:federal_reserve]},
|
31
30
|
{:wday => 4, :week => 4, :name => "Thanksgiving Day", :regions => [:federal_reserve]}],
|
32
|
-
12 => [{:mday =>
|
33
|
-
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:federal_reserve]},
|
34
|
-
{:mday => 31, :name => "New Year's Eve", :regions => [:federal_reserve]}]
|
31
|
+
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:federal_reserve]}]
|
35
32
|
}
|
36
33
|
end
|
37
34
|
end
|
@@ -47,4 +44,4 @@ end
|
|
47
44
|
|
48
45
|
end
|
49
46
|
|
50
|
-
Holidays.merge_defs(Holidays::
|
47
|
+
Holidays.merge_defs(Holidays::FEDERAL_RESERVE.defined_regions, Holidays::FEDERAL_RESERVE.holidays_by_month)
|
data/lib/holidays/fi.rb
CHANGED
data/lib/holidays/fr.rb
CHANGED
data/lib/holidays/gb.rb
CHANGED
data/lib/holidays/hr.rb
CHANGED
data/lib/holidays/hu.rb
CHANGED
data/lib/holidays/ie.rb
CHANGED
data/lib/holidays/is.rb
CHANGED
data/lib/holidays/it.rb
CHANGED
data/lib/holidays/jp.rb
CHANGED
@@ -4,7 +4,7 @@ module Holidays
|
|
4
4
|
#
|
5
5
|
# Definitions loaded: data/jp.yaml
|
6
6
|
#
|
7
|
-
# To use the definitions in this file, load it right after you load the
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
9
9
|
#
|
10
10
|
# require 'holidays'
|
@@ -19,7 +19,8 @@ module Holidays
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
21
|
1 => [{:mday => 1, :name => "元日", :regions => [:jp]},
|
22
|
-
{:wday => 1, :week => 2, :name => "成人の日", :regions => [:jp]}
|
22
|
+
{:wday => 1, :week => 2, :name => "成人の日", :regions => [:jp]},
|
23
|
+
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 1, 1) }, :function_id => "jp_substitute_holiday(year, 1, 1)", :name => "振替休日", :regions => [:jp]}],
|
23
24
|
2 => [{:mday => 11, :name => "建国記念日", :regions => [:jp]},
|
24
25
|
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 2, 11) }, :function_id => "jp_substitute_holiday(year, 2, 11)", :name => "振替休日", :regions => [:jp]}],
|
25
26
|
3 => [{:function => lambda { |year| Holidays.jp_vernal_equinox_day(year) }, :function_id => "jp_vernal_equinox_day(year)", :name => "春分の日", :regions => [:jp]},
|
data/lib/holidays/li.rb
CHANGED
data/lib/holidays/lt.rb
CHANGED
data/lib/holidays/ma.rb
CHANGED
data/lib/holidays/mx.rb
CHANGED
@@ -4,7 +4,7 @@ module Holidays
|
|
4
4
|
#
|
5
5
|
# Definitions loaded: data/mx.yaml, data/north_america_informal.yaml
|
6
6
|
#
|
7
|
-
# To use the definitions in this file, load it right after you load the
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
9
9
|
#
|
10
10
|
# require 'holidays'
|
data/lib/holidays/nerc.rb
CHANGED
data/lib/holidays/nl.rb
CHANGED
data/lib/holidays/no.rb
CHANGED
@@ -4,16 +4,16 @@ module Holidays
|
|
4
4
|
#
|
5
5
|
# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.yaml, data/north_america_informal.yaml
|
6
6
|
#
|
7
|
-
# To use the definitions in this file, load it right after you load the
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
9
9
|
#
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'holidays/north_america'
|
12
12
|
#
|
13
13
|
# All the definitions are available at https://github.com/alexdunae/holidays
|
14
|
-
module
|
14
|
+
module NORTH_AMERICA # :nodoc:
|
15
15
|
def self.defined_regions
|
16
|
-
[:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :
|
16
|
+
[:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :mx, :mx_pue, :us, :us_dc]
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
@@ -32,6 +32,8 @@ module Holidays
|
|
32
32
|
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
33
33
|
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
34
34
|
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
35
|
+
{:wday => 1, :week => 3, :name => "Nova Scotia Heritage Day", :regions => [:ca_ns]},
|
36
|
+
{:wday => 1, :week => 3, :name => "Islander Day", :regions => [:ca_pe]},
|
35
37
|
{:wday => 1, :week => 2, :name => "BC Family Day", :regions => [:ca_bc]},
|
36
38
|
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
37
39
|
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
@@ -63,7 +65,8 @@ module Holidays
|
|
63
65
|
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
64
66
|
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
65
67
|
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
66
|
-
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
68
|
+
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on, :ca_nt, :ca_nu, :ca_pe]},
|
69
|
+
{:wday => 1, :week => 1, :name => "New Brunswick Day", :regions => [:ca_nb]},
|
67
70
|
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
68
71
|
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
|
69
72
|
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
@@ -114,4 +117,4 @@ end
|
|
114
117
|
|
115
118
|
end
|
116
119
|
|
117
|
-
Holidays.merge_defs(Holidays::
|
120
|
+
Holidays.merge_defs(Holidays::NORTH_AMERICA.defined_regions, Holidays::NORTH_AMERICA.holidays_by_month)
|
data/lib/holidays/nyse.rb
CHANGED
data/lib/holidays/nz.rb
CHANGED
data/lib/holidays/pl.rb
CHANGED
data/lib/holidays/pt.rb
CHANGED
data/lib/holidays/ro.rb
CHANGED
data/lib/holidays/scandinavia.rb
CHANGED
@@ -4,28 +4,28 @@ module Holidays
|
|
4
4
|
#
|
5
5
|
# Definitions loaded: data/dk.yaml, data/is.yaml, data/no.yaml, data/se.yaml, data/fi.yaml
|
6
6
|
#
|
7
|
-
# To use the definitions in this file, load it right after you load the
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
9
9
|
#
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'holidays/scandinavia'
|
12
12
|
#
|
13
13
|
# All the definitions are available at https://github.com/alexdunae/holidays
|
14
|
-
module
|
14
|
+
module SCANDINAVIA # :nodoc:
|
15
15
|
def self.defined_regions
|
16
|
-
[:dk, :
|
16
|
+
[:dk, :is, :no, :se, :fi]
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk
|
22
|
-
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk
|
21
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
23
23
|
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
24
|
-
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk
|
24
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
25
25
|
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
26
|
-
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk
|
26
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
27
27
|
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
28
|
-
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk
|
28
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
29
29
|
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
30
30
|
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
|
31
31
|
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
@@ -39,8 +39,13 @@ module Holidays
|
|
39
39
|
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
40
40
|
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
41
41
|
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
|
42
|
+
{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:no]},
|
43
|
+
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:no]},
|
42
44
|
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skjærtorsdag", :regions => [:no]},
|
45
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:no]},
|
43
46
|
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "1. påskedag", :regions => [:no]},
|
47
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:no]},
|
48
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:no]},
|
44
49
|
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
|
45
50
|
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]},
|
46
51
|
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
@@ -91,13 +96,15 @@ module Holidays
|
|
91
96
|
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
92
97
|
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
93
98
|
{:mday => 24, :type => :informal, :name => "Juleaftensdag", :regions => [:dk]},
|
94
|
-
{:mday => 25, :name => "1. juledag", :regions => [:dk
|
95
|
-
{:mday => 26, :name => "2. juledag", :regions => [:dk
|
99
|
+
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
100
|
+
{:mday => 26, :name => "2. juledag", :regions => [:dk]},
|
96
101
|
{:mday => 24, :name => "Jól", :regions => [:is]},
|
97
102
|
{:mday => 25, :name => "Jól", :regions => [:is]},
|
98
103
|
{:mday => 26, :name => "Jól", :regions => [:is]},
|
99
104
|
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
100
105
|
{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
|
106
|
+
{:mday => 25, :name => "1. juledag", :regions => [:no]},
|
107
|
+
{:mday => 26, :name => "2. juledag", :regions => [:no]},
|
101
108
|
{:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]},
|
102
109
|
{:mday => 24, :type => :informal, :name => "Julafton", :regions => [:se]},
|
103
110
|
{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
@@ -172,4 +179,4 @@ end
|
|
172
179
|
|
173
180
|
end
|
174
181
|
|
175
|
-
Holidays.merge_defs(Holidays::
|
182
|
+
Holidays.merge_defs(Holidays::SCANDINAVIA.defined_regions, Holidays::SCANDINAVIA.holidays_by_month)
|
data/lib/holidays/se.rb
CHANGED
data/lib/holidays/sg.rb
CHANGED
data/lib/holidays/si.rb
CHANGED
data/lib/holidays/sk.rb
CHANGED
@@ -4,14 +4,14 @@ module Holidays
|
|
4
4
|
#
|
5
5
|
# Definitions loaded: data/united_nations.yaml
|
6
6
|
#
|
7
|
-
# To use the definitions in this file, load it right after you load the
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
9
9
|
#
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'holidays/united_nations'
|
12
12
|
#
|
13
13
|
# All the definitions are available at https://github.com/alexdunae/holidays
|
14
|
-
module
|
14
|
+
module UNITED_NATIONS # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:united_nations]
|
17
17
|
end
|
@@ -82,4 +82,4 @@ module Holidays
|
|
82
82
|
|
83
83
|
end
|
84
84
|
|
85
|
-
Holidays.merge_defs(Holidays::
|
85
|
+
Holidays.merge_defs(Holidays::UNITED_NATIONS.defined_regions, Holidays::UNITED_NATIONS.holidays_by_month)
|