holidays 0.9.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CHANGELOG +7 -0
- data/{README → README.rdoc} +36 -39
- data/data/SYNTAX +1 -1
- data/data/au.yaml +110 -105
- data/data/build_defs.rb +4 -3
- data/data/ca.yaml +140 -140
- data/data/cz.yaml +68 -0
- data/data/de.yaml +12 -14
- data/data/dk.yaml +1 -1
- data/data/es.yaml +1 -1
- data/data/fr.yaml +1 -1
- data/data/gb.yaml +1 -1
- data/data/ie.yaml +1 -1
- data/data/index.yaml +7 -2
- data/data/is.yaml +1 -1
- data/data/it.yaml +1 -1
- data/data/mx.yaml +1 -1
- data/data/nl.yaml +1 -1
- data/data/no.yaml +82 -0
- data/data/nyse.yaml +1 -1
- data/data/nz.yaml +141 -0
- data/data/pt.yaml +1 -1
- data/data/se.yaml +1 -1
- data/data/united_nations.yaml +188 -188
- data/data/ups.yaml +55 -55
- data/data/us.yaml +80 -80
- data/data/za.yaml +1 -1
- data/holidays.gemspec +155 -0
- data/lib/holidays.rb +424 -403
- data/lib/holidays/MANIFEST +28 -25
- data/lib/holidays/au.rb +43 -41
- data/lib/holidays/ca.rb +69 -68
- data/lib/holidays/cz.rb +36 -0
- data/lib/holidays/de.rb +51 -52
- data/lib/holidays/dk.rb +48 -47
- data/lib/holidays/es.rb +53 -52
- data/lib/holidays/europe.rb +236 -215
- data/lib/holidays/fr.rb +37 -36
- data/lib/holidays/gb.rb +41 -40
- data/lib/holidays/ie.rb +33 -32
- data/lib/holidays/is.rb +62 -61
- data/lib/holidays/it.rb +36 -35
- data/lib/holidays/mx.rb +52 -51
- data/lib/holidays/nl.rb +37 -36
- data/lib/holidays/no.rb +40 -0
- data/lib/holidays/north_america.rb +108 -107
- data/lib/holidays/nyse.rb +33 -32
- data/lib/holidays/nz.rb +69 -0
- data/lib/holidays/pt.rb +38 -52
- data/lib/holidays/scandinavia.rb +124 -114
- data/lib/holidays/se.rb +53 -52
- data/lib/holidays/united_nations.rb +25 -24
- data/lib/holidays/ups.rb +32 -31
- data/lib/holidays/us.rb +49 -48
- data/lib/holidays/za.rb +36 -35
- data/rakefile.rb +105 -113
- data/test/defs/test_defs_au.rb +36 -36
- data/test/defs/test_defs_ca.rb +29 -29
- data/test/defs/test_defs_cz.rb +26 -0
- data/test/defs/test_defs_de.rb +51 -46
- data/test/defs/test_defs_dk.rb +30 -30
- data/test/defs/test_defs_es.rb +57 -57
- data/test/defs/test_defs_europe.rb +280 -240
- data/test/defs/test_defs_fr.rb +26 -26
- data/test/defs/test_defs_gb.rb +36 -36
- data/test/defs/test_defs_ie.rb +21 -21
- data/test/defs/test_defs_is.rb +33 -33
- data/test/defs/test_defs_it.rb +25 -25
- data/test/defs/test_defs_mx.rb +22 -22
- data/test/defs/test_defs_nl.rb +24 -24
- data/test/defs/test_defs_no.rb +29 -0
- data/test/defs/test_defs_north_america.rb +54 -54
- data/test/defs/test_defs_nyse.rb +22 -22
- data/test/defs/test_defs_nz.rb +22 -0
- data/test/defs/test_defs_pt.rb +32 -32
- data/test/defs/test_defs_scandinavia.rb +94 -75
- data/test/defs/test_defs_se.rb +32 -32
- data/test/defs/test_defs_ups.rb +21 -21
- data/test/defs/test_defs_us.rb +23 -23
- data/test/defs/test_defs_za.rb +25 -25
- data/test/test_date.rb +123 -0
- data/test/test_helper.rb +22 -0
- data/test/test_holidays.rb +128 -0
- data/test/test_multiple_regions.rb +24 -0
- metadata +126 -73
data/lib/holidays/pt.rb
CHANGED
@@ -1,52 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
0 => [{:function => lambda { |year| Holidays.easter(year)-
|
19
|
-
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "
|
20
|
-
{:function => lambda { |year| Holidays.easter(year)
|
21
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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)
|
data/lib/holidays/scandinavia.rb
CHANGED
@@ -1,114 +1,124 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
{:
|
20
|
-
{:
|
21
|
-
{:
|
22
|
-
|
23
|
-
{:function => lambda { |year| Holidays.easter(year)
|
24
|
-
{:function => lambda { |year| Holidays.easter(year)
|
25
|
-
{:function => lambda { |year| Holidays.easter(year)
|
26
|
-
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "
|
27
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
28
|
-
{:function => lambda { |year| Holidays.easter(year)
|
29
|
-
{:function => lambda { |year| Holidays.easter(year)
|
30
|
-
{:function => lambda { |year| Holidays.easter(year)
|
31
|
-
{:function => lambda { |year| Holidays.easter(year)
|
32
|
-
{:function => lambda { |year| Holidays.easter(year)-
|
33
|
-
{:function => lambda { |year| Holidays.easter(year)-
|
34
|
-
{:function => lambda { |year| Holidays.easter(year)
|
35
|
-
{:function => lambda { |year| Holidays.easter(year)
|
36
|
-
{:function => lambda { |year| Holidays.easter(year)
|
37
|
-
{:function => lambda { |year| Holidays.easter(year)
|
38
|
-
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "
|
39
|
-
{:function => lambda { |year| Holidays.easter(year)
|
40
|
-
{:function => lambda { |year| Holidays.easter(year)
|
41
|
-
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "
|
42
|
-
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "
|
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
|
-
|
50
|
-
{:mday =>
|
51
|
-
|
52
|
-
{:mday =>
|
53
|
-
{:mday =>
|
54
|
-
{:mday =>
|
55
|
-
{:mday =>
|
56
|
-
|
57
|
-
{:
|
58
|
-
|
59
|
-
{:
|
60
|
-
|
61
|
-
{:mday =>
|
62
|
-
{:mday => 1, :name => "
|
63
|
-
{:mday =>
|
64
|
-
|
65
|
-
{:mday =>
|
66
|
-
{:mday =>
|
67
|
-
|
68
|
-
{:mday =>
|
69
|
-
{:mday =>
|
70
|
-
{:mday =>
|
71
|
-
{:mday =>
|
72
|
-
{:mday =>
|
73
|
-
{:
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
{:mday =>
|
78
|
-
{:mday =>
|
79
|
-
{:
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
date
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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)
|
data/lib/holidays/se.rb
CHANGED
@@ -1,52 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
25
|
-
{:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
date
|
37
|
-
date
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
date
|
45
|
-
date
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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)
|