holidays 7.1.0 → 8.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 +6 -1
- data/README.md +3 -4
- data/doc/CONTRIBUTING.md +2 -1
- data/holidays.gemspec +5 -5
- data/lib/generated_definitions/MANIFEST +1 -0
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/au.rb +1 -1
- data/lib/generated_definitions/ca.rb +11 -10
- data/lib/generated_definitions/cl.rb +5 -5
- data/lib/generated_definitions/de.rb +3 -3
- data/lib/generated_definitions/es.rb +2 -1
- data/lib/generated_definitions/europe.rb +60 -16
- data/lib/generated_definitions/gb.rb +5 -3
- data/lib/generated_definitions/hu.rb +3 -2
- data/lib/generated_definitions/it.rb +14 -5
- data/lib/generated_definitions/jp.rb +21 -21
- data/lib/generated_definitions/lv.rb +52 -0
- data/lib/generated_definitions/northamerica.rb +15 -15
- data/lib/generated_definitions/ro.rb +5 -2
- data/lib/generated_definitions/southamerica.rb +5 -5
- data/lib/generated_definitions/tr.rb +1 -1
- data/lib/generated_definitions/ua.rb +6 -6
- data/lib/generated_definitions/us.rb +5 -6
- data/lib/holidays.rb +2 -0
- data/lib/holidays/definition/context/generator.rb +20 -34
- data/lib/holidays/definition/repository/holidays_by_month.rb +9 -1
- data/lib/holidays/finder/context/search.rb +34 -31
- data/lib/holidays/finder/rules/year_range.rb +30 -54
- data/lib/holidays/version.rb +1 -1
- data/test/coverage_report.rb +23 -5
- data/test/data/test_custom_year_range_holiday_defs.yaml +6 -10
- data/test/data/test_multiple_regions_with_conflicts_region_1.yaml +38 -0
- data/test/data/test_multiple_regions_with_conflicts_region_2.yaml +38 -0
- data/test/defs/test_defs_ca.rb +13 -1
- data/test/defs/test_defs_co.rb +3 -3
- data/test/defs/test_defs_europe.rb +126 -5
- data/test/defs/test_defs_hu.rb +12 -4
- data/test/defs/test_defs_it.rb +20 -0
- data/test/defs/test_defs_lv.rb +90 -0
- data/test/defs/test_defs_northamerica.rb +19 -11
- data/test/defs/test_defs_ro.rb +14 -0
- data/test/defs/test_defs_southamerica.rb +3 -3
- data/test/defs/test_defs_us.rb +6 -10
- data/test/holidays/core_extensions/test_date.rb +3 -2
- data/test/holidays/definition/context/test_generator.rb +5 -18
- data/test/holidays/definition/repository/test_holidays_by_month.rb +121 -1
- data/test/holidays/finder/rules/test_year_range.rb +43 -47
- data/test/integration/test_available_regions.rb +1 -1
- data/test/integration/test_custom_year_range_holidays.rb +0 -7
- data/test/integration/test_holidays.rb +1 -1
- data/test/integration/test_holidays_between.rb +10 -0
- data/test/integration/test_multiple_regions_with_conflict.rb +29 -0
- metadata +21 -13
@@ -41,7 +41,15 @@ module Holidays
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def definition_exists?(existing_def, target_def)
|
44
|
-
existing_def[:name] == target_def[:name] &&
|
44
|
+
existing_def[:name] == target_def[:name] &&
|
45
|
+
existing_def[:wday] == target_def[:wday] &&
|
46
|
+
existing_def[:mday] == target_def[:mday] &&
|
47
|
+
existing_def[:week] == target_def[:week] &&
|
48
|
+
existing_def[:function] == target_def[:function] &&
|
49
|
+
existing_def[:function_modifier] == target_def[:function_modifier] &&
|
50
|
+
existing_def[:type] == target_def[:type] &&
|
51
|
+
existing_def[:observed] == target_def[:observed] &&
|
52
|
+
existing_def[:year_ranges] == target_def[:year_ranges]
|
45
53
|
end
|
46
54
|
end
|
47
55
|
end
|
@@ -24,39 +24,11 @@ module Holidays
|
|
24
24
|
next unless @rules[:year_range].call(year, h[:year_ranges])
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
if h[:function]
|
31
|
-
result = @custom_method_processor.call(
|
32
|
-
build_custom_method_input(year, current_month, current_day, h[:regions]),
|
33
|
-
h[:function], h[:function_arguments], h[:function_modifier],
|
34
|
-
)
|
35
|
-
|
36
|
-
#FIXME The result should always be present, see https://github.com/holidays/holidays/issues/204 for more information
|
37
|
-
if result
|
38
|
-
current_month = result.month
|
39
|
-
current_day = result.mday
|
40
|
-
else
|
41
|
-
current_month = nil
|
42
|
-
current_day = nil
|
43
|
-
end
|
44
|
-
else
|
45
|
-
current_day = h[:mday] || @day_of_month_calculator.call(year, current_month, h[:week], h[:wday])
|
46
|
-
end
|
47
|
-
|
48
|
-
# Silently skip bad mdays
|
49
|
-
#TODO Should we be doing something different here? We have no concept of logging right now. Maybe we should add it?
|
50
|
-
begin
|
51
|
-
date = Date.civil(year, current_month, current_day)
|
52
|
-
rescue; next; end
|
27
|
+
date = build_date(year, month, h)
|
28
|
+
next unless date
|
53
29
|
|
54
30
|
if observed_set?(options) && h[:observed]
|
55
|
-
date =
|
56
|
-
build_custom_method_input(date.year, date.month, date.day, regions),
|
57
|
-
h[:observed],
|
58
|
-
[:date],
|
59
|
-
)
|
31
|
+
date = build_observed_date(date, regions, h)
|
60
32
|
end
|
61
33
|
|
62
34
|
holidays << {:date => date, :name => h[:name], :regions => h[:regions]}
|
@@ -93,6 +65,29 @@ module Holidays
|
|
93
65
|
options && options.include?(:observed) == true
|
94
66
|
end
|
95
67
|
|
68
|
+
def build_date(year, month, h)
|
69
|
+
if h[:function]
|
70
|
+
holiday = custom_holiday(year, month, h)
|
71
|
+
#FIXME The result should always be present, see https://github.com/holidays/holidays/issues/204 for more information
|
72
|
+
current_month = holiday&.month
|
73
|
+
current_day = holiday&.mday
|
74
|
+
else
|
75
|
+
current_month = month
|
76
|
+
current_day = h[:mday] || @day_of_month_calculator.call(year, month, h[:week], h[:wday])
|
77
|
+
end
|
78
|
+
|
79
|
+
# Silently skip bad mdays
|
80
|
+
#TODO Should we be doing something different here? We have no concept of logging right now. Maybe we should add it?
|
81
|
+
Date.civil(year, current_month, current_day) rescue nil
|
82
|
+
end
|
83
|
+
|
84
|
+
def custom_holiday(year, month, h)
|
85
|
+
@custom_method_processor.call(
|
86
|
+
build_custom_method_input(year, month, h[:mday], h[:regions]),
|
87
|
+
h[:function], h[:function_arguments], h[:function_modifier],
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
96
91
|
def build_custom_method_input(year, month, day, regions)
|
97
92
|
{
|
98
93
|
year: year,
|
@@ -101,6 +96,14 @@ module Holidays
|
|
101
96
|
region: regions.first, #FIXME This isn't ideal but will work for our current use case...
|
102
97
|
}
|
103
98
|
end
|
99
|
+
|
100
|
+
def build_observed_date(date, regions, h)
|
101
|
+
@custom_method_processor.call(
|
102
|
+
build_custom_method_input(date.year, date.month, date.day, regions),
|
103
|
+
h[:observed],
|
104
|
+
[:date],
|
105
|
+
)
|
106
|
+
end
|
104
107
|
end
|
105
108
|
end
|
106
109
|
end
|
@@ -1,49 +1,30 @@
|
|
1
|
-
# Please note that only one condition needs to match in order for `call` to return `true.
|
2
|
-
# See the test file for this class for specific examples.
|
3
1
|
module Holidays
|
4
2
|
module Finder
|
5
3
|
module Rules
|
6
4
|
class YearRange
|
7
5
|
class << self
|
8
|
-
|
9
|
-
|
6
|
+
UNTIL = :until
|
7
|
+
FROM = :from
|
10
8
|
LIMITED = :limited
|
11
9
|
BETWEEN = :between
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
case operator
|
32
|
-
when BEFORE, BEFORE.to_s
|
33
|
-
matched = target_year <= year_range
|
34
|
-
when AFTER, AFTER.to_s
|
35
|
-
matched = target_year >= year_range
|
36
|
-
when LIMITED, LIMITED.to_s
|
37
|
-
if year_range.is_a?(Array)
|
38
|
-
matched = year_range.include?(target_year)
|
39
|
-
else
|
40
|
-
matched = year_range == target_year
|
41
|
-
end
|
42
|
-
when BETWEEN, BETWEEN.to_s
|
43
|
-
matched = year_range.cover?(target_year)
|
44
|
-
end
|
45
|
-
|
46
|
-
break if matched == true
|
11
|
+
def call(target_year, year_range_defs)
|
12
|
+
validate!(target_year, year_range_defs)
|
13
|
+
|
14
|
+
operator = year_range_defs.keys.first
|
15
|
+
rule_value = year_range_defs[operator]
|
16
|
+
|
17
|
+
case operator
|
18
|
+
when UNTIL
|
19
|
+
matched = target_year <= rule_value
|
20
|
+
when FROM
|
21
|
+
matched = target_year >= rule_value
|
22
|
+
when LIMITED
|
23
|
+
matched = rule_value.include?(target_year)
|
24
|
+
when BETWEEN
|
25
|
+
matched = rule_value.cover?(target_year)
|
26
|
+
else
|
27
|
+
matched = false
|
47
28
|
end
|
48
29
|
|
49
30
|
matched
|
@@ -54,25 +35,20 @@ module Holidays
|
|
54
35
|
def validate!(target_year, year_ranges)
|
55
36
|
raise ArgumentError.new("target_year must be a number") unless target_year.is_a?(Integer)
|
56
37
|
raise ArgumentError.new("year_ranges cannot be missing") if year_ranges.nil? || year_ranges.empty?
|
38
|
+
raise ArgumentError.new("year_ranges must contain a hash with a single operator") unless year_ranges.is_a?(Hash) && year_ranges.size == 1
|
57
39
|
|
58
|
-
year_ranges.
|
59
|
-
|
60
|
-
raise ArgumentError.new("year_ranges cannot include empty hashes") if range.empty?
|
61
|
-
raise ArgumentError.new("year_ranges entries can only include one operator") unless range.count == 1
|
62
|
-
|
63
|
-
operator = range.keys.first
|
64
|
-
range = range.values.first
|
40
|
+
operator = year_ranges.keys.first
|
41
|
+
value = year_ranges[operator]
|
65
42
|
|
66
|
-
|
43
|
+
raise ArgumentError.new("Invalid operator found: '#{operator}'") unless [UNTIL, FROM, LIMITED, BETWEEN].include?(operator)
|
67
44
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
45
|
+
case operator
|
46
|
+
when UNTIL, FROM
|
47
|
+
raise ArgumentError.new("#{UNTIL} and #{FROM} operator value must be a number, received: '#{value}'") unless value.is_a?(Integer)
|
48
|
+
when LIMITED
|
49
|
+
raise ArgumentError.new(":limited operator value must be an array containing at least one integer value, received: '#{value}'") unless value.is_a?(Array) && value.size >= 1 && value.all? { |v| v.is_a?(Integer) }
|
50
|
+
when BETWEEN
|
51
|
+
raise ArgumentError.new(":between operator value must be a range, received: '#{value}'") unless value.is_a?(Range)
|
76
52
|
end
|
77
53
|
end
|
78
54
|
end
|
data/lib/holidays/version.rb
CHANGED
data/test/coverage_report.rb
CHANGED
@@ -1,8 +1,26 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
|
3
|
-
|
3
|
+
# For reasons I don't understand jruby implementations report lower coverage
|
4
|
+
# than other ruby versions. Ruby 2.5.3, for instance, is at 92%.
|
5
|
+
#
|
6
|
+
# We set the floor based on jruby so that all automated tests pass on Travis CI.
|
7
|
+
SimpleCov.minimum_coverage 89
|
8
|
+
|
9
|
+
SimpleCov.add_filter [
|
10
|
+
# Apparently simplecov doesn't automatically filter 'spec' or 'test' so we
|
11
|
+
# have to do it manually.
|
12
|
+
'test',
|
13
|
+
|
14
|
+
# Only filtered because I tend to not see value in testing factories.
|
15
|
+
'lib/holidays/factory/',
|
16
|
+
|
17
|
+
# jruby coverage flips out here and doesn't count much of the large date
|
18
|
+
# arrays used by this class. This results in an extremely low reported
|
19
|
+
# coverage for this specific file but only in jruby, not other ruby versions.
|
20
|
+
# Since it obliterates coverage percentages I'll filter it until I can come
|
21
|
+
# up with a solution.
|
22
|
+
'lib/holidays/date_calculator/lunar_date.rb',
|
23
|
+
]
|
24
|
+
|
4
25
|
SimpleCov.coverage_dir 'reports/coverage'
|
5
|
-
SimpleCov.start
|
6
|
-
add_filter 'lib/generated_definitions/'
|
7
|
-
add_filter 'lib/holidays/factory/'
|
8
|
-
end
|
26
|
+
SimpleCov.start
|
@@ -4,28 +4,24 @@ months:
|
|
4
4
|
regions: [custom_year_range_file]
|
5
5
|
mday: 1
|
6
6
|
year_ranges:
|
7
|
-
|
7
|
+
from: 2016
|
8
8
|
- name: before_year
|
9
9
|
regions: [custom_year_range_file]
|
10
10
|
mday: 2
|
11
11
|
year_ranges:
|
12
|
-
|
12
|
+
until: 2017
|
13
13
|
- name: between_year
|
14
14
|
regions: [custom_year_range_file]
|
15
15
|
mday: 3
|
16
16
|
year_ranges:
|
17
|
-
|
17
|
+
between:
|
18
|
+
start: 2016
|
19
|
+
end: 2018
|
18
20
|
- name: limited_year
|
19
21
|
regions: [custom_year_range_file]
|
20
22
|
mday: 4
|
21
23
|
year_ranges:
|
22
|
-
|
23
|
-
- name: multiple_conditions
|
24
|
-
regions: [custom_year_range_file]
|
25
|
-
mday: 5
|
26
|
-
year_ranges:
|
27
|
-
- before: 2015
|
28
|
-
- after: 2017
|
24
|
+
limited: [2016,2018,2019]
|
29
25
|
|
30
26
|
tests:
|
31
27
|
- given:
|
@@ -0,0 +1,38 @@
|
|
1
|
+
months:
|
2
|
+
0:
|
3
|
+
- name: With Function Modifier
|
4
|
+
regions: [multiple_with_conflict_1]
|
5
|
+
function: easter(year)
|
6
|
+
function_modifier: 60
|
7
|
+
- name: With Function Only Different Function Name
|
8
|
+
regions: [multiple_with_conflict_1]
|
9
|
+
function: conflict_custom_method_1(year)
|
10
|
+
- name: With Function Only Same Function Name
|
11
|
+
regions: [multiple_with_conflict_1]
|
12
|
+
function: conflict_custom_method_identical_name_between_regions(year)
|
13
|
+
- name: With Function Only Same Function Name - Region 1
|
14
|
+
regions: [multiple_with_conflict_1]
|
15
|
+
function: conflict_custom_method_identical_name_between_regions_but_different_holiday_names(year)
|
16
|
+
1:
|
17
|
+
- name: New Year's Day
|
18
|
+
regions: [multiple_with_conflict_1]
|
19
|
+
mday: 1
|
20
|
+
observed: to_monday_if_weekend(date)
|
21
|
+
10:
|
22
|
+
- name: Testing Conflict Month 10
|
23
|
+
regions: [multiple_with_conflict_1]
|
24
|
+
mday: 5
|
25
|
+
|
26
|
+
methods:
|
27
|
+
conflict_custom_method_1:
|
28
|
+
arguments: year
|
29
|
+
ruby: |
|
30
|
+
Date.civil(year, 8, 1)
|
31
|
+
conflict_custom_method_identical_name_between_regions:
|
32
|
+
arguments: year
|
33
|
+
ruby: |
|
34
|
+
Date.civil(year, 9, 1)
|
35
|
+
conflict_custom_method_identical_name_between_regions_but_different_holiday_names:
|
36
|
+
arguments: year
|
37
|
+
ruby: |
|
38
|
+
Date.civil(year, 9, 15)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
months:
|
2
|
+
0:
|
3
|
+
- name: With Function Modifier
|
4
|
+
regions: [multiple_with_conflict_2]
|
5
|
+
function: easter(year)
|
6
|
+
function_modifier: 64
|
7
|
+
- name: With Function Only Different Function Name
|
8
|
+
regions: [multiple_with_conflict_2]
|
9
|
+
function: conflict_custom_method_2(year)
|
10
|
+
- name: With Function Only Same Function Name
|
11
|
+
regions: [multiple_with_conflict_2]
|
12
|
+
function: conflict_custom_method_identical_name_between_regions(year)
|
13
|
+
- name: With Function Only Same Function Name - Region 2
|
14
|
+
regions: [multiple_with_conflict_2]
|
15
|
+
function: conflict_custom_method_identical_name_between_regions_but_different_holiday_names(year)
|
16
|
+
1:
|
17
|
+
- name: New Year's Day
|
18
|
+
regions: [multiple_with_conflict_2]
|
19
|
+
mday: 1
|
20
|
+
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
|
21
|
+
10:
|
22
|
+
- name: Testing Conflict Month 10
|
23
|
+
regions: [multiple_with_conflict_2]
|
24
|
+
mday: 7
|
25
|
+
|
26
|
+
methods:
|
27
|
+
conflict_custom_method_2:
|
28
|
+
arguments: year
|
29
|
+
ruby: |
|
30
|
+
Date.civil(year, 12, 1)
|
31
|
+
conflict_custom_method_identical_name_between_regions:
|
32
|
+
arguments: year
|
33
|
+
ruby: |
|
34
|
+
Date.civil(year, 11, 1)
|
35
|
+
conflict_custom_method_identical_name_between_regions_but_different_holiday_names:
|
36
|
+
arguments: year
|
37
|
+
ruby: |
|
38
|
+
Date.civil(year, 11, 15)
|
data/test/defs/test_defs_ca.rb
CHANGED
@@ -201,12 +201,24 @@ assert_equal "Remembrance Day", (Holidays.on(Date.civil(2017, 11, 13), [:ca_ab,
|
|
201
201
|
|
202
202
|
assert_equal "Canada Day", (Holidays.on(Date.civil(2017, 7, 3), [:ca], [:observed])[0] || {})[:name]
|
203
203
|
|
204
|
-
assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12,
|
204
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 25), [:ca])[0] || {})[:name]
|
205
|
+
|
206
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2018, 12, 25), [:ca])[0] || {})[:name]
|
207
|
+
|
208
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2022, 12, 25), [:ca])[0] || {})[:name]
|
209
|
+
|
210
|
+
assert_nil (Holidays.on(Date.civil(2022, 12, 25), [:ca], [:observed])[0] || {})[:name]
|
211
|
+
|
212
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 24), [:ca], [:observed])[0] || {})[:name]
|
205
213
|
|
206
214
|
assert_equal "Christmas Day", (Holidays.on(Date.civil(2012, 12, 25), [:ca], [:observed])[0] || {})[:name]
|
207
215
|
|
208
216
|
assert_equal "Christmas Day", (Holidays.on(Date.civil(2016, 12, 26), [:ca], [:observed])[0] || {})[:name]
|
209
217
|
|
218
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 24), [:ca], [:observed])[0] || {})[:name]
|
219
|
+
|
220
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2022, 12, 26), [:ca], [:observed])[0] || {})[:name]
|
221
|
+
|
210
222
|
assert_equal "Boxing Day", (Holidays.on(Date.civil(2010, 12, 28), [:ca_on], [:observed])[0] || {})[:name]
|
211
223
|
assert_equal "Boxing Day", (Holidays.on(Date.civil(2012, 12, 26), [:ca_on], [:observed])[0] || {})[:name]
|
212
224
|
assert_equal "Boxing Day", (Holidays.on(Date.civil(2015, 12, 28), [:ca_on], [:observed])[0] || {})[:name]
|
data/test/defs/test_defs_co.rb
CHANGED
@@ -45,11 +45,11 @@ class CoDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
45
45
|
|
46
46
|
assert_equal "Día de la Ascensión", (Holidays.on(Date.civil(2017, 5, 29), [:co])[0] || {})[:name]
|
47
47
|
|
48
|
-
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2014, 6,
|
48
|
+
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2014, 6, 23), [:co])[0] || {})[:name]
|
49
49
|
|
50
|
-
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2016, 5,
|
50
|
+
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2016, 5, 30), [:co])[0] || {})[:name]
|
51
51
|
|
52
|
-
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2017, 6,
|
52
|
+
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2017, 6, 19), [:co])[0] || {})[:name]
|
53
53
|
|
54
54
|
assert_equal "Sagrado Corazón", (Holidays.on(Date.civil(2014, 6, 30), [:co])[0] || {})[:name]
|
55
55
|
|
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
3
3
|
|
4
4
|
# This file is generated by the Ruby Holiday gem.
|
5
5
|
#
|
6
|
-
# Definitions loaded: definitions/at.yaml, definitions/be_fr.yaml, definitions/be_nl.yaml, definitions/ch.yaml, definitions/cz.yaml, definitions/dk.yaml, definitions/de.yaml, definitions/el.yaml, definitions/es.yaml, definitions/fr.yaml, definitions/gb.yaml, definitions/hr.yaml, definitions/hu.yaml, definitions/ie.yaml, definitions/is.yaml, definitions/it.yaml, definitions/li.yaml, definitions/lt.yaml, definitions/nl.yaml, definitions/no.yaml, definitions/pl.yaml, definitions/pt.yaml, definitions/ro.yaml, definitions/sk.yaml, definitions/si.yaml, definitions/bg.yaml, definitions/ua.yaml
|
6
|
+
# Definitions loaded: definitions/at.yaml, definitions/be_fr.yaml, definitions/be_nl.yaml, definitions/ch.yaml, definitions/cz.yaml, definitions/dk.yaml, definitions/de.yaml, definitions/el.yaml, definitions/es.yaml, definitions/fr.yaml, definitions/gb.yaml, definitions/hr.yaml, definitions/hu.yaml, definitions/ie.yaml, definitions/is.yaml, definitions/it.yaml, definitions/li.yaml, definitions/lt.yaml, definitions/lv.yaml, definitions/nl.yaml, definitions/no.yaml, definitions/pl.yaml, definitions/pt.yaml, definitions/ro.yaml, definitions/sk.yaml, definitions/si.yaml, definitions/bg.yaml, definitions/ua.yaml
|
7
7
|
class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_europe
|
@@ -593,15 +593,15 @@ class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
593
593
|
|
594
594
|
assert_equal "1848/49-es forradalom és szabadságharc ünnepe", (Holidays.on(Date.civil(2012, 3, 15), [:hu], [:informal])[0] || {})[:name]
|
595
595
|
|
596
|
-
assert_equal "
|
596
|
+
assert_equal "Húsvéthétfő", (Holidays.on(Date.civil(2011, 4, 25), [:hu], [:informal])[0] || {})[:name]
|
597
597
|
|
598
|
-
assert_equal "
|
598
|
+
assert_equal "Húsvéthétfő", (Holidays.on(Date.civil(2012, 4, 9), [:hu], [:informal])[0] || {})[:name]
|
599
599
|
|
600
600
|
assert_equal "A munka ünnepe", (Holidays.on(Date.civil(2012, 5, 1), [:hu], [:informal])[0] || {})[:name]
|
601
601
|
|
602
|
-
assert_equal "
|
602
|
+
assert_equal "Pünkösdhétfő", (Holidays.on(Date.civil(2011, 6, 13), [:hu], [:informal])[0] || {})[:name]
|
603
603
|
|
604
|
-
assert_equal "
|
604
|
+
assert_equal "Pünkösdhétfő", (Holidays.on(Date.civil(2012, 5, 28), [:hu], [:informal])[0] || {})[:name]
|
605
605
|
|
606
606
|
assert_equal "Az államalapítás ünnepe", (Holidays.on(Date.civil(2012, 8, 20), [:hu], [:informal])[0] || {})[:name]
|
607
607
|
|
@@ -615,6 +615,14 @@ class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
615
615
|
|
616
616
|
assert_nil (Holidays.on(Date.civil(2012, 3, 14), [:hu])[0] || {})[:name]
|
617
617
|
|
618
|
+
assert_equal "Húsvéthétfő", (Holidays.on(Date.civil(2016, 3, 28), [:hu])[0] || {})[:name]
|
619
|
+
|
620
|
+
assert_nil (Holidays.on(Date.civil(2016, 3, 25), [:hu])[0] || {})[:name]
|
621
|
+
|
622
|
+
assert_equal "Húsvéthétfő", (Holidays.on(Date.civil(2017, 4, 17), [:hu])[0] || {})[:name]
|
623
|
+
|
624
|
+
assert_equal "Nagypéntek", (Holidays.on(Date.civil(2017, 4, 14), [:hu])[0] || {})[:name]
|
625
|
+
|
618
626
|
assert_equal "New Year's Day", (Holidays.on(Date.civil(2008, 1, 1), [:ie])[0] || {})[:name]
|
619
627
|
|
620
628
|
assert_equal "St. Patrick's Day", (Holidays.on(Date.civil(2008, 3, 17), [:ie])[0] || {})[:name]
|
@@ -707,14 +715,34 @@ class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
707
715
|
|
708
716
|
assert_equal "Festa della Liberazione", (Holidays.on(Date.civil(2007, 4, 25), [:it], [:informal])[0] || {})[:name]
|
709
717
|
|
718
|
+
assert_equal "Festa di San Liberale", (Holidays.on(Date.civil(2019, 4, 27), [:it_tv], [:informal])[0] || {})[:name]
|
719
|
+
|
710
720
|
assert_equal "Festa dei Lavoratori", (Holidays.on(Date.civil(2007, 5, 1), [:it], [:informal])[0] || {})[:name]
|
711
721
|
|
722
|
+
assert_equal "Festa di San Zeno", (Holidays.on(Date.civil(2019, 5, 21), [:it_vr], [:informal])[0] || {})[:name]
|
723
|
+
|
712
724
|
assert_equal "Festa della Repubblica", (Holidays.on(Date.civil(2007, 6, 2), [:it], [:informal])[0] || {})[:name]
|
713
725
|
|
726
|
+
assert_equal "Festa di Sant'Antonio di Padova", (Holidays.on(Date.civil(2019, 6, 13), [:it_pd], [:informal])[0] || {})[:name]
|
727
|
+
|
728
|
+
assert_equal "Festa di San Giovanni Battista", (Holidays.on(Date.civil(2019, 6, 24), [:it_fi, :it_ge, :it_to], [:informal])[0] || {})[:name]
|
729
|
+
|
730
|
+
assert_nil (Holidays.on(Date.civil(2019, 6, 24), [:it])[0] || {})[:name]
|
731
|
+
|
732
|
+
assert_equal "Festa di San Pietro e Paolo", (Holidays.on(Date.civil(2019, 6, 29), [:it_rm], [:informal])[0] || {})[:name]
|
733
|
+
|
734
|
+
assert_nil (Holidays.on(Date.civil(2019, 6, 29), [:it])[0] || {})[:name]
|
735
|
+
|
714
736
|
assert_equal "Assunzione", (Holidays.on(Date.civil(2007, 8, 15), [:it], [:informal])[0] || {})[:name]
|
715
737
|
|
738
|
+
assert_equal "Festa della Madonna di Monte Berico", (Holidays.on(Date.civil(2019, 9, 8), [:it_vi], [:informal])[0] || {})[:name]
|
739
|
+
|
716
740
|
assert_equal "Ognissanti", (Holidays.on(Date.civil(2007, 11, 1), [:it], [:informal])[0] || {})[:name]
|
717
741
|
|
742
|
+
assert_equal "Festa di San Martino", (Holidays.on(Date.civil(2019, 11, 11), [:it_bl], [:informal])[0] || {})[:name]
|
743
|
+
|
744
|
+
assert_equal "Festa di San Bellino", (Holidays.on(Date.civil(2019, 11, 26), [:it_ro], [:informal])[0] || {})[:name]
|
745
|
+
|
718
746
|
assert_equal "Immacolata Concezione", (Holidays.on(Date.civil(2007, 12, 8), [:it], [:informal])[0] || {})[:name]
|
719
747
|
|
720
748
|
assert_equal "Natale", (Holidays.on(Date.civil(2007, 12, 25), [:it], [:informal])[0] || {})[:name]
|
@@ -797,6 +825,85 @@ class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
797
825
|
|
798
826
|
assert_equal "Antroji Kalėdų diena", (Holidays.on(Date.civil(2012, 12, 26), [:lt])[0] || {})[:name]
|
799
827
|
|
828
|
+
assert_equal "Jaungada diena", (Holidays.on(Date.civil(2018, 1, 1), [:lv])[0] || {})[:name]
|
829
|
+
assert_equal "Jaungada diena", (Holidays.on(Date.civil(2019, 1, 1), [:lv])[0] || {})[:name]
|
830
|
+
assert_equal "Jaungada diena", (Holidays.on(Date.civil(2029, 1, 1), [:lv])[0] || {})[:name]
|
831
|
+
|
832
|
+
assert_equal "Lielā Piektdiena", (Holidays.on(Date.civil(2018, 3, 30), [:lv])[0] || {})[:name]
|
833
|
+
assert_equal "Lielā Piektdiena", (Holidays.on(Date.civil(2019, 4, 19), [:lv])[0] || {})[:name]
|
834
|
+
assert_equal "Lielā Piektdiena", (Holidays.on(Date.civil(2039, 4, 8), [:lv])[0] || {})[:name]
|
835
|
+
|
836
|
+
assert_equal "Pirmās Lieldienas", (Holidays.on(Date.civil(2018, 4, 1), [:lv])[0] || {})[:name]
|
837
|
+
assert_equal "Pirmās Lieldienas", (Holidays.on(Date.civil(2019, 4, 21), [:lv])[0] || {})[:name]
|
838
|
+
assert_equal "Pirmās Lieldienas", (Holidays.on(Date.civil(2039, 4, 10), [:lv])[0] || {})[:name]
|
839
|
+
|
840
|
+
assert_equal "Otrās Lieldienas", (Holidays.on(Date.civil(2018, 4, 2), [:lv])[0] || {})[:name]
|
841
|
+
assert_equal "Otrās Lieldienas", (Holidays.on(Date.civil(2019, 4, 22), [:lv])[0] || {})[:name]
|
842
|
+
assert_equal "Otrās Lieldienas", (Holidays.on(Date.civil(2039, 4, 11), [:lv])[0] || {})[:name]
|
843
|
+
|
844
|
+
assert_equal "Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena", (Holidays.on(Date.civil(2018, 5, 1), [:lv])[0] || {})[:name]
|
845
|
+
assert_equal "Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena", (Holidays.on(Date.civil(2019, 5, 1), [:lv])[0] || {})[:name]
|
846
|
+
assert_equal "Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena", (Holidays.on(Date.civil(2029, 5, 1), [:lv])[0] || {})[:name]
|
847
|
+
|
848
|
+
assert_equal "Latvijas Republikas Neatkarības atjaunošanas diena", (Holidays.on(Date.civil(2018, 5, 4), [:lv])[0] || {})[:name]
|
849
|
+
assert_equal "Latvijas Republikas Neatkarības atjaunošanas diena", (Holidays.on(Date.civil(2019, 5, 4), [:lv])[0] || {})[:name]
|
850
|
+
assert_equal "Latvijas Republikas Neatkarības atjaunošanas diena", (Holidays.on(Date.civil(2020, 5, 4), [:lv])[0] || {})[:name]
|
851
|
+
|
852
|
+
assert_equal "Latvijas Republikas Neatkarības atjaunošanas diena", (Holidays.on(Date.civil(2019, 5, 6), [:lv], [:observed])[0] || {})[:name]
|
853
|
+
|
854
|
+
assert_equal "Latvijas Republikas Neatkarības atjaunošanas diena", (Holidays.on(Date.civil(2020, 5, 4), [:lv], [:observed])[0] || {})[:name]
|
855
|
+
|
856
|
+
assert_equal "Mātes diena", (Holidays.on(Date.civil(2019, 5, 12), [:lv])[0] || {})[:name]
|
857
|
+
assert_equal "Mātes diena", (Holidays.on(Date.civil(2020, 5, 10), [:lv])[0] || {})[:name]
|
858
|
+
assert_equal "Mātes diena", (Holidays.on(Date.civil(2029, 5, 13), [:lv])[0] || {})[:name]
|
859
|
+
|
860
|
+
assert_equal "Vasarsvētki", (Holidays.on(Date.civil(2019, 6, 9), [:lv])[0] || {})[:name]
|
861
|
+
assert_equal "Vasarsvētki", (Holidays.on(Date.civil(2020, 5, 31), [:lv])[0] || {})[:name]
|
862
|
+
assert_equal "Vasarsvētki", (Holidays.on(Date.civil(2029, 5, 20), [:lv])[0] || {})[:name]
|
863
|
+
|
864
|
+
assert_equal "Līgo diena", (Holidays.on(Date.civil(2019, 6, 23), [:lv])[0] || {})[:name]
|
865
|
+
assert_equal "Līgo diena", (Holidays.on(Date.civil(2020, 6, 23), [:lv])[0] || {})[:name]
|
866
|
+
assert_equal "Līgo diena", (Holidays.on(Date.civil(2029, 6, 23), [:lv])[0] || {})[:name]
|
867
|
+
|
868
|
+
assert_equal "Jāņu diena", (Holidays.on(Date.civil(2019, 6, 24), [:lv])[0] || {})[:name]
|
869
|
+
assert_equal "Jāņu diena", (Holidays.on(Date.civil(2020, 6, 24), [:lv])[0] || {})[:name]
|
870
|
+
assert_equal "Jāņu diena", (Holidays.on(Date.civil(2029, 6, 24), [:lv])[0] || {})[:name]
|
871
|
+
|
872
|
+
assert_equal "Vispārējo latviešu Dziesmu un deju svētku noslēguma diena", (Holidays.on(Date.civil(2018, 7, 8), [:lv])[0] || {})[:name]
|
873
|
+
|
874
|
+
assert_equal "Vispārējo latviešu Dziesmu un deju svētku noslēguma diena", (Holidays.on(Date.civil(2018, 7, 9), [:lv], [:observed])[0] || {})[:name]
|
875
|
+
|
876
|
+
assert_nil (Holidays.on(Date.civil(2019, 7, 8), [:lv])[0] || {})[:name]
|
877
|
+
assert_nil (Holidays.on(Date.civil(2019, 7, 9), [:lv])[0] || {})[:name]
|
878
|
+
|
879
|
+
assert_equal "Viņa Svētības pāvesta Franciska pastorālās vizītes Latvijā diena", (Holidays.on(Date.civil(2018, 9, 24), [:lv])[0] || {})[:name]
|
880
|
+
|
881
|
+
assert_nil (Holidays.on(Date.civil(2019, 9, 24), [:lv])[0] || {})[:name]
|
882
|
+
|
883
|
+
assert_equal "Latvijas Republikas Proklamēšanas diena", (Holidays.on(Date.civil(2019, 11, 18), [:lv])[0] || {})[:name]
|
884
|
+
assert_equal "Latvijas Republikas Proklamēšanas diena", (Holidays.on(Date.civil(2020, 11, 18), [:lv])[0] || {})[:name]
|
885
|
+
assert_equal "Latvijas Republikas Proklamēšanas diena", (Holidays.on(Date.civil(2029, 11, 18), [:lv])[0] || {})[:name]
|
886
|
+
|
887
|
+
assert_equal "Latvijas Republikas Proklamēšanas diena", (Holidays.on(Date.civil(2020, 11, 18), [:lv], [:observed])[0] || {})[:name]
|
888
|
+
|
889
|
+
assert_equal "Latvijas Republikas Proklamēšanas diena", (Holidays.on(Date.civil(2029, 11, 19), [:lv], [:observed])[0] || {})[:name]
|
890
|
+
|
891
|
+
assert_equal "Ziemassvētku vakars", (Holidays.on(Date.civil(2019, 12, 24), [:lv])[0] || {})[:name]
|
892
|
+
assert_equal "Ziemassvētku vakars", (Holidays.on(Date.civil(2020, 12, 24), [:lv])[0] || {})[:name]
|
893
|
+
assert_equal "Ziemassvētku vakars", (Holidays.on(Date.civil(2029, 12, 24), [:lv])[0] || {})[:name]
|
894
|
+
|
895
|
+
assert_equal "Pirmie Ziemassvētki", (Holidays.on(Date.civil(2019, 12, 25), [:lv])[0] || {})[:name]
|
896
|
+
assert_equal "Pirmie Ziemassvētki", (Holidays.on(Date.civil(2020, 12, 25), [:lv])[0] || {})[:name]
|
897
|
+
assert_equal "Pirmie Ziemassvētki", (Holidays.on(Date.civil(2029, 12, 25), [:lv])[0] || {})[:name]
|
898
|
+
|
899
|
+
assert_equal "Otrie Ziemassvētki", (Holidays.on(Date.civil(2019, 12, 26), [:lv])[0] || {})[:name]
|
900
|
+
assert_equal "Otrie Ziemassvētki", (Holidays.on(Date.civil(2020, 12, 26), [:lv])[0] || {})[:name]
|
901
|
+
assert_equal "Otrie Ziemassvētki", (Holidays.on(Date.civil(2029, 12, 26), [:lv])[0] || {})[:name]
|
902
|
+
|
903
|
+
assert_equal "Vecgada diena", (Holidays.on(Date.civil(2019, 12, 31), [:lv])[0] || {})[:name]
|
904
|
+
assert_equal "Vecgada diena", (Holidays.on(Date.civil(2020, 12, 31), [:lv])[0] || {})[:name]
|
905
|
+
assert_equal "Vecgada diena", (Holidays.on(Date.civil(2029, 12, 31), [:lv])[0] || {})[:name]
|
906
|
+
|
800
907
|
assert_equal "Nieuwjaarsdag", (Holidays.on(Date.civil(2008, 1, 1), [:nl], [:informal])[0] || {})[:name]
|
801
908
|
|
802
909
|
assert_equal "Goede Vrijdag", (Holidays.on(Date.civil(2008, 3, 21), [:nl], [:informal])[0] || {})[:name]
|
@@ -1103,6 +1210,12 @@ class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
1103
1210
|
|
1104
1211
|
assert_equal "Natal", (Holidays.on(Date.civil(2008, 12, 25), [:pt], [:informal])[0] || {})[:name]
|
1105
1212
|
|
1213
|
+
assert_nil (Holidays.on(Date.civil(2017, 4, 14), [:ro])[0] || {})[:name]
|
1214
|
+
|
1215
|
+
assert_equal "Paștele - Vinerea Mare", (Holidays.on(Date.civil(2018, 4, 6), [:ro], [:informal])[0] || {})[:name]
|
1216
|
+
|
1217
|
+
assert_equal "Paștele - Vinerea Mare", (Holidays.on(Date.civil(2019, 4, 26), [:ro], [:informal])[0] || {})[:name]
|
1218
|
+
|
1106
1219
|
assert_equal "Paștele - duminică", (Holidays.on(Date.civil(1961, 4, 9), [:ro], [:informal])[0] || {})[:name]
|
1107
1220
|
|
1108
1221
|
assert_equal "Paștele - luni", (Holidays.on(Date.civil(1961, 4, 10), [:ro], [:informal])[0] || {})[:name]
|
@@ -1129,8 +1242,16 @@ class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
1129
1242
|
|
1130
1243
|
assert_equal "Anul nou", (Holidays.on(Date.civil(2014, 1, 2), [:ro], [:informal])[0] || {})[:name]
|
1131
1244
|
|
1245
|
+
assert_equal "Unirea Principatelor Române", (Holidays.on(Date.civil(2017, 1, 24), [:ro], [:informal])[0] || {})[:name]
|
1246
|
+
|
1247
|
+
assert_nil (Holidays.on(Date.civil(2016, 1, 24), [:ro])[0] || {})[:name]
|
1248
|
+
|
1132
1249
|
assert_equal "Ziua muncii", (Holidays.on(Date.civil(2009, 5, 1), [:ro], [:informal])[0] || {})[:name]
|
1133
1250
|
|
1251
|
+
assert_equal "Ziua Copilului", (Holidays.on(Date.civil(2017, 6, 1), [:ro], [:informal])[0] || {})[:name]
|
1252
|
+
|
1253
|
+
assert_nil (Holidays.on(Date.civil(2016, 6, 1), [:ro])[0] || {})[:name]
|
1254
|
+
|
1134
1255
|
assert_equal "Adormirea Maicii Domnului", (Holidays.on(Date.civil(2012, 8, 15), [:ro], [:informal])[0] || {})[:name]
|
1135
1256
|
|
1136
1257
|
assert_equal "Sfântul Apostol Andrei", (Holidays.on(Date.civil(2013, 11, 30), [:ro], [:informal])[0] || {})[:name]
|