holidays 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/LICENSE +21 -0
  2. data/README +76 -0
  3. data/REFERENCES +16 -0
  4. data/data/SYNTAX +111 -0
  5. data/data/au.yaml +106 -0
  6. data/data/build_defs.rb +152 -0
  7. data/data/ca.yaml +141 -0
  8. data/data/de.yaml +115 -0
  9. data/data/dk.yaml +117 -0
  10. data/data/es.yaml +161 -0
  11. data/data/fr.yaml +70 -0
  12. data/data/gb.yaml +106 -0
  13. data/data/ie.yaml +58 -0
  14. data/data/index.yaml +21 -0
  15. data/data/is.yaml +136 -0
  16. data/data/it.yaml +66 -0
  17. data/data/mx.yaml +106 -0
  18. data/data/nl.yaml +67 -0
  19. data/data/north_america_informal.yaml +49 -0
  20. data/data/pt.yaml +85 -0
  21. data/data/se.yaml +91 -0
  22. data/data/united_nations.yaml +188 -0
  23. data/data/us.yaml +81 -0
  24. data/data/za.yaml +78 -0
  25. data/lib/holidays.rb +404 -0
  26. data/lib/holidays/MANIFEST +23 -0
  27. data/lib/holidays/au.rb +41 -0
  28. data/lib/holidays/ca.rb +68 -0
  29. data/lib/holidays/de.rb +52 -0
  30. data/lib/holidays/dk.rb +47 -0
  31. data/lib/holidays/es.rb +52 -0
  32. data/lib/holidays/europe.rb +215 -0
  33. data/lib/holidays/fr.rb +36 -0
  34. data/lib/holidays/gb.rb +40 -0
  35. data/lib/holidays/ie.rb +32 -0
  36. data/lib/holidays/is.rb +61 -0
  37. data/lib/holidays/it.rb +35 -0
  38. data/lib/holidays/mx.rb +51 -0
  39. data/lib/holidays/nl.rb +36 -0
  40. data/lib/holidays/north_america.rb +107 -0
  41. data/lib/holidays/pt.rb +52 -0
  42. data/lib/holidays/scandinavia.rb +114 -0
  43. data/lib/holidays/se.rb +52 -0
  44. data/lib/holidays/united_nations.rb +24 -0
  45. data/lib/holidays/us.rb +48 -0
  46. data/lib/holidays/za.rb +35 -0
  47. data/test/defs/test_defs_au.rb +36 -0
  48. data/test/defs/test_defs_ca.rb +29 -0
  49. data/test/defs/test_defs_de.rb +46 -0
  50. data/test/defs/test_defs_dk.rb +30 -0
  51. data/test/defs/test_defs_es.rb +57 -0
  52. data/test/defs/test_defs_europe.rb +240 -0
  53. data/test/defs/test_defs_fr.rb +26 -0
  54. data/test/defs/test_defs_gb.rb +36 -0
  55. data/test/defs/test_defs_ie.rb +21 -0
  56. data/test/defs/test_defs_is.rb +33 -0
  57. data/test/defs/test_defs_it.rb +25 -0
  58. data/test/defs/test_defs_mx.rb +22 -0
  59. data/test/defs/test_defs_nl.rb +24 -0
  60. data/test/defs/test_defs_north_america.rb +54 -0
  61. data/test/defs/test_defs_pt.rb +32 -0
  62. data/test/defs/test_defs_scandinavia.rb +75 -0
  63. data/test/defs/test_defs_se.rb +32 -0
  64. data/test/defs/test_defs_us.rb +36 -0
  65. data/test/defs/test_defs_za.rb +25 -0
  66. metadata +118 -0
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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,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/pt'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module PT # :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::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH)