holidays 3.3.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/CONTRIBUTING.md +37 -0
- data/README.md +16 -25
- data/REFERENCES +4 -1
- data/Rakefile +38 -8
- data/benchmark.rb +8 -0
- data/definitions/README.md +187 -8
- data/definitions/ar.yaml +2 -1
- data/definitions/at.yaml +17 -13
- data/definitions/au.yaml +65 -60
- data/definitions/be_fr.yaml +14 -10
- data/definitions/be_nl.yaml +8 -4
- data/definitions/bg.yaml +12 -6
- data/definitions/br.yaml +6 -3
- data/definitions/ca.yaml +8 -6
- data/definitions/ch.yaml +21 -15
- data/definitions/cl.yaml +4 -2
- data/definitions/cr.yaml +5 -3
- data/definitions/cz.yaml +4 -2
- data/definitions/de.yaml +25 -14
- data/definitions/dk.yaml +26 -17
- data/definitions/ecb_target.yaml +4 -2
- data/definitions/el.yaml +23 -18
- data/definitions/es.yaml +31 -28
- data/definitions/federal_reserve.yaml +12 -12
- data/definitions/fedex.yaml +6 -6
- data/definitions/fi.yaml +26 -25
- data/definitions/fr.yaml +8 -4
- data/definitions/gb.yaml +9 -7
- data/definitions/hr.yaml +8 -6
- data/definitions/hu.yaml +8 -6
- data/definitions/ie.yaml +17 -16
- data/definitions/index.yaml +1 -1
- data/definitions/is.yaml +29 -19
- data/definitions/it.yaml +10 -9
- data/definitions/jp.yaml +92 -44
- data/definitions/li.yaml +25 -20
- data/definitions/lt.yaml +2 -1
- data/definitions/ma.yaml +7 -7
- data/definitions/mx.yaml +11 -11
- data/definitions/nerc.yaml +6 -6
- data/definitions/nl.yaml +22 -18
- data/definitions/no.yaml +19 -11
- data/definitions/north_america_informal.yaml +6 -6
- data/definitions/nyse.yaml +9 -8
- data/definitions/nz.yaml +33 -29
- data/definitions/ph.yaml +15 -8
- data/definitions/pl.yaml +27 -17
- data/definitions/pt.yaml +4 -2
- data/definitions/ro.yaml +21 -18
- data/definitions/se.yaml +24 -18
- data/definitions/sg.yaml +10 -9
- data/definitions/si.yaml +4 -2
- data/definitions/sk.yaml +4 -2
- data/definitions/united_nations.yaml +12 -12
- data/definitions/ups.yaml +6 -6
- data/definitions/us.yaml +12 -11
- data/definitions/ve.yaml +8 -4
- data/definitions/vi.yaml +6 -6
- data/definitions/za.yaml +26 -24
- data/holidays.gemspec +3 -1
- data/lib/generated_definitions/MANIFEST +1 -1
- data/lib/generated_definitions/ar.rb +8 -6
- data/lib/generated_definitions/at.rb +11 -9
- data/lib/generated_definitions/au.rb +75 -99
- data/lib/generated_definitions/be.rb +12 -10
- data/lib/generated_definitions/be_fr.rb +12 -10
- data/lib/generated_definitions/be_nl.rb +12 -10
- data/lib/generated_definitions/bg.rb +14 -13
- data/lib/generated_definitions/br.rb +11 -9
- data/lib/generated_definitions/ca.rb +20 -20
- data/lib/generated_definitions/ch.rb +41 -44
- data/lib/generated_definitions/cl.rb +9 -7
- data/lib/generated_definitions/cr.rb +9 -7
- data/lib/generated_definitions/cz.rb +9 -6
- data/lib/generated_definitions/de.rb +25 -25
- data/lib/generated_definitions/dk.rb +17 -15
- data/lib/generated_definitions/ecb_target.rb +9 -7
- data/lib/generated_definitions/el.rb +13 -11
- data/lib/generated_definitions/es.rb +35 -33
- data/lib/generated_definitions/europe.rb +234 -247
- data/lib/generated_definitions/federal_reserve.rb +11 -9
- data/lib/generated_definitions/fedex.rb +42 -0
- data/lib/generated_definitions/fi.rb +32 -36
- data/lib/generated_definitions/fr.rb +12 -10
- data/lib/generated_definitions/gb.rb +15 -13
- data/lib/generated_definitions/hr.rb +10 -8
- data/lib/generated_definitions/hu.rb +9 -7
- data/lib/generated_definitions/ie.rb +17 -17
- data/lib/generated_definitions/is.rb +26 -26
- data/lib/generated_definitions/it.rb +9 -7
- data/lib/generated_definitions/jp.rb +112 -89
- data/lib/generated_definitions/li.rb +14 -12
- data/lib/generated_definitions/lt.rb +9 -7
- data/lib/generated_definitions/ma.rb +7 -5
- data/lib/generated_definitions/mx.rb +7 -5
- data/lib/generated_definitions/nerc.rb +10 -8
- data/lib/generated_definitions/nl.rb +15 -13
- data/lib/generated_definitions/no.rb +16 -14
- data/lib/generated_definitions/north_america.rb +34 -37
- data/lib/generated_definitions/nyse.rb +10 -8
- data/lib/generated_definitions/nz.rb +40 -40
- data/lib/generated_definitions/ph.rb +17 -13
- data/lib/generated_definitions/pl.rb +25 -27
- data/lib/generated_definitions/pt.rb +10 -8
- data/lib/generated_definitions/ro.rb +11 -9
- data/lib/generated_definitions/scandinavia.rb +92 -102
- data/lib/generated_definitions/se.rb +25 -27
- data/lib/generated_definitions/sg.rb +11 -9
- data/lib/generated_definitions/si.rb +10 -8
- data/lib/generated_definitions/sk.rb +9 -7
- data/lib/generated_definitions/united_nations.rb +7 -5
- data/lib/generated_definitions/ups.rb +13 -12
- data/lib/generated_definitions/us.rb +20 -21
- data/lib/generated_definitions/ve.rb +11 -9
- data/lib/generated_definitions/vi.rb +7 -5
- data/lib/generated_definitions/za.rb +19 -17
- data/lib/holidays.rb +20 -83
- data/lib/holidays/date_calculator/weekend_modifier.rb +22 -5
- data/lib/holidays/definition/context/generator.rb +67 -29
- data/lib/holidays/definition/context/merger.rb +8 -8
- data/lib/holidays/definition/decorator/custom_method_proc.rb +28 -0
- data/lib/holidays/definition/decorator/custom_method_source.rb +30 -0
- data/lib/holidays/definition/entity/custom_method.rb +11 -0
- data/lib/holidays/definition/parser/custom_method.rb +69 -0
- data/lib/holidays/definition/repository/custom_methods.rb +27 -0
- data/lib/holidays/definition/repository/holidays_by_month.rb +1 -1
- data/lib/holidays/definition/repository/{proc_cache.rb → proc_result_cache.rb} +19 -4
- data/lib/holidays/definition/validator/custom_method.rb +31 -0
- data/lib/holidays/definition_factory.rb +42 -6
- data/lib/holidays/errors.rb +6 -0
- data/lib/holidays/load_all_definitions.rb +57 -0
- data/lib/holidays/option/context/parse_options.rb +26 -16
- data/lib/holidays/option_factory.rb +1 -0
- data/lib/holidays/use_case/context/between.rb +41 -14
- data/lib/holidays/use_case_factory.rb +2 -1
- data/lib/holidays/version.rb +1 -1
- data/test/data/test_single_custom_holiday_with_custom_procs.yaml +24 -0
- data/test/defs/test_defs_at.rb +1 -1
- data/test/defs/test_defs_au.rb +3 -2
- data/test/defs/test_defs_cr.rb +1 -0
- data/test/defs/test_defs_cz.rb +1 -0
- data/test/defs/test_defs_dk.rb +2 -2
- data/test/defs/test_defs_el.rb +7 -6
- data/test/defs/test_defs_europe.rb +40 -33
- data/test/defs/test_defs_fedex.rb +24 -0
- data/test/defs/test_defs_fi.rb +4 -3
- data/test/defs/test_defs_hr.rb +2 -2
- data/test/defs/test_defs_hu.rb +2 -2
- data/test/defs/test_defs_is.rb +2 -1
- data/test/defs/test_defs_it.rb +2 -1
- data/test/defs/test_defs_jp.rb +1 -1
- data/test/defs/test_defs_li.rb +1 -1
- data/test/defs/test_defs_ma.rb +2 -1
- data/test/defs/test_defs_mx.rb +4 -3
- data/test/defs/test_defs_nl.rb +7 -6
- data/test/defs/test_defs_no.rb +1 -0
- data/test/defs/test_defs_north_america.rb +4 -3
- data/test/defs/test_defs_nyse.rb +2 -1
- data/test/defs/test_defs_pl.rb +1 -0
- data/test/defs/test_defs_ro.rb +11 -11
- data/test/defs/test_defs_scandinavia.rb +12 -8
- data/test/defs/test_defs_se.rb +3 -2
- data/test/defs/test_defs_sg.rb +2 -1
- data/test/defs/test_defs_vi.rb +1 -1
- data/test/defs/test_defs_za.rb +3 -2
- data/test/holidays/date_calculator/test_weekend_modifier.rb +11 -0
- data/test/holidays/definition/context/test_generator.rb +64 -5
- data/test/holidays/definition/context/test_merger.rb +5 -2
- data/test/holidays/definition/decorator/test_custom_method_proc.rb +113 -0
- data/test/holidays/definition/decorator/test_custom_method_source.rb +96 -0
- data/test/holidays/definition/parser/test_custom_method.rb +79 -0
- data/test/holidays/definition/repository/test_custom_methods.rb +43 -0
- data/test/holidays/definition/repository/test_holidays_by_month.rb +0 -32
- data/test/holidays/definition/repository/test_proc_result_cache.rb +84 -0
- data/test/holidays/definition/validator/test_custom_method.rb +89 -0
- data/test/holidays/option/context/test_parse_options.rb +5 -0
- data/test/holidays/test_definition_factory.rb +17 -2
- data/test/holidays/use_case/context/test_between.rb +2 -0
- data/test/test_all_regions.rb +7 -49
- data/test/test_custom_holidays.rb +8 -2
- data/test/test_helper.rb +9 -2
- data/test/test_holidays.rb +9 -29
- metadata +46 -11
- data/lib/generated_definitions/fed_ex.rb +0 -41
- data/test/holidays/definition/repository/test_proc_cache.rb +0 -29
- data/test/test_parse_definitions.rb +0 -30
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/br'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module BR # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:br]
|
@@ -18,10 +18,10 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :type => :informal, :name => "Carnaval", :regions => [:br]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Sexta-feira Santa", :regions => [:br]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Páscoa", :regions => [:br]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Corpus Christi", :regions => [:br]}],
|
25
25
|
1 => [{:mday => 1, :name => "Dia da Confraternização Universal", :regions => [:br]}],
|
26
26
|
4 => [{:mday => 21, :name => "Dia de Tiradentes", :regions => [:br]}],
|
27
27
|
5 => [{:mday => 1, :name => "Dia do Trabalho", :regions => [:br]}],
|
@@ -32,9 +32,11 @@ module Holidays
|
|
32
32
|
12 => [{:mday => 25, :name => "Natal", :regions => [:br]}]
|
33
33
|
}
|
34
34
|
end
|
35
|
-
end
|
36
|
-
|
37
35
|
|
36
|
+
def self.custom_methods
|
37
|
+
{
|
38
|
+
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
38
42
|
end
|
39
|
-
|
40
|
-
Holidays.merge_defs(Holidays::BR.defined_regions, Holidays::BR.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/ca'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module CA # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :us]
|
@@ -18,9 +18,9 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:ca]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:ca]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
24
24
|
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
25
25
|
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
|
26
26
|
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
@@ -32,15 +32,15 @@ module Holidays
|
|
32
32
|
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
33
33
|
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
34
34
|
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
35
|
-
5 => [{:function =>
|
36
|
-
{:function =>
|
35
|
+
5 => [{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "Victoria Day", :regions => [:ca]},
|
36
|
+
{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "National Patriotes Day", :regions => [:ca_qc]},
|
37
37
|
{:wday => 0, :week => 2, :type => :informal, :name => "Mother's Day", :regions => [:us, :ca]},
|
38
38
|
{:wday => 6, :week => 3, :type => :informal, :name => "Armed Forces Day", :regions => [:us]}],
|
39
39
|
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
40
40
|
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
41
41
|
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
|
42
42
|
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
43
|
-
7 => [{:mday => 1, :observed =>
|
43
|
+
7 => [{:mday => 1, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Canada Day", :regions => [:ca]},
|
44
44
|
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
45
45
|
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
|
46
46
|
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
@@ -60,21 +60,21 @@ module Holidays
|
|
60
60
|
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
61
61
|
}
|
62
62
|
end
|
63
|
-
end
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
date
|
64
|
+
def self.custom_methods
|
65
|
+
{
|
66
|
+
"ca_victoria_day(year)" => Proc.new { |year|
|
67
|
+
date = Date.civil(year,5,24)
|
68
|
+
if date.wday > 1
|
69
|
+
date -= (date.wday - 1)
|
70
|
+
elsif date.wday == 0
|
71
|
+
date -= 6
|
74
72
|
end
|
73
|
+
date
|
74
|
+
},
|
75
75
|
|
76
76
|
|
77
|
-
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
78
80
|
end
|
79
|
-
|
80
|
-
Holidays.merge_defs(Holidays::CA.defined_regions, Holidays::CA.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/ch'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module CH # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch]
|
@@ -18,19 +18,19 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
{:function =>
|
26
|
-
{:function =>
|
27
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Karfreitag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Ostermontag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_vs, :ch_ge, :ch_ju]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Auffahrt", :regions => [:ch]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Pfingstmontag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_vs, :ch_ge, :ch_ju]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Fronleichnam", :regions => [:ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_zg, :ch_fr, :ch_so, :ch_ai, :ch_ag, :ch_ti, :ch_vs, :ch_ne, :ch_ju]},
|
26
|
+
{:function => "ch_vd_lundi_du_jeune_federal(year)", :function_arguments => [:year], :name => "Lundi du Jeûne fédéral", :regions => [:ch_vd]},
|
27
|
+
{:function => "ch_ge_jeune_genevois(year)", :function_arguments => [:year], :name => "Jeûne genevois", :regions => [:ch_ge]}],
|
28
28
|
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_vd, :ch_vs, :ch_ne, :ch_ge, :ch_ju, :ch_ti]},
|
29
29
|
{:mday => 2, :name => "Berchtoldstag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_sh, :ch_sg, :ch_ag, :ch_tg, :ch_vd, :ch_vs, :ch_ne, :ch_ju]},
|
30
30
|
{:mday => 6, :name => "Dreikönigstag", :regions => [:ch_ur, :ch_sz, :ch_ti]}],
|
31
31
|
3 => [{:mday => 1, :name => "Instauration de la République", :regions => [:ch_ne]},
|
32
32
|
{:mday => 19, :name => "Josephstag", :regions => [:ch_ur, :ch_sz, :ch_nw, :ch_ti, :ch_vs]}],
|
33
|
-
4 => [{:function =>
|
33
|
+
4 => [{:function => "ch_gl_naefelser_fahrt(year)", :function_arguments => [:year], :name => "Näfelser Fahrt", :regions => [:ch_gl]}],
|
34
34
|
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:ch_zh, :ch_bs, :ch_bl, :ch_sh, :ch_ag, :ch_tg, :ch_ti, :ch_ne, :ch_ju]}],
|
35
35
|
6 => [{:mday => 23, :name => "Commémoration du plébiscite jurassien", :regions => [:ch_ju]},
|
36
36
|
{:mday => 29, :name => "San Pietro e Paolo", :regions => [:ch_ti]}],
|
@@ -45,48 +45,45 @@ module Holidays
|
|
45
45
|
{:mday => 31, :name => "Restauration de la République", :regions => [:ch_ge]}]
|
46
46
|
}
|
47
47
|
end
|
48
|
-
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
# There are 15 days between the first Sunday
|
58
|
-
# and the Monday after the third Sunday
|
59
|
-
date + 15
|
49
|
+
def self.custom_methods
|
50
|
+
{
|
51
|
+
"ch_vd_lundi_du_jeune_federal(year)" => Proc.new { |year|
|
52
|
+
date = Date.civil(year,9,1)
|
53
|
+
# Find the first Sunday of September
|
54
|
+
until date.wday.eql? 0 do
|
55
|
+
date += 1
|
60
56
|
end
|
57
|
+
# There are 15 days between the first Sunday
|
58
|
+
# and the Monday after the third Sunday
|
59
|
+
date + 15
|
60
|
+
},
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
until date.wday.eql? 0 do
|
68
|
-
date += 1
|
69
|
-
end
|
70
|
-
# Thursday is four days after Sunday
|
71
|
-
date + 4
|
62
|
+
"ch_ge_jeune_genevois(year)" => Proc.new { |year|
|
63
|
+
date = Date.civil(year,9,1)
|
64
|
+
# Find the first Sunday of September
|
65
|
+
until date.wday.eql? 0 do
|
66
|
+
date += 1
|
72
67
|
end
|
68
|
+
# Thursday is four days after Sunday
|
69
|
+
date + 4
|
70
|
+
},
|
73
71
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
until date.wday.eql? 4 do
|
80
|
-
date += 1
|
81
|
-
end
|
82
|
-
if date.eql?(easter(year)-3)
|
83
|
-
date += 7
|
84
|
-
end
|
85
|
-
date
|
72
|
+
"ch_gl_naefelser_fahrt(year)" => Proc.new { |year|
|
73
|
+
date = Date.civil(year,4,1)
|
74
|
+
# Find the first Thursday of April
|
75
|
+
until date.wday.eql? 4 do
|
76
|
+
date += 1
|
86
77
|
end
|
87
78
|
|
79
|
+
if date.eql?(Holidays::DateCalculatorFactory::Easter::Gregorian.easter_calculator.calculate_easter_for(year)-3)
|
80
|
+
date += 7
|
81
|
+
end
|
82
|
+
date
|
83
|
+
},
|
88
84
|
|
89
85
|
|
86
|
+
}
|
87
|
+
end
|
88
|
+
end
|
90
89
|
end
|
91
|
-
|
92
|
-
Holidays.merge_defs(Holidays::CH.defined_regions, Holidays::CH.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/cl'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module CL # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:cl]
|
@@ -18,8 +18,8 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Viernes Santo", :regions => [:cl]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Sábado Santo", :regions => [:cl]}],
|
23
23
|
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:cl]}],
|
24
24
|
5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:cl]},
|
25
25
|
{:mday => 21, :name => "Día de las Glorias Navales", :regions => [:cl]}],
|
@@ -35,9 +35,11 @@ module Holidays
|
|
35
35
|
{:mday => 25, :name => "Navidad", :regions => [:cl]}]
|
36
36
|
}
|
37
37
|
end
|
38
|
-
end
|
39
|
-
|
40
38
|
|
39
|
+
def self.custom_methods
|
40
|
+
{
|
41
|
+
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
41
45
|
end
|
42
|
-
|
43
|
-
Holidays.merge_defs(Holidays::CL.defined_regions, Holidays::CL.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/cr'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module CR # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:cr]
|
@@ -18,8 +18,8 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -3, :name => "Jueves Santo", :regions => [:cr]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Viernes Santo", :regions => [:cr]}],
|
23
23
|
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:cr]}],
|
24
24
|
4 => [{:mday => 11, :name => "Día de Juan Santamaría", :regions => [:cr]}],
|
25
25
|
5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:cr]}],
|
@@ -31,9 +31,11 @@ module Holidays
|
|
31
31
|
12 => [{:mday => 25, :name => "Navidad", :regions => [:cr]}]
|
32
32
|
}
|
33
33
|
end
|
34
|
-
end
|
35
|
-
|
36
34
|
|
35
|
+
def self.custom_methods
|
36
|
+
{
|
37
|
+
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
37
41
|
end
|
38
|
-
|
39
|
-
Holidays.merge_defs(Holidays::CR.defined_regions, Holidays::CR.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/cz'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module CZ # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:cz]
|
@@ -18,7 +18,8 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Velký pátek", :regions => [:cz]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Velikonoční pondělí", :regions => [:cz]}],
|
22
23
|
1 => [{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]}],
|
23
24
|
5 => [{:mday => 1, :name => "Svátek práce", :regions => [:cz]},
|
24
25
|
{:mday => 8, :name => "Den vítězství", :regions => [:cz]}],
|
@@ -32,9 +33,11 @@ module Holidays
|
|
32
33
|
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}]
|
33
34
|
}
|
34
35
|
end
|
35
|
-
end
|
36
|
-
|
37
36
|
|
37
|
+
def self.custom_methods
|
38
|
+
{
|
39
|
+
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
38
43
|
end
|
39
|
-
|
40
|
-
Holidays.merge_defs(Holidays::CZ.defined_regions, Holidays::CZ.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/de'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module DE # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_aux, :de_th_aux, :de_sn, :de_st, :de_by_aux, :de_bb, :de_mv, :de_th]
|
@@ -18,16 +18,16 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
{:function =>
|
26
|
-
{:function =>
|
27
|
-
{:function =>
|
28
|
-
{:function =>
|
29
|
-
{:function =>
|
30
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Karfreitag", :regions => [:de]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Ostersonntag", :regions => [:de]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Ostermontag", :regions => [:de]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Christi Himmelfahrt", :regions => [:de]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :type => :informal, :name => "Pfingstsonntag", :regions => [:de]},
|
26
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Pfingstmontag", :regions => [:de]},
|
27
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_aux, :de_th_aux]},
|
28
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -52, :type => :informal, :name => "Weiberfastnacht", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn]},
|
29
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -48, :type => :informal, :name => "Rosenmontag", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn]},
|
30
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -46, :type => :informal, :name => "Aschermittwoch", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn]}],
|
31
31
|
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
32
32
|
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by, :de_st]}],
|
33
33
|
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]}],
|
@@ -38,28 +38,28 @@ module Holidays
|
|
38
38
|
{:mday => 31, :type => :informal, :name => "Reformationstag", :regions => [:de_bw]},
|
39
39
|
{:mday => 31, :year_ranges => [{:limited => [2017]}],:name => "Reformationstag", :regions => [:de]}],
|
40
40
|
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
41
|
-
{:function =>
|
41
|
+
{:function => "de_buss_und_bettag(year)", :function_arguments => [:year], :name => "Buß- und Bettag", :regions => [:de_sn]}],
|
42
42
|
12 => [{:mday => 24, :type => :informal, :name => "Heilig Abend", :regions => [:de]},
|
43
43
|
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
44
44
|
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]},
|
45
45
|
{:mday => 31, :type => :informal, :name => "Silvester", :regions => [:de]}]
|
46
46
|
}
|
47
47
|
end
|
48
|
-
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
date
|
49
|
+
def self.custom_methods
|
50
|
+
{
|
51
|
+
"de_buss_und_bettag(year)" => Proc.new { |year|
|
52
|
+
date = Date.civil(year,11,23)
|
53
|
+
if date.wday > 3
|
54
|
+
date -= (date.wday - 3)
|
55
|
+
else
|
56
|
+
date -= (date.wday + 4)
|
59
57
|
end
|
58
|
+
date
|
59
|
+
},
|
60
60
|
|
61
61
|
|
62
|
-
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
63
65
|
end
|
64
|
-
|
65
|
-
Holidays.merge_defs(Holidays::DE.defined_regions, Holidays::DE.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/dk'
|
12
12
|
#
|
13
|
-
# All the definitions are available at https://github.com/
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
14
|
module DK # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:dk]
|
@@ -18,16 +18,16 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
{:function =>
|
26
|
-
{:function =>
|
27
|
-
{:function =>
|
28
|
-
{:function =>
|
29
|
-
{:function =>
|
30
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -49, :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -7, :type => :informal, :name => "Palmesøndag", :regions => [:dk]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -3, :name => "Skærtorsdag", :regions => [:dk]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Langfredag", :regions => [:dk]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Påskedag", :regions => [:dk]},
|
26
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "2. påskedag", :regions => [:dk]},
|
27
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 26, :name => "Store Bededag", :regions => [:dk]},
|
28
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
29
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Pinsedag", :regions => [:dk]},
|
30
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "2. Pinsedag", :regions => [:dk]}],
|
31
31
|
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
|
32
32
|
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
33
33
|
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
@@ -44,9 +44,11 @@ module Holidays
|
|
44
44
|
{:mday => 26, :name => "2. juledag", :regions => [:dk]}]
|
45
45
|
}
|
46
46
|
end
|
47
|
-
end
|
48
|
-
|
49
47
|
|
48
|
+
def self.custom_methods
|
49
|
+
{
|
50
|
+
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
50
54
|
end
|
51
|
-
|
52
|
-
Holidays.merge_defs(Holidays::DK.defined_regions, Holidays::DK.holidays_by_month)
|