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/MANIFEST
CHANGED
@@ -1,25 +1,28 @@
|
|
1
|
-
==== Regional definitions
|
2
|
-
The following definition files are included in this installation:
|
3
|
-
|
4
|
-
* holidays/
|
5
|
-
* holidays/
|
6
|
-
* holidays/
|
7
|
-
* holidays/
|
8
|
-
* holidays/
|
9
|
-
* holidays/
|
10
|
-
* holidays/
|
11
|
-
* holidays/
|
12
|
-
* holidays/
|
13
|
-
* holidays/
|
14
|
-
* holidays/
|
15
|
-
* holidays/
|
16
|
-
* holidays/
|
17
|
-
* holidays/
|
18
|
-
* holidays/
|
19
|
-
* holidays/
|
20
|
-
* holidays/
|
21
|
-
* holidays/
|
22
|
-
* holidays/
|
23
|
-
* holidays/
|
24
|
-
* holidays/
|
25
|
-
* holidays/
|
1
|
+
==== Regional definitions
|
2
|
+
The following definition files are included in this installation:
|
3
|
+
|
4
|
+
* holidays/nyse
|
5
|
+
* holidays/no
|
6
|
+
* holidays/es
|
7
|
+
* holidays/ie
|
8
|
+
* holidays/united_nations
|
9
|
+
* holidays/au
|
10
|
+
* holidays/mx
|
11
|
+
* holidays/za
|
12
|
+
* holidays/scandinavia
|
13
|
+
* holidays/ca
|
14
|
+
* holidays/us
|
15
|
+
* holidays/nl
|
16
|
+
* holidays/it
|
17
|
+
* holidays/de
|
18
|
+
* holidays/dk
|
19
|
+
* holidays/cz
|
20
|
+
* holidays/nz
|
21
|
+
* holidays/ups
|
22
|
+
* holidays/pt
|
23
|
+
* holidays/europe
|
24
|
+
* holidays/se
|
25
|
+
* holidays/north_america
|
26
|
+
* holidays/fr
|
27
|
+
* holidays/gb
|
28
|
+
* holidays/is
|
data/lib/holidays/au.rb
CHANGED
@@ -1,41 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
{:function => lambda { |year| Holidays.easter(year)
|
21
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
{:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
{:
|
30
|
-
|
31
|
-
{:wday => 1, :week => 2, :name => "
|
32
|
-
{:
|
33
|
-
|
34
|
-
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}]
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holiday gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: data/au.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/au'
|
12
|
+
#
|
13
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
14
|
+
module AU # :nodoc:
|
15
|
+
DEFINED_REGIONS = [:au, :au_tas, :au_wa, :au_vic, :au_qld, :au_nt, :au_act, :au_nsw, :au_sa, :au_qld_brisbane]
|
16
|
+
|
17
|
+
HOLIDAYS_BY_MONTH = {
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
|
22
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
|
23
|
+
{:mday => 26, :name => "Australia Day", :regions => [:au]}],
|
24
|
+
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
|
25
|
+
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
|
26
|
+
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}],
|
27
|
+
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]}],
|
28
|
+
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
|
29
|
+
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}],
|
30
|
+
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
|
31
|
+
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
|
32
|
+
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
|
33
|
+
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}],
|
34
|
+
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}],
|
35
|
+
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
|
36
|
+
{:mday => 26, :name => "Boxing Day", :regions => [:au]}]
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
Holidays.merge_defs(Holidays::AU::DEFINED_REGIONS, Holidays::AU::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/ca.rb
CHANGED
@@ -1,68 +1,69 @@
|
|
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
|
-
{:mday =>
|
25
|
-
{:mday =>
|
26
|
-
|
27
|
-
{:mday =>
|
28
|
-
|
29
|
-
{:
|
30
|
-
|
31
|
-
|
32
|
-
{:mday =>
|
33
|
-
|
34
|
-
|
35
|
-
{:mday =>
|
36
|
-
{:mday =>
|
37
|
-
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
38
|
-
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
39
|
-
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
40
|
-
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
41
|
-
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
42
|
-
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holiday gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: data/ca.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/ca'
|
12
|
+
#
|
13
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
14
|
+
module CA # :nodoc:
|
15
|
+
DEFINED_REGIONS = [:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_nf, :ca_nt, :ca_nu, :ca_bc, :ca_ns, :ca_yk, :us]
|
16
|
+
|
17
|
+
HOLIDAYS_BY_MONTH = {
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
20
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
21
|
+
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
|
22
|
+
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
23
|
+
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
24
|
+
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
25
|
+
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
26
|
+
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
27
|
+
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
28
|
+
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
29
|
+
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
30
|
+
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
31
|
+
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
32
|
+
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
33
|
+
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
|
34
|
+
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
|
35
|
+
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
36
|
+
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
|
37
|
+
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
38
|
+
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
39
|
+
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
40
|
+
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
41
|
+
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
42
|
+
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
43
|
+
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
|
44
|
+
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
45
|
+
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
46
|
+
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]}],
|
47
|
+
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
|
48
|
+
{:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
|
49
|
+
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
50
|
+
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Monday on or before May 24
|
55
|
+
def self.ca_victoria_day(year)
|
56
|
+
date = Date.civil(year,5,24)
|
57
|
+
if date.wday > 1
|
58
|
+
date -= (date.wday - 1)
|
59
|
+
elsif date.wday == 0
|
60
|
+
date -= 6
|
61
|
+
end
|
62
|
+
date
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
Holidays.merge_defs(Holidays::CA::DEFINED_REGIONS, Holidays::CA::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/cz.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holiday gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: data/cz.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/cz'
|
12
|
+
#
|
13
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
14
|
+
module CZ # :nodoc:
|
15
|
+
DEFINED_REGIONS = [:cz]
|
16
|
+
|
17
|
+
HOLIDAYS_BY_MONTH = {
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]}],
|
19
|
+
1 => [{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]}],
|
20
|
+
5 => [{:mday => 1, :name => "Svátek práce", :regions => [:cz]},
|
21
|
+
{:mday => 8, :name => "Den vítězství", :regions => [:cz]}],
|
22
|
+
7 => [{:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]},
|
23
|
+
{:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]}],
|
24
|
+
9 => [{:mday => 28, :name => "Den české státnosti", :regions => [:cz]}],
|
25
|
+
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]}],
|
26
|
+
11 => [{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]}],
|
27
|
+
12 => [{:mday => 24, :name => "Štědrý den", :regions => [:cz]},
|
28
|
+
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]},
|
29
|
+
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Holidays.merge_defs(Holidays::CZ::DEFINED_REGIONS, Holidays::CZ::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/de.rb
CHANGED
@@ -1,52 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :
|
21
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
22
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
23
|
-
|
24
|
-
{:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
{:mday =>
|
29
|
-
|
30
|
-
{:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
date
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Holidays.merge_defs(Holidays::DE::DEFINED_REGIONS, Holidays::DE::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/de.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/de'
|
12
|
+
#
|
13
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
14
|
+
module DE # :nodoc:
|
15
|
+
DEFINED_REGIONS = [:de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_bb, :de_mv, :de_sn, :de_th]
|
16
|
+
|
17
|
+
HOLIDAYS_BY_MONTH = {
|
18
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
20
|
+
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
21
|
+
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
22
|
+
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl]}],
|
23
|
+
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
24
|
+
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by, :de_st]}],
|
25
|
+
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]}],
|
26
|
+
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]}],
|
27
|
+
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
28
|
+
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}],
|
29
|
+
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
30
|
+
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_sn]}],
|
31
|
+
12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
32
|
+
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}]
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Germany: Wednesday before November 23
|
37
|
+
def self.de_buss_und_bettag(year)
|
38
|
+
date = Date.civil(year,11,23)
|
39
|
+
if date.wday > 3
|
40
|
+
date -= (date.wday - 3)
|
41
|
+
else
|
42
|
+
date -= (date.wday + 4)
|
43
|
+
end
|
44
|
+
date
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
Holidays.merge_defs(Holidays::DE::DEFINED_REGIONS, Holidays::DE::HOLIDAYS_BY_MONTH)
|
data/lib/holidays/dk.rb
CHANGED
@@ -1,47 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# require 'holidays
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
{:function => lambda { |year| Holidays.easter(year)-
|
21
|
-
{:function => lambda { |year| Holidays.easter(year)-
|
22
|
-
{:function => lambda { |year| Holidays.easter(year)
|
23
|
-
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "
|
24
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
25
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
26
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
27
|
-
{:function => lambda { |year| Holidays.easter(year)+
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
{:mday =>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
{:mday =>
|
36
|
-
{:mday =>
|
37
|
-
|
38
|
-
|
39
|
-
{:mday =>
|
40
|
-
{:mday =>
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holiday gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: data/dk.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/dk'
|
12
|
+
#
|
13
|
+
# More definitions are available at http://code.dunae.ca/holidays.
|
14
|
+
module DK # :nodoc:
|
15
|
+
DEFINED_REGIONS = [:dk]
|
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]},
|
19
|
+
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
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]},
|
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]},
|
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]},
|
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
|
+
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
|
29
|
+
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
30
|
+
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
31
|
+
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]}],
|
32
|
+
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
33
|
+
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
|
34
|
+
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
35
|
+
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
36
|
+
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]}],
|
37
|
+
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
|
38
|
+
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
39
|
+
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
40
|
+
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
41
|
+
{:mday => 26, :name => "2. juledag", :regions => [:dk]}]
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
Holidays.merge_defs(Holidays::DK::DEFINED_REGIONS, Holidays::DK::HOLIDAYS_BY_MONTH)
|