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/ar'
|
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 AR # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:ar]
|
@@ -18,7 +18,7 @@ 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 => "Viernes Santo", :regions => [:ar]}],
|
22
22
|
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:ar]}],
|
23
23
|
2 => [{:mday => 8, :name => "Carnaval", :regions => [:ar]},
|
24
24
|
{:mday => 9, :name => "Carnaval", :regions => [:ar]}],
|
@@ -37,9 +37,11 @@ module Holidays
|
|
37
37
|
{:mday => 25, :name => "Navidad", :regions => [:ar]}]
|
38
38
|
}
|
39
39
|
end
|
40
|
-
end
|
41
|
-
|
42
40
|
|
41
|
+
def self.custom_methods
|
42
|
+
{
|
43
|
+
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
43
47
|
end
|
44
|
-
|
45
|
-
Holidays.merge_defs(Holidays::AR.defined_regions, Holidays::AR.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/at'
|
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 AT # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:at]
|
@@ -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 => 1, :name => "Ostermontag", :regions => [:at]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Christi Himmelfahrt", :regions => [:at]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Pfingstmontag", :regions => [:at]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Fronleichnam", :regions => [:at]}],
|
25
25
|
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at]},
|
26
26
|
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]}],
|
27
27
|
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]}],
|
@@ -33,9 +33,11 @@ module Holidays
|
|
33
33
|
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at]}]
|
34
34
|
}
|
35
35
|
end
|
36
|
-
end
|
37
|
-
|
38
36
|
|
37
|
+
def self.custom_methods
|
38
|
+
{
|
39
|
+
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
39
43
|
end
|
40
|
-
|
41
|
-
Holidays.merge_defs(Holidays::AT.defined_regions, Holidays::AT.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/au'
|
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 AU # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_tas_south, :au_wa, :au_tas, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne]
|
@@ -18,135 +18,111 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
1 => [{:mday => 1, :observed =>
|
26
|
-
{:mday => 26, :observed =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:au]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Easter Saturday", :regions => [:au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:au_nsw, :au_vic]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:au]}],
|
25
|
+
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:au]},
|
26
|
+
{:mday => 26, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Australia Day", :regions => [:au]}],
|
27
27
|
2 => [{:wday => 1, :week => 2, :name => "Royal Hobart Regatta", :regions => [:au_tas_south]}],
|
28
28
|
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
|
29
29
|
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
|
30
30
|
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]},
|
31
|
-
{:function =>
|
31
|
+
{:function => "march_pub_hol_sa(year)", :function_arguments => [:year], :name => "March Public Holiday", :regions => [:au_sa]}],
|
32
32
|
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]},
|
33
|
-
{:mday => 25, :observed =>
|
34
|
-
{:mday => 25, :observed =>
|
35
|
-
5 => [{:function =>
|
33
|
+
{:mday => 25, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_tas]},
|
34
|
+
{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:au_wa]}],
|
35
|
+
5 => [{:function => "qld_labour_day_may(year)", :function_arguments => [:year], :name => "Labour Day", :regions => [:au_qld]},
|
36
36
|
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]},
|
37
|
-
{:function =>
|
37
|
+
{:function => "may_pub_hol_sa(year)", :function_arguments => [:year], :name => "May Public Holiday", :regions => [:au_sa]}],
|
38
38
|
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
|
39
39
|
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_vic]},
|
40
|
-
{:function =>
|
40
|
+
{:function => "qld_queens_birthday_june(year)", :function_arguments => [:year], :name => "Queen's Birthday", :regions => [:au_qld]},
|
41
41
|
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
|
42
42
|
7 => [{:wday => 5, :week => 3, :name => "Cairns Show", :regions => [:au_qld_cairns]}],
|
43
43
|
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}],
|
44
44
|
9 => [{:wday => 1, :week => -1, :name => "Queen's Birthday", :regions => [:au_wa]},
|
45
45
|
{:wday => 1, :week => -1, :name => "Family & Community Day", :regions => [:au_act]}],
|
46
|
-
10 => [{:function =>
|
46
|
+
10 => [{:function => "afl_grand_final(year)", :function_arguments => [:year], :name => "Friday before the AFL Grand Final", :regions => [:au_vic]},
|
47
47
|
{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]},
|
48
|
-
{:function =>
|
49
|
-
{:function =>
|
50
|
-
{:function =>
|
51
|
-
11 => [{:function =>
|
48
|
+
{:function => "qld_labour_day_october(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Labour Day", :regions => [:au_qld]},
|
49
|
+
{:function => "qld_queens_bday_october(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Queen's Birthday", :regions => [:au_qld]},
|
50
|
+
{:function => "hobart_show_day(year)", :function_arguments => [:year], :name => "Royal Hobart Show", :regions => [:au_tas_south]}],
|
51
|
+
11 => [{:function => "g20_day_2014_only(year)", :function_arguments => [:year], :name => "G20 Day", :regions => [:au_qld_brisbane]},
|
52
52
|
{:wday => 1, :week => 1, :name => "Recreation Day", :regions => [:au_tas_north]},
|
53
53
|
{:wday => 2, :week => 1, :name => "Melbourne Cup Day", :regions => [:au_vic_melbourne]}],
|
54
|
-
12 => [{:mday => 25, :observed =>
|
55
|
-
{:mday => 25, :observed =>
|
56
|
-
{:function =>
|
57
|
-
{:mday => 26, :observed =>
|
58
|
-
{:function =>
|
59
|
-
{:function =>
|
54
|
+
12 => [{:mday => 25, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_qld, :au_nsw, :au_act, :au_tas, :au_wa]},
|
55
|
+
{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_sa]},
|
56
|
+
{:function => "xmas_to_weekday_if_weekend(year)", :function_arguments => [:year], :name => "Christmas Day", :regions => [:au_vic, :au_nt]},
|
57
|
+
{:mday => 26, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:au_nsw, :au_vic, :au_qld, :au_act, :au_wa]},
|
58
|
+
{:function => "to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)", :function_arguments => [:year], :name => "Boxing Day", :regions => [:au_sa]},
|
59
|
+
{:function => "to_weekday_if_boxing_weekend_from_year(year)", :function_arguments => [:year], :name => "Boxing Day", :regions => [:au_tas, :au_nt]}]
|
60
60
|
}
|
61
61
|
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.afl_grand_final(year)
|
65
|
-
if year == 2015
|
66
|
-
Date.civil(2015, 10, 2)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
62
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
Holidays.calculate_day_of_month(year, 10, 1, 1)
|
77
|
-
elsif year == 2012
|
78
|
-
1
|
79
|
-
else
|
80
|
-
nil
|
81
|
-
end
|
63
|
+
def self.custom_methods
|
64
|
+
{
|
65
|
+
"afl_grand_final(year)" => Proc.new { |year|
|
66
|
+
if year == 2015
|
67
|
+
Date.civil(2015, 10, 2)
|
82
68
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
69
|
+
},
|
70
|
+
|
71
|
+
"qld_queens_bday_october(year)" => Proc.new { |year|
|
72
|
+
if year >= 2016
|
73
|
+
DateCalculatorFactory.day_of_month_calculator.call(year, 10, 1, 1)
|
74
|
+
elsif year == 2012
|
75
|
+
1
|
76
|
+
else
|
77
|
+
nil
|
91
78
|
end
|
79
|
+
},
|
92
80
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
def self.qld_labour_day_october(year)
|
97
|
-
if year >= 2013 && year < 2016
|
98
|
-
Holidays.calculate_day_of_month(year, 10, 1, 1)
|
99
|
-
end
|
81
|
+
"qld_queens_birthday_june(year)" => Proc.new { |year|
|
82
|
+
if year <= 2015
|
83
|
+
DateCalculatorFactory.day_of_month_calculator.call(year, 6, 2, 1)
|
100
84
|
end
|
85
|
+
},
|
101
86
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
def self.qld_queens_birthday_june(year)
|
106
|
-
if year <= 2015
|
107
|
-
Holidays.calculate_day_of_month(year, 6, 2, 1)
|
108
|
-
end
|
87
|
+
"qld_labour_day_may(year)" => Proc.new { |year|
|
88
|
+
if year < 2013 || year >= 2016
|
89
|
+
DateCalculatorFactory.day_of_month_calculator.call(year, 5, 1, 1)
|
109
90
|
end
|
91
|
+
},
|
110
92
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
def self.g20_day_2014_only(year)
|
115
|
-
year == 2014 ? 14 : nil
|
93
|
+
"qld_labour_day_october(year)" => Proc.new { |year|
|
94
|
+
if year >= 2013 && year < 2016
|
95
|
+
DateCalculatorFactory.day_of_month_calculator.call(year, 10, 1, 1)
|
116
96
|
end
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
97
|
+
},
|
98
|
+
|
99
|
+
"g20_day_2014_only(year)" => Proc.new { |year|
|
100
|
+
year == 2014 ? 14 : nil
|
101
|
+
},
|
102
|
+
|
103
|
+
"hobart_show_day(year)" => Proc.new { |year|
|
104
|
+
fourth_sat_in_oct = Date.civil(year, 10, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 10, 4, :saturday))
|
105
|
+
fourth_sat_in_oct - 2 # the thursday before
|
106
|
+
},
|
107
|
+
|
108
|
+
"march_pub_hol_sa(year)" => Proc.new { |year|
|
109
|
+
if year < 2006
|
110
|
+
nil
|
111
|
+
else
|
112
|
+
Date.civil(year, 3, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 3, :second, :monday))
|
124
113
|
end
|
114
|
+
},
|
125
115
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
nil
|
132
|
-
else
|
133
|
-
Date.civil(year, 3, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 3, :second, :monday))
|
134
|
-
end
|
116
|
+
"may_pub_hol_sa(year)" => Proc.new { |year|
|
117
|
+
if year >= 2006
|
118
|
+
nil
|
119
|
+
else
|
120
|
+
Date.civil(year, 5, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 5, :third, :monday))
|
135
121
|
end
|
122
|
+
},
|
136
123
|
|
137
124
|
|
138
|
-
|
139
|
-
|
140
|
-
def self.may_pub_hol_sa(year)
|
141
|
-
if year >= 2006
|
142
|
-
nil
|
143
|
-
else
|
144
|
-
Date.civil(year, 5, Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 5, :third, :monday))
|
125
|
+
}
|
126
|
+
end
|
145
127
|
end
|
146
128
|
end
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
Holidays.merge_defs(Holidays::AU.defined_regions, Holidays::AU.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/be'
|
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 BE # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:be]
|
@@ -18,11 +18,11 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :name => "Pâques", :regions => [:be]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Lundi de Pâques", :regions => [:be]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Ascension", :regions => [:be]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Pentecôte", :regions => [:be]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Lundi de Pentecôte", :regions => [:be]}],
|
26
26
|
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:be]}],
|
27
27
|
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:be]}],
|
28
28
|
7 => [{:mday => 21, :name => "Fête nationale", :regions => [:be]}],
|
@@ -32,9 +32,11 @@ module Holidays
|
|
32
32
|
12 => [{:mday => 25, :name => "Noël", :regions => [:be]}]
|
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::BE.defined_regions, Holidays::BE.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/be_fr'
|
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 BE_FR # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:be_fr]
|
@@ -18,11 +18,11 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :name => "Pâques", :regions => [:be_fr]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Lundi de Pâques", :regions => [:be_fr]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Ascension", :regions => [:be_fr]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Pentecôte", :regions => [:be_fr]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Lundi de Pentecôte", :regions => [:be_fr]}],
|
26
26
|
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:be_fr]}],
|
27
27
|
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:be_fr]}],
|
28
28
|
7 => [{:mday => 21, :name => "Fête nationale", :regions => [:be_fr]}],
|
@@ -32,9 +32,11 @@ module Holidays
|
|
32
32
|
12 => [{:mday => 25, :name => "Noël", :regions => [:be_fr]}]
|
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::BE_FR.defined_regions, Holidays::BE_FR.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/be_nl'
|
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 BE_NL # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:be_nl]
|
@@ -18,11 +18,11 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
{:function =>
|
23
|
-
{:function =>
|
24
|
-
{:function =>
|
25
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :name => "Pasen", :regions => [:be_nl]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Paasmaandag", :regions => [:be_nl]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "O.H. Hemelvaart", :regions => [:be_nl]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Pinksteren", :regions => [:be_nl]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Pinkstermaandag", :regions => [:be_nl]}],
|
26
26
|
1 => [{:mday => 1, :name => "Nieuwjaar", :regions => [:be_nl]}],
|
27
27
|
5 => [{:mday => 1, :name => "Feest van de Arbeid", :regions => [:be_nl]}],
|
28
28
|
7 => [{:mday => 21, :name => "Nationale Feestdag", :regions => [:be_nl]}],
|
@@ -32,9 +32,11 @@ module Holidays
|
|
32
32
|
12 => [{:mday => 25, :name => "Kerstmis", :regions => [:be_nl]}]
|
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::BE_NL.defined_regions, Holidays::BE_NL.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/bg'
|
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 BG # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:bg_en, :bg_bg]
|
@@ -18,14 +18,13 @@ 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 => lambda { |year| Holidays.orthodox_easter_julian(year)+1 }, :function_id => "orthodox_easter_julian(year)+1", :name => "Възкресение Христово. Великден", :regions => [:bg_bg]}],
|
21
|
+
0 => [{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:bg_en]},
|
22
|
+
{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Разпети петък", :regions => [:bg_bg]},
|
23
|
+
{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Holy Saturday", :regions => [:bg_en]},
|
24
|
+
{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Велика събота", :regions => [:bg_bg]},
|
25
|
+
{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:bg_en]},
|
26
|
+
{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :name => "Възкресение Христово. Великден", :regions => [:bg_bg, :bg_bg]},
|
27
|
+
{:function => "orthodox_easter_julian(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:bg_en]}],
|
29
28
|
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:bg_en]},
|
30
29
|
{:mday => 1, :name => "Нова година", :regions => [:bg_bg]}],
|
31
30
|
3 => [{:mday => 3, :name => "Liberation Day", :regions => [:bg_en]},
|
@@ -50,9 +49,11 @@ module Holidays
|
|
50
49
|
{:mday => 26, :name => "Рождество Христово. Коледа", :regions => [:bg_bg]}]
|
51
50
|
}
|
52
51
|
end
|
53
|
-
end
|
54
|
-
|
55
52
|
|
53
|
+
def self.custom_methods
|
54
|
+
{
|
55
|
+
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
56
59
|
end
|
57
|
-
|
58
|
-
Holidays.merge_defs(Holidays::BG.defined_regions, Holidays::BG.holidays_by_month)
|