holidays 0.9.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG +7 -0
  3. data/{README → README.rdoc} +36 -39
  4. data/data/SYNTAX +1 -1
  5. data/data/au.yaml +110 -105
  6. data/data/build_defs.rb +4 -3
  7. data/data/ca.yaml +140 -140
  8. data/data/cz.yaml +68 -0
  9. data/data/de.yaml +12 -14
  10. data/data/dk.yaml +1 -1
  11. data/data/es.yaml +1 -1
  12. data/data/fr.yaml +1 -1
  13. data/data/gb.yaml +1 -1
  14. data/data/ie.yaml +1 -1
  15. data/data/index.yaml +7 -2
  16. data/data/is.yaml +1 -1
  17. data/data/it.yaml +1 -1
  18. data/data/mx.yaml +1 -1
  19. data/data/nl.yaml +1 -1
  20. data/data/no.yaml +82 -0
  21. data/data/nyse.yaml +1 -1
  22. data/data/nz.yaml +141 -0
  23. data/data/pt.yaml +1 -1
  24. data/data/se.yaml +1 -1
  25. data/data/united_nations.yaml +188 -188
  26. data/data/ups.yaml +55 -55
  27. data/data/us.yaml +80 -80
  28. data/data/za.yaml +1 -1
  29. data/holidays.gemspec +155 -0
  30. data/lib/holidays.rb +424 -403
  31. data/lib/holidays/MANIFEST +28 -25
  32. data/lib/holidays/au.rb +43 -41
  33. data/lib/holidays/ca.rb +69 -68
  34. data/lib/holidays/cz.rb +36 -0
  35. data/lib/holidays/de.rb +51 -52
  36. data/lib/holidays/dk.rb +48 -47
  37. data/lib/holidays/es.rb +53 -52
  38. data/lib/holidays/europe.rb +236 -215
  39. data/lib/holidays/fr.rb +37 -36
  40. data/lib/holidays/gb.rb +41 -40
  41. data/lib/holidays/ie.rb +33 -32
  42. data/lib/holidays/is.rb +62 -61
  43. data/lib/holidays/it.rb +36 -35
  44. data/lib/holidays/mx.rb +52 -51
  45. data/lib/holidays/nl.rb +37 -36
  46. data/lib/holidays/no.rb +40 -0
  47. data/lib/holidays/north_america.rb +108 -107
  48. data/lib/holidays/nyse.rb +33 -32
  49. data/lib/holidays/nz.rb +69 -0
  50. data/lib/holidays/pt.rb +38 -52
  51. data/lib/holidays/scandinavia.rb +124 -114
  52. data/lib/holidays/se.rb +53 -52
  53. data/lib/holidays/united_nations.rb +25 -24
  54. data/lib/holidays/ups.rb +32 -31
  55. data/lib/holidays/us.rb +49 -48
  56. data/lib/holidays/za.rb +36 -35
  57. data/rakefile.rb +105 -113
  58. data/test/defs/test_defs_au.rb +36 -36
  59. data/test/defs/test_defs_ca.rb +29 -29
  60. data/test/defs/test_defs_cz.rb +26 -0
  61. data/test/defs/test_defs_de.rb +51 -46
  62. data/test/defs/test_defs_dk.rb +30 -30
  63. data/test/defs/test_defs_es.rb +57 -57
  64. data/test/defs/test_defs_europe.rb +280 -240
  65. data/test/defs/test_defs_fr.rb +26 -26
  66. data/test/defs/test_defs_gb.rb +36 -36
  67. data/test/defs/test_defs_ie.rb +21 -21
  68. data/test/defs/test_defs_is.rb +33 -33
  69. data/test/defs/test_defs_it.rb +25 -25
  70. data/test/defs/test_defs_mx.rb +22 -22
  71. data/test/defs/test_defs_nl.rb +24 -24
  72. data/test/defs/test_defs_no.rb +29 -0
  73. data/test/defs/test_defs_north_america.rb +54 -54
  74. data/test/defs/test_defs_nyse.rb +22 -22
  75. data/test/defs/test_defs_nz.rb +22 -0
  76. data/test/defs/test_defs_pt.rb +32 -32
  77. data/test/defs/test_defs_scandinavia.rb +94 -75
  78. data/test/defs/test_defs_se.rb +32 -32
  79. data/test/defs/test_defs_ups.rb +21 -21
  80. data/test/defs/test_defs_us.rb +23 -23
  81. data/test/defs/test_defs_za.rb +25 -25
  82. data/test/test_date.rb +123 -0
  83. data/test/test_helper.rb +22 -0
  84. data/test/test_holidays.rb +128 -0
  85. data/test/test_multiple_regions.rb +24 -0
  86. metadata +126 -73
