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/federal_reserve'
|
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 FEDERAL_RESERVE # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:federal_reserve]
|
@@ -18,21 +18,23 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
1 => [{:mday => 1, :observed =>
|
21
|
+
1 => [{:mday => 1, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:federal_reserve]},
|
22
22
|
{:wday => 1, :week => 3, :name => "Birthday of Martin Luther King, Jr", :regions => [:federal_reserve]}],
|
23
23
|
2 => [{:wday => 1, :week => 3, :name => "Washington's Birthday", :regions => [:federal_reserve]}],
|
24
24
|
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:federal_reserve]}],
|
25
|
-
7 => [{:mday => 4, :observed =>
|
25
|
+
7 => [{:mday => 4, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Independence Day", :regions => [:federal_reserve]}],
|
26
26
|
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:federal_reserve]}],
|
27
27
|
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:federal_reserve]}],
|
28
|
-
11 => [{:mday => 11, :observed =>
|
28
|
+
11 => [{:mday => 11, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Veterans Day", :regions => [:federal_reserve]},
|
29
29
|
{:wday => 4, :week => 4, :name => "Thanksgiving Day", :regions => [:federal_reserve]}],
|
30
|
-
12 => [{:mday => 25, :observed =>
|
30
|
+
12 => [{:mday => 25, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:federal_reserve]}]
|
31
31
|
}
|
32
32
|
end
|
33
|
-
end
|
34
|
-
|
35
33
|
|
34
|
+
def self.custom_methods
|
35
|
+
{
|
36
|
+
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
36
40
|
end
|
37
|
-
|
38
|
-
Holidays.merge_defs(Holidays::FEDERAL_RESERVE.defined_regions, Holidays::FEDERAL_RESERVE.holidays_by_month)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/fedex.yaml
|
6
|
+
#
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
|
+
# Holiday gem:
|
9
|
+
#
|
10
|
+
# require 'holidays'
|
11
|
+
# require 'generated_definitions/fedex'
|
12
|
+
#
|
13
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
14
|
+
module FEDEX # :nodoc:
|
15
|
+
def self.defined_regions
|
16
|
+
[:fedex]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.holidays_by_month
|
20
|
+
{
|
21
|
+
1 => [{:mday => 1, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:fedex]}],
|
22
|
+
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:fedex]}],
|
23
|
+
7 => [{:mday => 4, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Independence Day", :regions => [:fedex]}],
|
24
|
+
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:fedex]}],
|
25
|
+
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:fedex]},
|
26
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Day After Thanksgiving", :regions => [:fedex]}],
|
27
|
+
12 => [{:mday => 25, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:fedex]},
|
28
|
+
{:mday => 31, :name => "New Year's Eve", :regions => [:fedex]}]
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.custom_methods
|
33
|
+
{
|
34
|
+
"day_after_thanksgiving(year)" => Proc.new { |year|
|
35
|
+
Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 11, 4, 4) + 1
|
36
|
+
},
|
37
|
+
|
38
|
+
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/fi'
|
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 FI # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:fi]
|
@@ -18,54 +18,50 @@ 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 =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Pitkäperjantai", :regions => [:fi]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Pääsiäispäivä", :regions => [:fi]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "2. Pääsiäispäivä", :regions => [:fi]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Helatorstai", :regions => [:fi]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Helluntaipäivä", :regions => [:fi]},
|
26
|
+
{:function => "fi_pyhainpaiva(year)", :function_arguments => [:year], :name => "Pyhäinpäivä", :regions => [:fi]}],
|
27
27
|
1 => [{:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
|
28
28
|
{:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
|
29
29
|
5 => [{:mday => 1, :name => "Vappu", :regions => [:fi]}],
|
30
|
-
6 => [{:function =>
|
31
|
-
{:function =>
|
30
|
+
6 => [{:function => "fi_juhannusaatto(year)", :function_arguments => [:year], :name => "Juhannusaatto", :regions => [:fi]},
|
31
|
+
{:function => "fi_juhannuspaiva(year)", :function_arguments => [:year], :name => "Juhannuspäivä", :regions => [:fi]}],
|
32
32
|
12 => [{:mday => 6, :name => "Itsenäisyyspäivä", :regions => [:fi]},
|
33
33
|
{:mday => 24, :name => "Jouluaatto", :regions => [:fi]},
|
34
34
|
{:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
|
35
35
|
{:mday => 26, :name => "Tapaninpäivä", :regions => [:fi]}]
|
36
36
|
}
|
37
37
|
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Finland: Mid-summer eve (Friday between June 19–25)
|
41
|
-
def self.fi_juhannusaatto(year)
|
42
|
-
date = Date.civil(year,6,19)
|
43
|
-
if date.wday > 5 #if 19.6 is saturday
|
44
|
-
date += 6
|
45
|
-
else
|
46
|
-
date += (5 - date.wday)
|
47
|
-
end
|
48
|
-
date
|
49
|
-
end
|
50
|
-
|
51
38
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
39
|
+
def self.custom_methods
|
40
|
+
{
|
41
|
+
"fi_juhannusaatto(year)" => Proc.new { |year|
|
42
|
+
date = Date.civil(year,6,19)
|
43
|
+
if date.wday > 5 #if 19.6 is saturday
|
44
|
+
date += 6
|
45
|
+
else
|
46
|
+
date += (5 - date.wday)
|
57
47
|
end
|
48
|
+
date
|
49
|
+
},
|
58
50
|
|
51
|
+
"fi_juhannuspaiva(year)" => Proc.new { |year|
|
52
|
+
date = Date.civil(year,6,20)
|
53
|
+
date += (6 - date.wday)
|
54
|
+
date
|
55
|
+
},
|
59
56
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
57
|
+
"fi_pyhainpaiva(year)" => Proc.new { |year|
|
58
|
+
date = Date.civil(year,10,31)
|
59
|
+
date += (6 - date.wday)
|
60
|
+
date
|
61
|
+
},
|
67
62
|
|
68
63
|
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
69
67
|
end
|
70
|
-
|
71
|
-
Holidays.merge_defs(Holidays::FI.defined_regions, Holidays::FI.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/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 FR # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[: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], :type => :informal, :name => "Pâques", :regions => [:fr]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Lundi de Pâques", :regions => [:fr]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Ascension", :regions => [:fr]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :type => :informal, :name => "Pentecôte", :regions => [:fr]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
26
26
|
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
|
27
27
|
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
28
28
|
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
@@ -33,9 +33,11 @@ module Holidays
|
|
33
33
|
12 => [{:mday => 25, :name => "Noël", :regions => [:fr]}]
|
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::FR.defined_regions, Holidays::FR.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/gb'
|
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 GB # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom]
|
@@ -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
|
-
1 => [{:mday => 1, :observed =>
|
25
|
-
{:mday => 2, :observed =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:gb]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:gb]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
24
|
+
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:gb]},
|
25
|
+
{:mday => 2, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "2nd January", :regions => [:gb_sct]}],
|
26
26
|
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
27
27
|
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}],
|
28
28
|
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
|
@@ -33,14 +33,16 @@ module Holidays
|
|
33
33
|
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
34
34
|
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
35
35
|
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
|
36
|
-
{:mday => 30, :observed =>
|
37
|
-
12 => [{:mday => 25, :observed =>
|
38
|
-
{:mday => 26, :observed =>
|
36
|
+
{:mday => 30, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :type => :informal, :name => "St. Andrew's Day", :regions => [:gb_sct]}],
|
37
|
+
12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:gb]},
|
38
|
+
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:gb]}]
|
39
39
|
}
|
40
40
|
end
|
41
|
-
end
|
42
|
-
|
43
41
|
|
42
|
+
def self.custom_methods
|
43
|
+
{
|
44
|
+
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
44
48
|
end
|
45
|
-
|
46
|
-
Holidays.merge_defs(Holidays::GB.defined_regions, Holidays::GB.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/hr'
|
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 HR # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:hr]
|
@@ -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], :name => "Uskrs", :regions => [:hr]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Uskrsni ponedjeljak", :regions => [:hr]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Tijelovo", :regions => [:hr]}],
|
24
24
|
1 => [{:mday => 1, :name => "Nova godina", :regions => [:hr]},
|
25
25
|
{:mday => 6, :name => "Sveta tri kralja", :regions => [:hr]}],
|
26
26
|
5 => [{:mday => 1, :name => "Međunarodni praznik rada", :regions => [:hr]}],
|
@@ -34,9 +34,11 @@ module Holidays
|
|
34
34
|
{:mday => 26, :name => "Sveti Stjepan", :regions => [:hr]}]
|
35
35
|
}
|
36
36
|
end
|
37
|
-
end
|
38
|
-
|
39
37
|
|
38
|
+
def self.custom_methods
|
39
|
+
{
|
40
|
+
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
40
44
|
end
|
41
|
-
|
42
|
-
Holidays.merge_defs(Holidays::HR.defined_regions, Holidays::HR.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/hu'
|
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 HU # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:hu]
|
@@ -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 => 1, :name => "Húsvét hétfő", :regions => [:hu]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Pünkösd hétfő", :regions => [:hu]}],
|
23
23
|
1 => [{:mday => 1, :name => "Újév", :regions => [:hu]}],
|
24
24
|
3 => [{:mday => 15, :name => "1848/49-es forradalom és szabadságharc ünnepe", :regions => [:hu]}],
|
25
25
|
5 => [{:mday => 1, :name => "A munka ünnepe", :regions => [:hu]}],
|
@@ -30,9 +30,11 @@ module Holidays
|
|
30
30
|
{:mday => 26, :name => "Karácsony", :regions => [:hu]}]
|
31
31
|
}
|
32
32
|
end
|
33
|
-
end
|
34
|
-
|
35
33
|
|
34
|
+
def self.custom_methods
|
35
|
+
{
|
36
|
+
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
36
40
|
end
|
37
|
-
|
38
|
-
Holidays.merge_defs(Holidays::HU.defined_regions, Holidays::HU.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/ie'
|
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 IE # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:ie]
|
@@ -18,30 +18,30 @@ module Holidays
|
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
|
-
0 => [{:function =>
|
22
|
-
1 => [{:mday => 1, :observed =>
|
23
|
-
3 => [{:mday => 17, :observed =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:ie]}],
|
22
|
+
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:ie]}],
|
23
|
+
3 => [{:mday => 17, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "St. Patrick's Day", :regions => [:ie]}],
|
24
24
|
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
25
25
|
6 => [{:wday => 1, :week => 1, :name => "June Bank Holiday", :regions => [:ie]}],
|
26
26
|
8 => [{:wday => 1, :week => 1, :name => "August Bank Holiday", :regions => [:ie]}],
|
27
27
|
10 => [{:wday => 1, :week => -1, :name => "October Bank Holiday", :regions => [:ie]}],
|
28
|
-
12 => [{:mday => 25, :observed =>
|
29
|
-
{:mday => 26, :observed =>
|
28
|
+
12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ie]},
|
29
|
+
{:mday => 26, :observed => "ie_st_stephens_day(date)", :observed_arguments => [:date], :name => "St. Stephen's Day", :regions => [:ie]}]
|
30
30
|
}
|
31
31
|
end
|
32
|
-
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
def self.custom_methods
|
34
|
+
{
|
35
|
+
"ie_st_stephens_day(date)" => Proc.new { |date|
|
36
|
+
case date.wday
|
37
|
+
when 6, 0 then date + 2
|
38
|
+
when 1 then date + 1
|
39
|
+
else date
|
41
40
|
end
|
41
|
+
},
|
42
42
|
|
43
43
|
|
44
|
-
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
45
47
|
end
|
46
|
-
|
47
|
-
Holidays.merge_defs(Holidays::IE.defined_regions, Holidays::IE.holidays_by_month)
|
@@ -10,7 +10,7 @@ module Holidays
|
|
10
10
|
# require 'holidays'
|
11
11
|
# require 'generated_definitions/is'
|
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 IS # :nodoc:
|
15
15
|
def self.defined_regions
|
16
16
|
[:is]
|
@@ -18,22 +18,22 @@ 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 =>
|
31
|
-
{:function =>
|
21
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -48, :name => "Bolludagur", :regions => [:is]},
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Sprengidagur", :regions => [:is]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -46, :name => "Öskudagur", :regions => [:is]},
|
24
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -7, :name => "Pálmasunnudagur", :regions => [:is]},
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -3, :name => "Skírdagur", :regions => [:is]},
|
26
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Föstudaginn langi", :regions => [:is]},
|
27
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Páskadagur", :regions => [:is]},
|
28
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Annar í páskum", :regions => [:is]},
|
29
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Uppstigningardagur", :regions => [:is]},
|
30
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Hvítasunnudagur", :regions => [:is]},
|
31
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Annar í hvítasunnu", :regions => [:is]}],
|
32
32
|
1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
33
33
|
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
34
34
|
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
|
35
35
|
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
36
|
-
4 => [{:function =>
|
36
|
+
4 => [{:function => "is_sumardagurinn_fyrsti(year)", :function_arguments => [:year], :name => "Sumardagurinn fyrsti", :regions => [:is]}],
|
37
37
|
5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
38
38
|
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
|
39
39
|
6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
@@ -46,21 +46,21 @@ module Holidays
|
|
46
46
|
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}]
|
47
47
|
}
|
48
48
|
end
|
49
|
-
end
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
date
|
50
|
+
def self.custom_methods
|
51
|
+
{
|
52
|
+
"is_sumardagurinn_fyrsti(year)" => Proc.new { |year|
|
53
|
+
date = Date.civil(year,4,18)
|
54
|
+
if date.wday < 4
|
55
|
+
date += (4 - date.wday)
|
56
|
+
else date
|
57
|
+
date += (11 - date.wday)
|
60
58
|
end
|
59
|
+
date
|
60
|
+
},
|
61
61
|
|
62
62
|
|
63
|
-
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
64
66
|
end
|
65
|
-
|
66
|
-
Holidays.merge_defs(Holidays::IS.defined_regions, Holidays::IS.holidays_by_month)
|