bjeanes-holidays 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +15 -0
- data/LICENSE +21 -0
- data/README.rdoc +77 -0
- data/REFERENCES +16 -0
- data/data/SYNTAX +111 -0
- data/data/au.yaml +111 -0
- data/data/build_defs.rb +152 -0
- data/data/ca.yaml +141 -0
- data/data/de.yaml +111 -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 +23 -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/nyse.yaml +63 -0
- data/data/pt.yaml +85 -0
- data/data/se.yaml +91 -0
- data/data/united_nations.yaml +188 -0
- data/data/ups.yaml +56 -0
- data/data/us.yaml +81 -0
- data/data/za.yaml +78 -0
- data/lib/holidays.rb +404 -0
- data/lib/holidays/MANIFEST +25 -0
- data/lib/holidays/au.rb +42 -0
- data/lib/holidays/ca.rb +68 -0
- data/lib/holidays/de.rb +50 -0
- data/lib/holidays/dk.rb +47 -0
- data/lib/holidays/es.rb +52 -0
- data/lib/holidays/europe.rb +214 -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/nyse.rb +32 -0
- data/lib/holidays/pt.rb +43 -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/ups.rb +31 -0
- data/lib/holidays/us.rb +48 -0
- data/lib/holidays/za.rb +35 -0
- data/rakefile.rb +150 -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 +49 -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 +243 -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_nyse.rb +22 -0
- data/test/defs/test_defs_pt.rb +56 -0
- data/test/defs/test_defs_scandinavia.rb +75 -0
- data/test/defs/test_defs_se.rb +32 -0
- data/test/defs/test_defs_ups.rb +21 -0
- data/test/defs/test_defs_us.rb +23 -0
- data/test/defs/test_defs_za.rb +25 -0
- metadata +132 -0
data/lib/holidays/fr.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/fr.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/fr'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module FR # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:fr]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
18
|
+
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
19
|
+
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
23
|
+
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
24
|
+
11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
25
|
+
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]}],
|
26
|
+
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
|
27
|
+
12 => [{:mday => 25, :name => "Nöel", :regions => [:fr]}],
|
28
|
+
7 => [{:mday => 14, :name => "Fête nationale", :regions => [:fr]}],
|
29
|
+
8 => [{:mday => 15, :name => "Assomption", :regions => [:fr]}]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Holidays.merge_defs(Holidays::FR::DEFINED_REGIONS, Holidays::FR::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/gb.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/gb.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/gb'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module GB # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:gb, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
|
18
|
+
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
|
19
|
+
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}],
|
20
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
23
|
+
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]}],
|
24
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
|
25
|
+
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
|
26
|
+
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
|
27
|
+
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]}],
|
28
|
+
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
29
|
+
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
30
|
+
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
31
|
+
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
32
|
+
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
33
|
+
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}]
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
Holidays.merge_defs(Holidays::GB::DEFINED_REGIONS, Holidays::GB::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/ie.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/ie.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/ie'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module IE # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:ie]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
|
19
|
+
6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
20
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
|
21
|
+
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
22
|
+
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}],
|
23
|
+
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
24
|
+
3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
|
25
|
+
10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}]
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
Holidays.merge_defs(Holidays::IE::DEFINED_REGIONS, Holidays::IE::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/is.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/is.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/is'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module IS # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:is]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
18
|
+
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
|
19
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
23
|
+
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
24
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
25
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
26
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
27
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
28
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
29
|
+
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]}],
|
30
|
+
11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
31
|
+
6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
32
|
+
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
|
33
|
+
1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
34
|
+
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
35
|
+
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
|
36
|
+
12 => [{:mday => 24, :name => "Jól", :regions => [:is]},
|
37
|
+
{:mday => 25, :name => "Jól", :regions => [:is]},
|
38
|
+
{:mday => 26, :name => "Jól", :regions => [:is]},
|
39
|
+
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}],
|
40
|
+
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
41
|
+
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
42
|
+
4 => [{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Iceland: first day of summer (Thursday after 18 April)
|
47
|
+
def self.is_sumardagurinn_fyrsti(year)
|
48
|
+
date = Date.civil(year,4,18)
|
49
|
+
if date.wday < 4
|
50
|
+
date += (4 - date.wday)
|
51
|
+
else date
|
52
|
+
date += (11 - date.wday)
|
53
|
+
end
|
54
|
+
date
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
Holidays.merge_defs(Holidays::IS::DEFINED_REGIONS, Holidays::IS::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/it.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/it.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/it'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module IT # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:it]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]}],
|
20
|
+
11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
|
21
|
+
6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
|
22
|
+
1 => [{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
23
|
+
{:mday => 6, :name => "Epifania", :regions => [:it]}],
|
24
|
+
12 => [{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
|
25
|
+
{:mday => 25, :name => "Natale", :regions => [:it]},
|
26
|
+
{:mday => 26, :name => "Santo Stefano", :regions => [:it]}],
|
27
|
+
8 => [{:mday => 15, :name => "Assunzione", :regions => [:it]}],
|
28
|
+
4 => [{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]}]
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
Holidays.merge_defs(Holidays::IT::DEFINED_REGIONS, Holidays::IT::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/mx.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/mx.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/mx'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module MX # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:mx, :mx_pue, :us, :ca]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
18
|
+
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
19
|
+
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
20
|
+
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
21
|
+
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
22
|
+
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
23
|
+
11 => [{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
24
|
+
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
25
|
+
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]}],
|
26
|
+
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
27
|
+
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
28
|
+
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
|
29
|
+
12 => [{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
30
|
+
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
31
|
+
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
32
|
+
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}],
|
33
|
+
2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
34
|
+
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
35
|
+
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
36
|
+
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
37
|
+
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
38
|
+
9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
39
|
+
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
|
40
|
+
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
41
|
+
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
42
|
+
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
43
|
+
10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
44
|
+
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
Holidays.merge_defs(Holidays::MX::DEFINED_REGIONS, Holidays::MX::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/nl.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/nl.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/nl'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module NL # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:nl]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
18
|
+
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
|
19
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
23
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
24
|
+
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]}],
|
25
|
+
1 => [{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]}],
|
26
|
+
12 => [{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
27
|
+
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
28
|
+
{:mday => 26, :name => "Kerstmis", :regions => [:nl]}],
|
29
|
+
4 => [{:mday => 30, :name => "Koninginnedag", :regions => [:nl]}]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Holidays.merge_defs(Holidays::NL::DEFINED_REGIONS, Holidays::NL::HOLIDAYS_BY_MONTH)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.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/north_america'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module North_America # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:ca, :ca_qc, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk, :mx, :mx_pue, :us, :us_dc]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
18
|
+
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
19
|
+
{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
20
|
+
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
21
|
+
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
22
|
+
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
23
|
+
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
24
|
+
{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
25
|
+
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
26
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
27
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]},
|
28
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
29
|
+
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]},
|
30
|
+
{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
31
|
+
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
32
|
+
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
|
33
|
+
{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
|
34
|
+
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
35
|
+
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
36
|
+
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
37
|
+
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
|
38
|
+
{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
39
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
40
|
+
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
|
41
|
+
{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
42
|
+
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
|
43
|
+
{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
|
44
|
+
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
45
|
+
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
46
|
+
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
|
47
|
+
{:mday => 26, :name => "Boxing Day", :regions => [:ca]},
|
48
|
+
{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
49
|
+
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
50
|
+
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
51
|
+
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]},
|
52
|
+
{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
|
53
|
+
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
|
54
|
+
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
55
|
+
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
|
56
|
+
{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
|
57
|
+
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
58
|
+
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
59
|
+
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
60
|
+
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
61
|
+
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
62
|
+
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
63
|
+
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
64
|
+
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
65
|
+
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
66
|
+
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
67
|
+
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
68
|
+
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
69
|
+
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
70
|
+
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
71
|
+
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
72
|
+
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
|
73
|
+
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
74
|
+
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
|
75
|
+
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
76
|
+
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
77
|
+
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
78
|
+
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
79
|
+
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
80
|
+
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
81
|
+
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
82
|
+
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
# Monday on or before May 24
|
87
|
+
def self.ca_victoria_day(year)
|
88
|
+
date = Date.civil(year,5,24)
|
89
|
+
if date.wday > 1
|
90
|
+
date -= (date.wday - 1)
|
91
|
+
elsif date.wday == 0
|
92
|
+
date -= 6
|
93
|
+
end
|
94
|
+
date
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
# January 20, every fourth year, following Presidential election
|
99
|
+
def self.us_inauguration_day(year)
|
100
|
+
year % 4 == 1 ? 20 : nil
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
Holidays.merge_defs(Holidays::North_America::DEFINED_REGIONS, Holidays::North_America::HOLIDAYS_BY_MONTH)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/nyse.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/nyse'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module NYSE # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:nyse]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:nyse]}],
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nyse]}],
|
19
|
+
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:nyse]}],
|
20
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:nyse]},
|
21
|
+
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:nyse]}],
|
22
|
+
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:nyse]}],
|
23
|
+
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:nyse]}],
|
24
|
+
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:nyse]}],
|
25
|
+
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:nyse]}]
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
Holidays.merge_defs(Holidays::NYSE::DEFINED_REGIONS, Holidays::NYSE::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/pt.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
module Holidays
|
2
|
+
# This file is generated by the Ruby Holiday gem.
|
3
|
+
#
|
4
|
+
# Definitions loaded: data/pt.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/pt'
|
11
|
+
#
|
12
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
13
|
+
module PT # :nodoc:
|
14
|
+
DEFINED_REGIONS = [:pt, :pt_br]
|
15
|
+
|
16
|
+
HOLIDAYS_BY_MONTH = {
|
17
|
+
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt, :pt_br]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt, :pt_br]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt, :pt_br]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
|
22
|
+
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]},
|
23
|
+
{:mday => 2, :name => "Finados", :regions => [:pt_br]},
|
24
|
+
{:mday => 15, :name => "Proclamação da República", :regions => [:pt_br]}],
|
25
|
+
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
|
26
|
+
1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
|
27
|
+
12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
28
|
+
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
29
|
+
{:mday => 25, :name => "Natal", :regions => [:pt, :pt_br]}],
|
30
|
+
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
31
|
+
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]},
|
32
|
+
{:mday => 21, :name => "Tiradentes", :regions => [:pt_br]}],
|
33
|
+
10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]},
|
34
|
+
{:mday => 12, :name => "Nossa Senhora Aparecida", :regions => [:pt_br]}],
|
35
|
+
9 => [{:mday => 7, :name => "Independência do Brasil", :regions => [:pt_br]}]
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
Holidays.merge_defs(Holidays::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH)
|
43
|
+
|