holidays 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,52 +1,38 @@
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)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/pt.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/pt'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module PT # :nodoc:
15
+ DEFINED_REGIONS = [:pt]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
19
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
20
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
21
+ {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
22
+ 1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
23
+ 4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
24
+ 5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
25
+ 6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
26
+ 8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
27
+ 10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}],
28
+ 11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
29
+ 12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
30
+ {:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
31
+ {:mday => 25, :name => "Natal", :regions => [:pt]}]
32
+ }
33
+ end
34
+
35
+
36
+ end
37
+
38
+ Holidays.merge_defs(Holidays::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH)
@@ -1,114 +1,124 @@
1
- module Holidays
2
- # This file is generated by the Ruby Holiday gem.
3
- #
4
- # Definitions loaded: data/dk.yaml, data/is.yaml, data/se.yaml
5
- #
6
- # To use the definitions in this file, load them right after you load the
7
- # Holiday gem:
8
- #
9
- # require 'holidays'
10
- # require 'holidays/scandinavia'
11
- #
12
- # More definitions are available at http://code.dunae.ca/holidays.
13
- module SCANDINAVIA # :nodoc:
14
- DEFINED_REGIONS = [:dk, :is, :se]
15
-
16
- HOLIDAYS_BY_MONTH = {
17
- 5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
18
- {:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
19
- {:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
20
- {:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
21
- {:mday => 1, :name => "Första maj", :regions => [:se]}],
22
- 0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
23
- {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
24
- {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
25
- {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
26
- {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
27
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
28
- {:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
29
- {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
30
- {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
31
- {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
32
- {:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
33
- {:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
34
- {:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
35
- {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
36
- {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
37
- {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
38
- {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
39
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
40
- {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
41
- {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
42
- {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
43
- {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
44
- {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
45
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
46
- {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
47
- {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
48
- {:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
49
- 11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
50
- {:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
51
- 6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
52
- {:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
53
- {:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
54
- {:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
55
- {:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
56
- {:mday => 6, :name => "Nationaldagen", :regions => [:se]},
57
- {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
58
- 1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
59
- {:mday => 1, :name => "Nýársdagur", :regions => [:is]},
60
- {:mday => 6, :name => "Þrettándinn", :regions => [:is]},
61
- {:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
62
- {:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
63
- {:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
64
- 12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
65
- {:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
66
- {:mday => 25, :name => "1. juledag", :regions => [:dk]},
67
- {:mday => 26, :name => "2. juledag", :regions => [:dk]},
68
- {:mday => 24, :name => "Jól", :regions => [:is]},
69
- {:mday => 25, :name => "Jól", :regions => [:is]},
70
- {:mday => 26, :name => "Jól", :regions => [:is]},
71
- {:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
72
- {:mday => 25, :name => "Juldagen", :regions => [:se]},
73
- {:mday => 26, :name => "Annandag jul", :regions => [:se]}],
74
- 2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
75
- 8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
76
- 4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
77
- {:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
78
- {:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
79
- {:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
80
- }
81
- end
82
-
83
- # Iceland: first day of summer (Thursday after 18 April)
84
- def self.is_sumardagurinn_fyrsti(year)
85
- date = Date.civil(year,4,18)
86
- if date.wday < 4
87
- date += (4 - date.wday)
88
- else date
89
- date += (11 - date.wday)
90
- end
91
- date
92
- end
93
-
94
-
95
- # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
96
- def self.se_alla_helgons_dag(year)
97
- date = Date.civil(year,10,31)
98
- date += (6 - date.wday)
99
- date
100
- end
101
-
102
-
103
- # Sweden: Mid-summer (Saturday between June 20–26)
104
- def self.se_midsommardagen(year)
105
- date = Date.civil(year,6,20)
106
- date += (6 - date.wday)
107
- date
108
- end
109
-
110
-
111
-
112
- end
113
-
114
- Holidays.merge_defs(Holidays::SCANDINAVIA::DEFINED_REGIONS, Holidays::SCANDINAVIA::HOLIDAYS_BY_MONTH)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/dk.yaml, data/is.yaml, data/no.yaml, data/se.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/scandinavia'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module Scandinavia # :nodoc:
15
+ DEFINED_REGIONS = [:dk, :no, :is, :se]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk, :no]},
19
+ {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk, :no]},
20
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
21
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk, :no]},
22
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
23
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk, :no]},
24
+ {:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
25
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk, :no]},
26
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
27
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
28
+ {:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
29
+ {:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
30
+ {:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
31
+ {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
32
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
33
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
34
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
35
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
36
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
37
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
38
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
39
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skjærtorsdag", :regions => [:no]},
40
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "1. påskedag", :regions => [:no]},
41
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
42
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]},
43
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
44
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
45
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
46
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
47
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
48
+ {:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
49
+ 1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
50
+ {:mday => 1, :name => "Nýársdagur", :regions => [:is]},
51
+ {:mday => 6, :name => "Þrettándinn", :regions => [:is]},
52
+ {:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
53
+ {:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
54
+ {:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
55
+ {:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
56
+ 4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
57
+ {:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
58
+ {:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
59
+ {:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
60
+ 5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
61
+ {:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
62
+ {:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
63
+ {:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
64
+ {:mday => 1, :name => "1. mai", :regions => [:no]},
65
+ {:mday => 17, :name => "17. mai", :regions => [:no]},
66
+ {:mday => 1, :name => "Första maj", :regions => [:se]}],
67
+ 6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
68
+ {:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
69
+ {:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
70
+ {:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
71
+ {:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
72
+ {:mday => 6, :name => "Nationaldagen", :regions => [:se]},
73
+ {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
74
+ 11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
75
+ {:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
76
+ 12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
77
+ {:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
78
+ {:mday => 25, :name => "1. juledag", :regions => [:dk, :no]},
79
+ {:mday => 26, :name => "2. juledag", :regions => [:dk, :no]},
80
+ {:mday => 24, :name => "Jól", :regions => [:is]},
81
+ {:mday => 25, :name => "Jól", :regions => [:is]},
82
+ {:mday => 26, :name => "Jól", :regions => [:is]},
83
+ {:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
84
+ {:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
85
+ {:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]},
86
+ {:mday => 25, :name => "Juldagen", :regions => [:se]},
87
+ {:mday => 26, :name => "Annandag jul", :regions => [:se]}],
88
+ 2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
89
+ 8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}]
90
+ }
91
+ end
92
+
93
+ # Iceland: first day of summer (Thursday after 18 April)
94
+ def self.is_sumardagurinn_fyrsti(year)
95
+ date = Date.civil(year,4,18)
96
+ if date.wday < 4
97
+ date += (4 - date.wday)
98
+ else date
99
+ date += (11 - date.wday)
100
+ end
101
+ date
102
+ end
103
+
104
+
105
+ # Sweden: Mid-summer (Saturday between June 20–26)
106
+ def self.se_midsommardagen(year)
107
+ date = Date.civil(year,6,20)
108
+ date += (6 - date.wday)
109
+ date
110
+ end
111
+
112
+
113
+ # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
114
+ def self.se_alla_helgons_dag(year)
115
+ date = Date.civil(year,10,31)
116
+ date += (6 - date.wday)
117
+ date
118
+ end
119
+
120
+
121
+
122
+ end
123
+
124
+ Holidays.merge_defs(Holidays::Scandinavia::DEFINED_REGIONS, Holidays::Scandinavia::HOLIDAYS_BY_MONTH)
@@ -1,52 +1,53 @@
1
- module Holidays
2
- # This file is generated by the Ruby Holiday gem.
3
- #
4
- # Definitions loaded: data/se.yaml
5
- #
6
- # To use the definitions in this file, load them right after you load the
7
- # Holiday gem:
8
- #
9
- # require 'holidays'
10
- # require 'holidays/se'
11
- #
12
- # More definitions are available at http://code.dunae.ca/holidays.
13
- module SE # :nodoc:
14
- DEFINED_REGIONS = [:se]
15
-
16
- HOLIDAYS_BY_MONTH = {
17
- 5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
18
- 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
19
- {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
20
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
21
- {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
22
- {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
23
- {:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
24
- 6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
25
- {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
26
- 1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
27
- {:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
28
- 12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
29
- {:mday => 26, :name => "Annandag jul", :regions => [:se]}]
30
- }
31
- end
32
-
33
- # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
34
- def self.se_alla_helgons_dag(year)
35
- date = Date.civil(year,10,31)
36
- date += (6 - date.wday)
37
- date
38
- end
39
-
40
-
41
- # Sweden: Mid-summer (Saturday between June 20–26)
42
- def self.se_midsommardagen(year)
43
- date = Date.civil(year,6,20)
44
- date += (6 - date.wday)
45
- date
46
- end
47
-
48
-
49
-
50
- end
51
-
52
- Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/se.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/se'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module SE # :nodoc:
15
+ DEFINED_REGIONS = [:se]
16
+
17
+ HOLIDAYS_BY_MONTH = {
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
+ 1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
25
+ {:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
26
+ 5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
27
+ 6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
28
+ {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
29
+ 12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
30
+ {:mday => 26, :name => "Annandag jul", :regions => [:se]}]
31
+ }
32
+ end
33
+
34
+ # Sweden: Mid-summer (Saturday between June 20–26)
35
+ def self.se_midsommardagen(year)
36
+ date = Date.civil(year,6,20)
37
+ date += (6 - date.wday)
38
+ date
39
+ end
40
+
41
+
42
+ # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
43
+ def self.se_alla_helgons_dag(year)
44
+ date = Date.civil(year,10,31)
45
+ date += (6 - date.wday)
46
+ date
47
+ end
48
+
49
+
50
+
51
+ end
52
+
53
+ Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
@@ -1,24 +1,25 @@
1
- module Holidays
2
- # This file is generated by the Ruby Holiday gem.
3
- #
4
- # Definitions loaded: data/united_nations.yaml
5
- #
6
- # To use the definitions in this file, load them right after you load the
7
- # Holiday gem:
8
- #
9
- # require 'holidays'
10
- # require 'holidays/united_nations'
11
- #
12
- # More definitions are available at http://code.dunae.ca/holidays.
13
- module United_Nations # :nodoc:
14
- DEFINED_REGIONS = [:]
15
-
16
- HOLIDAYS_BY_MONTH = {
17
-
18
- }
19
- end
20
-
21
-
22
- end
23
-
24
- Holidays.merge_defs(Holidays::United_Nations::DEFINED_REGIONS, Holidays::United_Nations::HOLIDAYS_BY_MONTH)
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holiday gem.
4
+ #
5
+ # Definitions loaded: data/united_nations.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/united_nations'
12
+ #
13
+ # More definitions are available at http://code.dunae.ca/holidays.
14
+ module United_Nations # :nodoc:
15
+ DEFINED_REGIONS = [:]
16
+
17
+ HOLIDAYS_BY_MONTH = {
18
+
19
+ }
20
+ end
21
+
22
+
23
+ end
24
+
25
+ Holidays.merge_defs(Holidays::United_Nations::DEFINED_REGIONS, Holidays::United_Nations::HOLIDAYS_BY_MONTH)