@@ -1,36 +1,37 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/fr.yaml
6
+ #
7
+ # To use the definitions in this file, load them right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/fr'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module FR # :nodoc:
15
+ DEFINED_REGIONS = [:fr]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
19
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
20
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
21
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
22
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
23
+ 1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
24
+ 5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
25
+ {:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
26
+ 7 => [{:mday => 14, :name => "Fête nationale", :regions => [:fr]}],
27
+ 8 => [{:mday => 15, :name => "Assomption", :regions => [:fr]}],
28
+ 11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
29
+ {:mday => 11, :name => "Armistice 1918", :regions => [:fr]}],
30
+ 12 => [{:mday => 25, :name => "Nöel", :regions => [:fr]}]
31
+ }
32
+ end
33
+
34
+
35
+ end
36
+
37
+ Holidays.merge_defs(Holidays::FR::DEFINED_REGIONS, Holidays::FR::HOLIDAYS_BY_MONTH)
@@ -1,40 +1,41 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/gb.yaml
6
+ #
7
+ # To use the definitions in this file, load them right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/gb'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module GB # :nodoc:
15
+ DEFINED_REGIONS = [:gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
19
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
20
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
21
+ 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
22
+ {:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
23
+ 3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
24
+ {:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}],
25
+ 5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
26
+ {:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
27
+ {:wday => 1, :week => -1, :name => "Bank Holiday", :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
+ 11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]}],
33
+ 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
34
+ {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]}]
35
+ }
36
+ end
37
+
38
+
39
+ end
40
+
41
+ Holidays.merge_defs(Holidays::GB::DEFINED_REGIONS, Holidays::GB::HOLIDAYS_BY_MONTH)
@@ -1,32 +1,33 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/ie.yaml
6
+ #
7
+ # To use the definitions in this file, load them right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/ie'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module IE # :nodoc:
15
+ DEFINED_REGIONS = [:ie]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
19
+ 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
20
+ 3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
21
+ 5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
22
+ 6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
23
+ 8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
24
+ 10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}],
25
+ 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
26
+ {:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}]
27
+ }
28
+ end
29
+
30
+
31
+ end
32
+
33
+ Holidays.merge_defs(Holidays::IE::DEFINED_REGIONS, Holidays::IE::HOLIDAYS_BY_MONTH)
@@ -1,61 +1,62 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/is.yaml
6
+ #
7
+ # To use the definitions in this file, load them right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/is'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module IS # :nodoc:
15
+ DEFINED_REGIONS = [:is]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
19
+ {:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
20
+ {:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
21
+ {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
22
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
23
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
24
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
25
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
26
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
27
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
28
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]}],
29
+ 1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
30
+ {:mday => 6, :name => "Þrettándinn", :regions => [:is]},
31
+ {:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
32
+ 2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
33
+ 4 => [{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
34
+ 5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
35
+ {:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
36
+ 6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
37
+ {:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
38
+ 8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
39
+ 11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
40
+ 12 => [{:mday => 24, :name => "Jól", :regions => [:is]},
41
+ {:mday => 25, :name => "Jól", :regions => [:is]},
42
+ {:mday => 26, :name => "Jól", :regions => [:is]},
43
+ {:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}]
44
+ }
45
+ end
46
+
47
+ # Iceland: first day of summer (Thursday after 18 April)
48
+ def self.is_sumardagurinn_fyrsti(year)
49
+ date = Date.civil(year,4,18)
50
+ if date.wday < 4
51
+ date += (4 - date.wday)
52
+ else date
53
+ date += (11 - date.wday)
54
+ end
55
+ date
56
+ end
57
+
58
+
59
+
60
+ end
61
+
62
+ Holidays.merge_defs(Holidays::IS::DEFINED_REGIONS, Holidays::IS::HOLIDAYS_BY_MONTH)
@@ -1,35 +1,36 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/it.yaml
6
+ #
7
+ # To use the definitions in this file, load them right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/it'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module IT # :nodoc:
15
+ DEFINED_REGIONS = [:it]
16
+
17
+ HOLIDAYS_BY_MONTH = {
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
+ 1 => [{:mday => 1, :name => "Capodanno", :regions => [:it]},
21
+ {:mday => 6, :name => "Epifania", :regions => [:it]}],
22
+ 4 => [{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]}],
23
+ 5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
24
+ 6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
25
+ 8 => [{:mday => 15, :name => "Assunzione", :regions => [:it]}],
26
+ 11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
27
+ 12 => [{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
28
+ {:mday => 25, :name => "Natale", :regions => [:it]},
29
+ {:mday => 26, :name => "Santo Stefano", :regions => [:it]}]
30
+ }
31
+ end
32
+
33
+
34
+ end
35
+
36
+ Holidays.merge_defs(Holidays::IT::DEFINED_REGIONS, Holidays::IT::HOLIDAYS_BY_MONTH)
@@ -1,51 +1,52 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/mx.yaml, data/north_america_informal.yaml
6
+ #
7
+ # To use the definitions in this file, load them right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/mx'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module MX # :nodoc:
15
+ DEFINED_REGIONS = [:mx, :mx_pue, :us, :ca]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
19
+ {:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
20
+ 2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
21
+ {:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
22
+ {:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
23
+ 3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
24
+ {:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
25
+ 4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
26
+ {:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
27
+ {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
28
+ 5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
29
+ {:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
30
+ {:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
31
+ {:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
32
+ {:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
33
+ {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
34
+ 6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
35
+ 9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
36
+ {:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
37
+ 10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
38
+ {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
39
+ 11 => [{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
40
+ {:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
41
+ {:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]}],
42
+ 12 => [{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
43
+ {:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
44
+ {:mday => 25, :name => "Navidad", :regions => [:mx]},
45
+ {:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}]
46
+ }
47
+ end
48
+
49
+
50
+ end
51
+
52
+ Holidays.merge_defs(Holidays::MX::DEFINED_REGIONS, Holidays::MX::HOLIDAYS_BY_MONTH)