holidays 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README +76 -0
- data/REFERENCES +16 -0
- data/data/SYNTAX +111 -0
- data/data/au.yaml +106 -0
- data/data/build_defs.rb +152 -0
- data/data/ca.yaml +141 -0
- data/data/de.yaml +115 -0
- data/data/dk.yaml +117 -0
- data/data/es.yaml +161 -0
- data/data/fr.yaml +70 -0
- data/data/gb.yaml +106 -0
- data/data/ie.yaml +58 -0
- data/data/index.yaml +21 -0
- data/data/is.yaml +136 -0
- data/data/it.yaml +66 -0
- data/data/mx.yaml +106 -0
- data/data/nl.yaml +67 -0
- data/data/north_america_informal.yaml +49 -0
- data/data/pt.yaml +85 -0
- data/data/se.yaml +91 -0
- data/data/united_nations.yaml +188 -0
- data/data/us.yaml +81 -0
- data/data/za.yaml +78 -0
- data/lib/holidays.rb +404 -0
- data/lib/holidays/MANIFEST +23 -0
- data/lib/holidays/au.rb +41 -0
- data/lib/holidays/ca.rb +68 -0
- data/lib/holidays/de.rb +52 -0
- data/lib/holidays/dk.rb +47 -0
- data/lib/holidays/es.rb +52 -0
- data/lib/holidays/europe.rb +215 -0
- data/lib/holidays/fr.rb +36 -0
- data/lib/holidays/gb.rb +40 -0
- data/lib/holidays/ie.rb +32 -0
- data/lib/holidays/is.rb +61 -0
- data/lib/holidays/it.rb +35 -0
- data/lib/holidays/mx.rb +51 -0
- data/lib/holidays/nl.rb +36 -0
- data/lib/holidays/north_america.rb +107 -0
- data/lib/holidays/pt.rb +52 -0
- data/lib/holidays/scandinavia.rb +114 -0
- data/lib/holidays/se.rb +52 -0
- data/lib/holidays/united_nations.rb +24 -0
- data/lib/holidays/us.rb +48 -0
- data/lib/holidays/za.rb +35 -0
- data/test/defs/test_defs_au.rb +36 -0
- data/test/defs/test_defs_ca.rb +29 -0
- data/test/defs/test_defs_de.rb +46 -0
- data/test/defs/test_defs_dk.rb +30 -0
- data/test/defs/test_defs_es.rb +57 -0
- data/test/defs/test_defs_europe.rb +240 -0
- data/test/defs/test_defs_fr.rb +26 -0
- data/test/defs/test_defs_gb.rb +36 -0
- data/test/defs/test_defs_ie.rb +21 -0
- data/test/defs/test_defs_is.rb +33 -0
- data/test/defs/test_defs_it.rb +25 -0
- data/test/defs/test_defs_mx.rb +22 -0
- data/test/defs/test_defs_nl.rb +24 -0
- data/test/defs/test_defs_north_america.rb +54 -0
- data/test/defs/test_defs_pt.rb +32 -0
- data/test/defs/test_defs_scandinavia.rb +75 -0
- data/test/defs/test_defs_se.rb +32 -0
- data/test/defs/test_defs_us.rb +36 -0
- data/test/defs/test_defs_za.rb +25 -0
- metadata +118 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/dk.yaml, data/is.yaml, data/se.yaml
|
5
|
+
#
|
6
|
+
# To use the definitions in this file, load them right after you load the
|
7
|
+
# Holiday gem:
|
8
|
+
#
|
9
|
+
# require 'holidays'
|
10
|
+
# require 'holidays/scandinavia'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module SCANDINAVIA # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:dk, :is, :se]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
18
|
+
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
19
|
+
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
20
|
+
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
|
21
|
+
{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
22
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
23
|
+
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
24
|
+
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
25
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
26
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
27
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
28
|
+
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
29
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
30
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
31
|
+
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
|
32
|
+
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
33
|
+
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
34
|
+
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
35
|
+
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
36
|
+
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
37
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
38
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
39
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
40
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
41
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
42
|
+
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
|
43
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
44
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
45
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
46
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
47
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
48
|
+
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
49
|
+
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
50
|
+
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
51
|
+
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
52
|
+
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
53
|
+
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
54
|
+
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
55
|
+
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
|
56
|
+
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
57
|
+
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
58
|
+
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
59
|
+
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
60
|
+
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
61
|
+
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
|
62
|
+
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
63
|
+
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
64
|
+
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
65
|
+
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
66
|
+
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
67
|
+
{:mday => 26, :name => "2. juledag", :regions => [:dk]},
|
68
|
+
{:mday => 24, :name => "Jól", :regions => [:is]},
|
69
|
+
{:mday => 25, :name => "Jól", :regions => [:is]},
|
70
|
+
{:mday => 26, :name => "Jól", :regions => [:is]},
|
71
|
+
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
72
|
+
{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
73
|
+
{:mday => 26, :name => "Annandag jul", :regions => [:se]}],
|
74
|
+
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
75
|
+
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
76
|
+
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
77
|
+
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
78
|
+
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
|
79
|
+
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# Iceland: first day of summer (Thursday after 18 April)
|
84
|
+
def self.is_sumardagurinn_fyrsti(year)
|
85
|
+
date = Date.civil(year,4,18)
|
86
|
+
if date.wday < 4
|
87
|
+
date += (4 - date.wday)
|
88
|
+
else date
|
89
|
+
date += (11 - date.wday)
|
90
|
+
end
|
91
|
+
date
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
96
|
+
def self.se_alla_helgons_dag(year)
|
97
|
+
date = Date.civil(year,10,31)
|
98
|
+
date += (6 - date.wday)
|
99
|
+
date
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
# Sweden: Mid-summer (Saturday between June 20–26)
|
104
|
+
def self.se_midsommardagen(year)
|
105
|
+
date = Date.civil(year,6,20)
|
106
|
+
date += (6 - date.wday)
|
107
|
+
date
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
Holidays.merge_defs(Holidays::SCANDINAVIA::DEFINED_REGIONS, Holidays::SCANDINAVIA::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/se.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/se.yaml
|
5
|
+
#
|
6
|
+
# To use the definitions in this file, load them right after you load the
|
7
|
+
# Holiday gem:
|
8
|
+
#
|
9
|
+
# require 'holidays'
|
10
|
+
# require 'holidays/se'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module SE # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:se]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
23
|
+
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
24
|
+
6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
25
|
+
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
26
|
+
1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
27
|
+
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
28
|
+
12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
29
|
+
{:mday => 26, :name => "Annandag jul", :regions => [:se]}]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
34
|
+
def self.se_alla_helgons_dag(year)
|
35
|
+
date = Date.civil(year,10,31)
|
36
|
+
date += (6 - date.wday)
|
37
|
+
date
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
# Sweden: Mid-summer (Saturday between June 20–26)
|
42
|
+
def self.se_midsommardagen(year)
|
43
|
+
date = Date.civil(year,6,20)
|
44
|
+
date += (6 - date.wday)
|
45
|
+
date
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/united_nations.yaml
|
5
|
+
#
|
6
|
+
# To use the definitions in this file, load them right after you load the
|
7
|
+
# Holiday gem:
|
8
|
+
#
|
9
|
+
# require 'holidays'
|
10
|
+
# require 'holidays/united_nations'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module United_Nations # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
Holidays.merge_defs(Holidays::United_Nations::DEFINED_REGIONS, Holidays::United_Nations::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/us.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/au.yaml, data/north_america_informal.yaml
|
5
|
+
#
|
6
|
+
# To use the definitions in this file, load them right after you load the
|
7
|
+
# Holiday gem:
|
8
|
+
#
|
9
|
+
# require 'holidays'
|
10
|
+
# require 'holidays/us'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module US # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:au_qld, :au_nt, :au, :au_tas, :au_wa, :au_act, :au_nsw, :au_sa, :au_vic, :us, :ca]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
|
18
|
+
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]},
|
19
|
+
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
20
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
|
23
|
+
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
|
24
|
+
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
|
25
|
+
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
|
26
|
+
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
|
27
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
|
28
|
+
{:mday => 26, :name => "Australia Day", :regions => [:au]}],
|
29
|
+
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
|
30
|
+
{:mday => 26, :name => "Boxing Day", :regions => [:au]}],
|
31
|
+
2 => [{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
32
|
+
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
33
|
+
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
|
34
|
+
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
|
35
|
+
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]},
|
36
|
+
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
37
|
+
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]},
|
38
|
+
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
39
|
+
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
40
|
+
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]},
|
41
|
+
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
Holidays.merge_defs(Holidays::US::DEFINED_REGIONS, Holidays::US::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/za.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/za.yaml
|
5
|
+
#
|
6
|
+
# To use the definitions in this file, load them right after you load the
|
7
|
+
# Holiday gem:
|
8
|
+
#
|
9
|
+
# require 'holidays'
|
10
|
+
# require 'holidays/za'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module ZA # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:za]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Family Day", :regions => [:za]}],
|
20
|
+
6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
|
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 => [:za]}],
|
22
|
+
12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
|
23
|
+
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
|
24
|
+
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}],
|
25
|
+
8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
|
26
|
+
3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
|
27
|
+
9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
|
28
|
+
4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}]
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
Holidays.merge_defs(Holidays::ZA::DEFINED_REGIONS, Holidays::ZA::HOLIDAYS_BY_MONTH)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require 'holidays/au'
|
3
|
+
|
4
|
+
# This file is generated by the Ruby Holiday gem.
|
5
|
+
#
|
6
|
+
# Definitions loaded: data/au.yaml
|
7
|
+
class AuDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
|
+
|
9
|
+
def test_au
|
10
|
+
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
11
|
+
Date.civil(2007,1,26) => 'Australia Day',
|
12
|
+
Date.civil(2007,4,6) => 'Good Friday',
|
13
|
+
Date.civil(2007,4,9) => 'Easter Monday',
|
14
|
+
Date.civil(2007,4,25) => 'ANZAC Day',
|
15
|
+
Date.civil(2007,12,25) => 'Christmas Day',
|
16
|
+
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
17
|
+
assert_equal name, Holidays.on(date, :au, :informal)[0][:name]
|
18
|
+
end
|
19
|
+
|
20
|
+
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
21
|
+
assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name]
|
22
|
+
end
|
23
|
+
|
24
|
+
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
25
|
+
assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name]
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name]
|
29
|
+
assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name]
|
30
|
+
assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name]
|
31
|
+
|
32
|
+
assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name]
|
33
|
+
|
34
|
+
assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name]
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require 'holidays/ca'
|
3
|
+
|
4
|
+
# This file is generated by the Ruby Holiday gem.
|
5
|
+
#
|
6
|
+
# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
|
7
|
+
class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
|
+
|
9
|
+
def test_ca
|
10
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
11
|
+
Date.civil(2008,3,21) => 'Good Friday',
|
12
|
+
Date.civil(2008,3,24) => 'Easter Monday',
|
13
|
+
Date.civil(2008,5,19) => 'Victoria Day',
|
14
|
+
Date.civil(2008,7,1) => 'Canada Day',
|
15
|
+
Date.civil(2008,9,1) => 'Labour Day',
|
16
|
+
Date.civil(2008,10,13) => 'Thanksgiving',
|
17
|
+
Date.civil(2008,11,11) => 'Rememberance Day',
|
18
|
+
Date.civil(2008,12,25) => 'Christmas Day',
|
19
|
+
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
20
|
+
assert_equal name, Holidays.on(date, :ca, :informal)[0][:name]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Victoria Day
|
24
|
+
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
25
|
+
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
26
|
+
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require 'holidays/de'
|
3
|
+
|
4
|
+
# This file is generated by the Ruby Holiday gem.
|
5
|
+
#
|
6
|
+
# Definitions loaded: data/de.yaml
|
7
|
+
class DeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
|
+
|
9
|
+
def test_de
|
10
|
+
{Date.civil(2009,1,1) => 'Neujahrstag',
|
11
|
+
Date.civil(2009,4,10) => 'Karfreitag',
|
12
|
+
Date.civil(2009,4,12) => 'Ostern',
|
13
|
+
Date.civil(2009,4,13) => 'Ostermontag',
|
14
|
+
Date.civil(2009,5,1) => 'Tag der Arbeit',
|
15
|
+
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
|
16
|
+
Date.civil(2009,6,1) => 'Pfingstmontag',
|
17
|
+
Date.civil(2009,10,3) => 'Tag der Deutschen Einheit',
|
18
|
+
Date.civil(2009,12,25) => '1. Weihnachtstag',
|
19
|
+
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
|
20
|
+
assert_equal name, Holidays.on(date, :de, :informal)[0][:name]
|
21
|
+
end
|
22
|
+
|
23
|
+
[:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th, :de_].each do |r|
|
24
|
+
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
|
25
|
+
end
|
26
|
+
|
27
|
+
[:de_by, :de_sl, :de_].each do |r|
|
28
|
+
assert_equal 'Mariä Himmelfahrt', Date.civil(2009,8,15).holidays(r)[0][:name]
|
29
|
+
end
|
30
|
+
|
31
|
+
[:de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
|
32
|
+
assert_equal 'Reformationstag', Date.civil(2009,10,31).holidays(r)[0][:name]
|
33
|
+
end
|
34
|
+
|
35
|
+
[:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
|
36
|
+
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Repentance Day
|
40
|
+
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]
|
41
|
+
assert_equal 'Buß- und Bettag', Date.civil(2005,11,16).holidays(:de_sn)[0][:name]
|
42
|
+
assert_equal 'Buß- und Bettag', Date.civil(2006,11,22).holidays(:de_sn)[0][:name]
|
43
|
+
assert_equal 'Buß- und Bettag', Date.civil(2009,11,18).holidays(:de_sn)[0][:name]
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require 'holidays/dk'
|
3
|
+
|
4
|
+
# This file is generated by the Ruby Holiday gem.
|
5
|
+
#
|
6
|
+
# Definitions loaded: data/dk.yaml
|
7
|
+
class DkDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
|
+
|
9
|
+
def test_dk
|
10
|
+
{Date.civil(2007,1,1) => 'Nytårsdag',
|
11
|
+
Date.civil(2007,2,18) => 'Fastelavn',
|
12
|
+
Date.civil(2007,4,9) => 'Danmarks besættelse',
|
13
|
+
Date.civil(2007,4,16) => 'Dronningens fødselsdag',
|
14
|
+
Date.civil(2007,4,5) => 'Skærtorsdag',
|
15
|
+
Date.civil(2007,4,6) => 'Langfredag',
|
16
|
+
Date.civil(2007,4,8) => 'Påskedag',
|
17
|
+
Date.civil(2007,4,9) => '2. påskedag',
|
18
|
+
Date.civil(2007,5,1) => 'Arbejdernes kampdag',
|
19
|
+
Date.civil(2007,5,4) => 'Store Bededag',
|
20
|
+
Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
|
21
|
+
Date.civil(2007,5,27) => 'Pinsedag',
|
22
|
+
Date.civil(2007,5,28) => '2. Pinsedag',
|
23
|
+
Date.civil(2007,6,5) => 'Grundlovsdag',
|
24
|
+
Date.civil(2007,12,24) => 'Juleaftensdag',
|
25
|
+
Date.civil(2007,12,25) => '1. juledag',
|
26
|
+
Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
|
27
|
+
assert_equal name, Holidays.on(date, :dk, :informal)[0][:name]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require 'holidays/es'
|
3
|
+
|
4
|
+
# This file is generated by the Ruby Holiday gem.
|
5
|
+
#
|
6
|
+
# Definitions loaded: data/es.yaml
|
7
|
+
class EsDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
|
+
|
9
|
+
def test_es
|
10
|
+
{Date.civil(2009,1,1) => 'Año Nuevo',
|
11
|
+
Date.civil(2009,1,6) => 'Día de Reyes',
|
12
|
+
Date.civil(2009,4,10) => 'Viernes Santo',
|
13
|
+
Date.civil(2009,5,1) => 'Día del Trabajador',
|
14
|
+
Date.civil(2009,8,15) => 'Asunción',
|
15
|
+
Date.civil(2009,10,12) => 'Día de la Hispanidad',
|
16
|
+
Date.civil(2009,11,1) => 'Todos los Santos',
|
17
|
+
Date.civil(2009,12,6) => 'Día de la Constitución',
|
18
|
+
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
19
|
+
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
20
|
+
assert_equal name, Holidays.on(date, :es, :informal)[0][:name]
|
21
|
+
end
|
22
|
+
|
23
|
+
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
24
|
+
assert_equal 'Jueves Santo', Date.civil(2009,4,9).holidays(r)[0][:name]
|
25
|
+
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
26
|
+
end
|
27
|
+
|
28
|
+
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
29
|
+
assert_equal 'San José', Date.civil(2009,3,19).holidays(r)[0][:name]
|
30
|
+
end
|
31
|
+
|
32
|
+
[:es_ar, :es_cl, :es_].each do |r|
|
33
|
+
assert_equal 'San Jorge', Date.civil(2009,4,23).holidays(r)[0][:name]
|
34
|
+
end
|
35
|
+
|
36
|
+
[:es_vc, :es_v, :es_].each do |r|
|
37
|
+
assert_equal 'Día de Valencia', Date.civil(2009,10,9).holidays(r)[0][:name]
|
38
|
+
end
|
39
|
+
|
40
|
+
[:es_ib, :es_ct, :es_].each do |r|
|
41
|
+
assert_equal 'San Esteban', Date.civil(2009,12,26).holidays(r)[0][:name]
|
42
|
+
end
|
43
|
+
|
44
|
+
assert_equal 'Día de Andalucía', Date.civil(2009,2,28).holidays(:es_an)[0][:name]
|
45
|
+
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1).holidays(:es_ib)[0][:name]
|
46
|
+
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2).holidays(:es_m)[0][:name]
|
47
|
+
assert_equal 'Día de las Canarias', Date.civil(2006,5,30).holidays(:es_cn)[0][:name]
|
48
|
+
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31).holidays(:es_cm)[0][:name]
|
49
|
+
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9).holidays(:es_mu)[0][:name]
|
50
|
+
assert_equal 'Día de La Rioja', Date.civil(2009,6,9).holidays(:es_lo)[0][:name]
|
51
|
+
assert_equal 'Santiago Apostol', Date.civil(2009,7,23).holidays(:es_ga)[0][:name]
|
52
|
+
assert_equal 'Día de Ceuta', Date.civil(2009,9,2).holidays(:es_ce)[0][:name]
|
53
|
+
assert_equal 'Día de Asturias', Date.civil(2009,9,8).holidays(:es_o)[0][:name]
|
54
|
+
assert_equal 'Día de Extremadura', Date.civil(2009,9,8).holidays(:es_ex)[0][:name]
|
55
|
+
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11).holidays(:es_ct)[0][:name]
|
56
|
+
end
|
57
|
+
end
|