holidays 4.7.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +21 -11
- data/Makefile +9 -6
- data/holidays.gemspec +1 -1
- data/lib/generated_definitions/MANIFEST +1 -0
- data/lib/generated_definitions/REGIONS.rb +1 -1
- data/lib/generated_definitions/hk.rb +112 -0
- data/lib/generated_definitions/kr.rb +4 -4
- data/lib/holidays/errors.rb +1 -0
- data/lib/holidays/finder/context/parse_options.rb +8 -3
- data/lib/holidays/load_all_definitions.rb +0 -11
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_hk.rb +38 -0
- data/test/defs/test_defs_jp.rb +1 -0
- data/test/defs/test_defs_kr.rb +1 -1
- data/test/holidays/definition/validator/test_region.rb +4 -0
- data/test/holidays/finder/context/test_parse_options.rb +9 -1
- data/test/integration/test_all_regions.rb +4 -4
- data/test/integration/test_custom_holidays.rb +4 -4
- data/test/integration/test_holidays.rb +6 -6
- metadata +6 -60
- data/definitions/README.md +0 -353
- data/definitions/ar.yaml +0 -93
- data/definitions/at.yaml +0 -72
- data/definitions/au.yaml +0 -378
- data/definitions/be_fr.yaml +0 -69
- data/definitions/be_nl.yaml +0 -69
- data/definitions/bg.yaml +0 -127
- data/definitions/br.yaml +0 -77
- data/definitions/ca.yaml +0 -317
- data/definitions/ch.yaml +0 -193
- data/definitions/cl.yaml +0 -94
- data/definitions/cr.yaml +0 -65
- data/definitions/cz.yaml +0 -73
- data/definitions/de.yaml +0 -209
- data/definitions/dk.yaml +0 -130
- data/definitions/ecb_target.yaml +0 -44
- data/definitions/el.yaml +0 -84
- data/definitions/es.yaml +0 -203
- data/definitions/federal_reserve.yaml +0 -114
- data/definitions/fedex.yaml +0 -62
- data/definitions/fi.yaml +0 -115
- data/definitions/fr.yaml +0 -79
- data/definitions/gb.yaml +0 -151
- data/definitions/hr.yaml +0 -79
- data/definitions/hu.yaml +0 -63
- data/definitions/ie.yaml +0 -89
- data/definitions/index.yaml +0 -61
- data/definitions/is.yaml +0 -146
- data/definitions/it.yaml +0 -67
- data/definitions/jp.yaml +0 -321
- data/definitions/kr.yaml +0 -282
- data/definitions/li.yaml +0 -107
- data/definitions/lt.yaml +0 -89
- data/definitions/lu.yaml +0 -56
- data/definitions/ma.yaml +0 -52
- data/definitions/mx.yaml +0 -106
- data/definitions/my.yaml +0 -51
- data/definitions/nerc.yaml +0 -51
- data/definitions/nl.yaml +0 -73
- data/definitions/no.yaml +0 -90
- data/definitions/north_america_informal.yaml +0 -61
- data/definitions/nyse.yaml +0 -64
- data/definitions/nz.yaml +0 -163
- data/definitions/pe.yaml +0 -119
- data/definitions/ph.yaml +0 -94
- data/definitions/pl.yaml +0 -320
- data/definitions/pt.yaml +0 -89
- data/definitions/ro.yaml +0 -78
- data/definitions/se.yaml +0 -120
- data/definitions/sg.yaml +0 -56
- data/definitions/si.yaml +0 -86
- data/definitions/sk.yaml +0 -80
- data/definitions/united_nations.yaml +0 -189
- data/definitions/ups.yaml +0 -62
- data/definitions/us.yaml +0 -103
- data/definitions/ve.yaml +0 -74
- data/definitions/vi.yaml +0 -29
- data/definitions/za.yaml +0 -80
@@ -1,114 +0,0 @@
|
|
1
|
-
# Federal reserve holidays definition for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Updated: 2015-03-16
|
4
|
-
#
|
5
|
-
# Sources:
|
6
|
-
# - http://www.federalreserve.gov/aboutthefed/k8.htm
|
7
|
-
---
|
8
|
-
months:
|
9
|
-
1:
|
10
|
-
- name: New Year's Day
|
11
|
-
regions: [federal_reserve]
|
12
|
-
mday: 1
|
13
|
-
observed: to_monday_if_sunday(date)
|
14
|
-
- name: Birthday of Martin Luther King, Jr
|
15
|
-
week: 3
|
16
|
-
wday: 1
|
17
|
-
regions: [federal_reserve]
|
18
|
-
2:
|
19
|
-
- name: Washington's Birthday
|
20
|
-
week: 3
|
21
|
-
wday: 1
|
22
|
-
regions: [federal_reserve]
|
23
|
-
5:
|
24
|
-
- name: Memorial Day
|
25
|
-
week: -1
|
26
|
-
wday: 1
|
27
|
-
regions: [federal_reserve]
|
28
|
-
7:
|
29
|
-
- name: Independence Day
|
30
|
-
regions: [federal_reserve]
|
31
|
-
mday: 4
|
32
|
-
observed: to_monday_if_sunday(date)
|
33
|
-
9:
|
34
|
-
- name: Labor Day
|
35
|
-
week: 1
|
36
|
-
regions: [federal_reserve]
|
37
|
-
wday: 1
|
38
|
-
10:
|
39
|
-
- name: Columbus Day
|
40
|
-
week: 2
|
41
|
-
regions: [federal_reserve]
|
42
|
-
wday: 1
|
43
|
-
11:
|
44
|
-
- name: Veterans Day
|
45
|
-
regions: [federal_reserve]
|
46
|
-
mday: 11
|
47
|
-
observed: to_monday_if_sunday(date)
|
48
|
-
- name: Thanksgiving Day
|
49
|
-
week: 4
|
50
|
-
wday: 4
|
51
|
-
regions: [federal_reserve]
|
52
|
-
12:
|
53
|
-
- name: Christmas Day
|
54
|
-
regions: [federal_reserve]
|
55
|
-
mday: 25
|
56
|
-
observed: to_monday_if_sunday(date)
|
57
|
-
tests: |
|
58
|
-
{Date.civil(2012,1,2) => "New Year's Day",
|
59
|
-
Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
|
60
|
-
Date.civil(2012,2,20) => "Washington's Birthday",
|
61
|
-
Date.civil(2012,5,28) => "Memorial Day",
|
62
|
-
Date.civil(2012,7,4) => "Independence Day",
|
63
|
-
Date.civil(2012,9,3) => "Labor Day",
|
64
|
-
Date.civil(2012,10,8) => "Columbus Day",
|
65
|
-
Date.civil(2012,11,12) => "Veterans Day",
|
66
|
-
Date.civil(2012,11,22) => "Thanksgiving Day",
|
67
|
-
Date.civil(2012,12,25) => "Christmas Day",
|
68
|
-
|
69
|
-
Date.civil(2013,1,1) => "New Year's Day",
|
70
|
-
Date.civil(2013,1,21) => "Birthday of Martin Luther King, Jr",
|
71
|
-
Date.civil(2013,2,18) => "Washington's Birthday",
|
72
|
-
Date.civil(2013,5,27) => "Memorial Day",
|
73
|
-
Date.civil(2013,7,4) => "Independence Day",
|
74
|
-
Date.civil(2013,9,2) => "Labor Day",
|
75
|
-
Date.civil(2013,10,14) => "Columbus Day",
|
76
|
-
Date.civil(2013,11,11) => "Veterans Day",
|
77
|
-
Date.civil(2013,11,28) => "Thanksgiving Day",
|
78
|
-
Date.civil(2013,12,25) => "Christmas Day",
|
79
|
-
|
80
|
-
Date.civil(2014,1,1) => "New Year's Day",
|
81
|
-
Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
|
82
|
-
Date.civil(2014,2,17) => "Washington's Birthday",
|
83
|
-
Date.civil(2014,5,26) => "Memorial Day",
|
84
|
-
Date.civil(2014,7,4) => "Independence Day",
|
85
|
-
Date.civil(2014,9,1) => "Labor Day",
|
86
|
-
Date.civil(2014,10,13) => "Columbus Day",
|
87
|
-
Date.civil(2014,11,11) => "Veterans Day",
|
88
|
-
Date.civil(2014,11,27) => "Thanksgiving Day",
|
89
|
-
Date.civil(2014,12,25) => "Christmas Day",
|
90
|
-
|
91
|
-
Date.civil(2015,1,1) => "New Year's Day",
|
92
|
-
Date.civil(2015,1,19) => "Birthday of Martin Luther King, Jr",
|
93
|
-
Date.civil(2015,2,16) => "Washington's Birthday",
|
94
|
-
Date.civil(2015,5,25) => "Memorial Day",
|
95
|
-
Date.civil(2015,7,4) => "Independence Day",
|
96
|
-
Date.civil(2015,9,7) => "Labor Day",
|
97
|
-
Date.civil(2015,10,12) => "Columbus Day",
|
98
|
-
Date.civil(2015,11,11) => "Veterans Day",
|
99
|
-
Date.civil(2015,11,26) => "Thanksgiving Day",
|
100
|
-
Date.civil(2015,12,25) => "Christmas Day",
|
101
|
-
|
102
|
-
Date.civil(2016,1,1) => "New Year's Day",
|
103
|
-
Date.civil(2016,1,18) => "Birthday of Martin Luther King, Jr",
|
104
|
-
Date.civil(2016,2,15) => "Washington's Birthday",
|
105
|
-
Date.civil(2016,5,30) => "Memorial Day",
|
106
|
-
Date.civil(2016,7,4) => "Independence Day",
|
107
|
-
Date.civil(2016,9,5) => "Labor Day",
|
108
|
-
Date.civil(2016,10,10) => "Columbus Day",
|
109
|
-
Date.civil(2016,11,11) => "Veterans Day",
|
110
|
-
Date.civil(2016,11,24) => "Thanksgiving Day",
|
111
|
-
Date.civil(2016,12,26) => "Christmas Day",
|
112
|
-
}.each do |date, name|
|
113
|
-
assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
|
114
|
-
end
|
data/definitions/fedex.yaml
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# FedEx holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# By Adam Runner
|
4
|
-
#
|
5
|
-
# Updated: 2015-03-09.
|
6
|
-
# Source: http://www.fedex.com/us/service-guide/holiday-schedule.html
|
7
|
-
---
|
8
|
-
months:
|
9
|
-
1:
|
10
|
-
- name: New Year's Day
|
11
|
-
regions: [fedex]
|
12
|
-
mday: 1
|
13
|
-
observed: to_weekday_if_weekend(date)
|
14
|
-
5:
|
15
|
-
- name: Memorial Day
|
16
|
-
week: -1
|
17
|
-
regions: [fedex]
|
18
|
-
wday: 1
|
19
|
-
7:
|
20
|
-
- name: Independence Day
|
21
|
-
regions: [fedex]
|
22
|
-
mday: 4
|
23
|
-
observed: to_weekday_if_weekend(date)
|
24
|
-
9:
|
25
|
-
- name: Labor Day
|
26
|
-
week: 1
|
27
|
-
regions: [fedex]
|
28
|
-
wday: 1
|
29
|
-
11:
|
30
|
-
- name: Thanksgiving
|
31
|
-
week: 4
|
32
|
-
regions: [fedex]
|
33
|
-
wday: 4
|
34
|
-
- name: Day After Thanksgiving
|
35
|
-
function: day_after_thanksgiving(year)
|
36
|
-
regions: [fedex]
|
37
|
-
12:
|
38
|
-
- name: Christmas Day
|
39
|
-
regions: [fedex]
|
40
|
-
mday: 25
|
41
|
-
observed: to_weekday_if_weekend(date)
|
42
|
-
- name: New Year's Eve
|
43
|
-
regions: [fedex]
|
44
|
-
mday: 31
|
45
|
-
methods:
|
46
|
-
day_after_thanksgiving:
|
47
|
-
arguments: year
|
48
|
-
source: |
|
49
|
-
Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 11, 4, 4) + 1
|
50
|
-
tests: |
|
51
|
-
{Date.civil(2015,1,1) => 'New Year\'s Day',
|
52
|
-
Date.civil(2015,5,25) => 'Memorial Day',
|
53
|
-
Date.civil(2015,7,4) => 'Independence Day',
|
54
|
-
Date.civil(2015,9,7) => 'Labor Day',
|
55
|
-
Date.civil(2015,11,26) => 'Thanksgiving',
|
56
|
-
Date.civil(2015,11,27) => 'Day After Thanksgiving',
|
57
|
-
Date.civil(2013,11,28) => 'Thanksgiving',
|
58
|
-
Date.civil(2013,11,29) => 'Day After Thanksgiving',
|
59
|
-
Date.civil(2015,12,25) => 'Christmas Day',
|
60
|
-
Date.civil(2015,12,31) => 'New Year\'s Eve',}.each do |date, name|
|
61
|
-
assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
|
62
|
-
end
|
data/definitions/fi.yaml
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
# Finnish holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Updated: 2010-12-28.
|
4
|
-
# Sources:
|
5
|
-
# - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
|
6
|
-
---
|
7
|
-
months:
|
8
|
-
0:
|
9
|
-
- name: Pitkäperjantai
|
10
|
-
regions: [fi]
|
11
|
-
function: easter(year)
|
12
|
-
function_modifier: -2
|
13
|
-
- name: Pääsiäispäivä
|
14
|
-
regions: [fi]
|
15
|
-
function: easter(year)
|
16
|
-
- name: 2. Pääsiäispäivä
|
17
|
-
regions: [fi]
|
18
|
-
function: easter(year)
|
19
|
-
function_modifier: 1
|
20
|
-
- name: Helatorstai # Ascension Day
|
21
|
-
regions: [fi]
|
22
|
-
function: easter(year)
|
23
|
-
function_modifier: 39
|
24
|
-
- name: Helluntaipäivä # Whitsunday
|
25
|
-
regions: [fi]
|
26
|
-
function: easter(year)
|
27
|
-
function_modifier: 49
|
28
|
-
- name: Pyhäinpäivä # All Saint's Day
|
29
|
-
regions: [fi]
|
30
|
-
function: fi_pyhainpaiva(year)
|
31
|
-
1:
|
32
|
-
- name: Uudenvuodenpäivä
|
33
|
-
regions: [fi]
|
34
|
-
mday: 1
|
35
|
-
- name: Loppiainen
|
36
|
-
regions: [fi]
|
37
|
-
mday: 6
|
38
|
-
5:
|
39
|
-
- name: Vappu
|
40
|
-
regions: [fi]
|
41
|
-
mday: 1
|
42
|
-
6:
|
43
|
-
- name: Juhannusaatto
|
44
|
-
regions: [fi]
|
45
|
-
function: fi_juhannusaatto(year)
|
46
|
-
- name: Juhannuspäivä
|
47
|
-
regions: [fi]
|
48
|
-
function: fi_juhannuspaiva(year)
|
49
|
-
12:
|
50
|
-
- name: Itsenäisyyspäivä
|
51
|
-
regions: [fi]
|
52
|
-
mday: 6
|
53
|
-
- name: Jouluaatto
|
54
|
-
regions: [fi]
|
55
|
-
mday: 24
|
56
|
-
- name: Joulupäivä
|
57
|
-
regions: [fi]
|
58
|
-
mday: 25
|
59
|
-
- name: Tapaninpäivä
|
60
|
-
regions: [fi]
|
61
|
-
mday: 26
|
62
|
-
methods:
|
63
|
-
fi_juhannusaatto:
|
64
|
-
# Finland: Mid-summer eve (Friday between June 19–25)
|
65
|
-
arguments: year
|
66
|
-
source: |
|
67
|
-
date = Date.civil(year,6,19)
|
68
|
-
if date.wday > 5 #if 19.6 is saturday
|
69
|
-
date += 6
|
70
|
-
else
|
71
|
-
date += (5 - date.wday)
|
72
|
-
end
|
73
|
-
date
|
74
|
-
fi_juhannuspaiva:
|
75
|
-
# Finland: Mid-summer (Saturday between June 20–26)
|
76
|
-
arguments: year
|
77
|
-
source: |
|
78
|
-
date = Date.civil(year,6,20)
|
79
|
-
date += (6 - date.wday)
|
80
|
-
date
|
81
|
-
fi_pyhainpaiva:
|
82
|
-
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
83
|
-
arguments: year
|
84
|
-
source: |
|
85
|
-
date = Date.civil(year,10,31)
|
86
|
-
date += (6 - date.wday)
|
87
|
-
date
|
88
|
-
tests: |
|
89
|
-
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
|
90
|
-
Date.civil(2008,1,6) => 'Loppiainen',
|
91
|
-
Date.civil(2008,3,21) => 'Pitkäperjantai',
|
92
|
-
Date.civil(2008,3,23) => 'Pääsiäispäivä',
|
93
|
-
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
|
94
|
-
Date.civil(2008,5,1) => 'Vappu',
|
95
|
-
Date.civil(2008,5,1) => 'Helatorstai',
|
96
|
-
Date.civil(2008,5,11) => 'Helluntaipäivä',
|
97
|
-
Date.civil(2009,6,19) => 'Juhannusaatto',
|
98
|
-
Date.civil(2010,6,25) => 'Juhannusaatto',
|
99
|
-
Date.civil(2011,6,24) => 'Juhannusaatto',
|
100
|
-
Date.civil(2012,6,22) => 'Juhannusaatto',
|
101
|
-
Date.civil(2013,6,21) => 'Juhannusaatto',
|
102
|
-
Date.civil(2005,6,25) => 'Juhannuspäivä',
|
103
|
-
Date.civil(2006,6,24) => 'Juhannuspäivä',
|
104
|
-
Date.civil(2007,6,23) => 'Juhannuspäivä',
|
105
|
-
Date.civil(2008,6,21) => 'Juhannuspäivä',
|
106
|
-
Date.civil(2005,11,5) => 'Pyhäinpäivä',
|
107
|
-
Date.civil(2006,11,4) => 'Pyhäinpäivä',
|
108
|
-
Date.civil(2007,11,3) => 'Pyhäinpäivä',
|
109
|
-
Date.civil(2008,11,1) => 'Pyhäinpäivä',
|
110
|
-
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
|
111
|
-
Date.civil(2008,12,24) => 'Jouluaatto',
|
112
|
-
Date.civil(2008,12,25) => 'Joulupäivä',
|
113
|
-
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
|
114
|
-
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
|
115
|
-
end
|
data/definitions/fr.yaml
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
# French holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Updated: 2013-10-2*.
|
4
|
-
# Sources:
|
5
|
-
# - http://fr.wikipedia.org/wiki/Jours_f%C3%A9ri%C3%A9s_en_France#Les_f.C3.AAtes_f.C3.A9ri.C3.A9es
|
6
|
-
# - http://vosdroits.service-public.fr/particuliers/F2405.xhtml
|
7
|
-
---
|
8
|
-
months:
|
9
|
-
0:
|
10
|
-
- name: Pâques
|
11
|
-
regions: [fr]
|
12
|
-
function: easter(year)
|
13
|
-
type: informal
|
14
|
-
- name: Lundi de Pâques
|
15
|
-
regions: [fr]
|
16
|
-
function: easter(year)
|
17
|
-
function_modifier: 1
|
18
|
-
- name: Ascension
|
19
|
-
regions: [fr]
|
20
|
-
function: easter(year)
|
21
|
-
function_modifier: 39
|
22
|
-
- name: Pentecôte
|
23
|
-
regions: [fr]
|
24
|
-
function: easter(year)
|
25
|
-
function_modifier: 49
|
26
|
-
type: informal
|
27
|
-
- name: Lundi de Pentecôte
|
28
|
-
regions: [fr]
|
29
|
-
function: easter(year)
|
30
|
-
function_modifier: 50
|
31
|
-
1:
|
32
|
-
- name: Jour de l'an
|
33
|
-
regions: [fr]
|
34
|
-
mday: 1
|
35
|
-
5:
|
36
|
-
- name: Fête du travail
|
37
|
-
regions: [fr]
|
38
|
-
mday: 1
|
39
|
-
- name: Victoire 1945
|
40
|
-
regions: [fr]
|
41
|
-
mday: 8
|
42
|
-
7:
|
43
|
-
- name: Fête nationale
|
44
|
-
regions: [fr]
|
45
|
-
mday: 14
|
46
|
-
8:
|
47
|
-
- name: Assomption
|
48
|
-
regions: [fr]
|
49
|
-
mday: 15
|
50
|
-
11:
|
51
|
-
- name: Toussaint
|
52
|
-
regions: [fr]
|
53
|
-
mday: 1
|
54
|
-
- name: Armistice 1918
|
55
|
-
regions: [fr]
|
56
|
-
mday: 11
|
57
|
-
12:
|
58
|
-
- name: Noël
|
59
|
-
regions: [fr]
|
60
|
-
mday: 25
|
61
|
-
tests: |
|
62
|
-
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
63
|
-
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
64
|
-
Date.civil(2007,5,1) => 'Fête du travail',
|
65
|
-
Date.civil(2007,5,8) => 'Victoire 1945',
|
66
|
-
Date.civil(2007,5,17) => 'Ascension',
|
67
|
-
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
68
|
-
Date.civil(2007,7,14) => 'Fête nationale',
|
69
|
-
Date.civil(2007,8,15) => 'Assomption',
|
70
|
-
Date.civil(2007,11,1) => 'Toussaint',
|
71
|
-
Date.civil(2007,11,11) => 'Armistice 1918',
|
72
|
-
Date.civil(2007,12,25) => 'Noël'}.each do |date, name|
|
73
|
-
assert_equal name, (Holidays.on(date, :fr)[0] || {})[:name]
|
74
|
-
end
|
75
|
-
{Date.civil(2007,4,8) => 'Pâques',
|
76
|
-
Date.civil(2007,5,27) => 'Pentecôte'}.each do |date, name|
|
77
|
-
assert_nil (Holidays.on(date, :fr)[0] || {})[:name]
|
78
|
-
assert_equal name, (Holidays.on(date, :fr, :informal)[0] || {})[:name]
|
79
|
-
end
|
data/definitions/gb.yaml
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
# Great Britain/United Kingdom holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Including England, Wales, Scotland, N. Ireland, the Isle of Man, Guernsey
|
4
|
-
# and Jersey.
|
5
|
-
#
|
6
|
-
# Updated: 2016-04-29
|
7
|
-
# Sources:
|
8
|
-
# - http://en.wikipedia.org/wiki/List_of_holidays_by_country#United_Kingdom_and_Crown_dependencies
|
9
|
-
#
|
10
|
-
# Notes:
|
11
|
-
# - Jersey, Guernsey and the Isle of Man are encode with both their ISO 3166-1 and ISO 3-3166-2 codes.
|
12
|
-
# - England and Wales together should be encoded as [gb_eng, gb_wls, gb_eaw...]
|
13
|
-
# - For :gb_sct, St. Andrew's Day is 'informal' 2006 and earlier but a bank holiday from 2007 on.
|
14
|
-
---
|
15
|
-
months:
|
16
|
-
0:
|
17
|
-
- name: Good Friday
|
18
|
-
regions: [gb]
|
19
|
-
function: easter(year)
|
20
|
-
function_modifier: -2
|
21
|
-
- name: Easter Sunday
|
22
|
-
regions: [gb]
|
23
|
-
function: easter(year)
|
24
|
-
- name: Easter Monday
|
25
|
-
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
|
26
|
-
function: easter(year)
|
27
|
-
function_modifier: 1
|
28
|
-
1:
|
29
|
-
- name: New Year's Day
|
30
|
-
regions: [gb]
|
31
|
-
mday: 1
|
32
|
-
observed: to_monday_if_weekend(date)
|
33
|
-
- name: 2nd January
|
34
|
-
regions: [gb_sct]
|
35
|
-
mday: 2
|
36
|
-
observed: to_weekday_if_boxing_weekend(date)
|
37
|
-
3:
|
38
|
-
- name: St. Piran's Day
|
39
|
-
regions: [gb_con]
|
40
|
-
mday: 5
|
41
|
-
- name: St. Patrick's Day
|
42
|
-
regions: [gb_nir]
|
43
|
-
mday: 17
|
44
|
-
5:
|
45
|
-
- name: May Day
|
46
|
-
regions: [gb]
|
47
|
-
week: 1
|
48
|
-
wday: 1
|
49
|
-
- name: Liberation Day
|
50
|
-
regions: [je, gb_jsy, gg, gb_gsy]
|
51
|
-
mday: 9
|
52
|
-
- name: Bank Holiday
|
53
|
-
regions: [gb]
|
54
|
-
week: -1
|
55
|
-
wday: 1
|
56
|
-
7:
|
57
|
-
- name: Tynwald Day
|
58
|
-
regions: [im, gb_iom]
|
59
|
-
mday: 5
|
60
|
-
- name: Battle of the Boyne
|
61
|
-
regions: [gb_nir]
|
62
|
-
mday: 12
|
63
|
-
8:
|
64
|
-
- name: Bank Holiday
|
65
|
-
regions: [gb_sct]
|
66
|
-
week: 1
|
67
|
-
wday: 1
|
68
|
-
- name: Bank Holiday
|
69
|
-
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
|
70
|
-
week: -1
|
71
|
-
wday: 1
|
72
|
-
11:
|
73
|
-
- name: Guy Fawkes Day
|
74
|
-
regions: [gb]
|
75
|
-
mday: 5
|
76
|
-
type: informal
|
77
|
-
- name: St. Andrew's Day
|
78
|
-
regions: [gb_sct]
|
79
|
-
mday: 30
|
80
|
-
type: informal
|
81
|
-
observed: to_monday_if_weekend(date)
|
82
|
-
year_ranges:
|
83
|
-
- before: 2006
|
84
|
-
- name: St. Andrew's Day
|
85
|
-
regions: [gb_sct]
|
86
|
-
mday: 30
|
87
|
-
observed: to_monday_if_weekend(date)
|
88
|
-
year_ranges:
|
89
|
-
- after: 2007
|
90
|
-
12:
|
91
|
-
- name: Christmas Day
|
92
|
-
regions: [gb]
|
93
|
-
mday: 25
|
94
|
-
observed: to_monday_if_weekend(date)
|
95
|
-
- name: Boxing Day
|
96
|
-
regions: [gb]
|
97
|
-
mday: 26
|
98
|
-
observed: to_weekday_if_boxing_weekend(date)
|
99
|
-
tests: |
|
100
|
-
{Date.civil(2008,3,21) => 'Good Friday',
|
101
|
-
Date.civil(2008,3,23) => 'Easter Sunday',
|
102
|
-
Date.civil(2008,5,5) => 'May Day',
|
103
|
-
Date.civil(2008,5,26) => 'Bank Holiday',
|
104
|
-
Date.civil(2008,11,5) => 'Guy Fawkes Day',
|
105
|
-
Date.civil(2008,12,25) => 'Christmas Day',
|
106
|
-
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
107
|
-
assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
|
108
|
-
end
|
109
|
-
|
110
|
-
assert_equal 'St. Patrick\'s Day', Holidays.on(Date.civil(2008,3,17), :gb_nir, :informal)[0][:name]
|
111
|
-
|
112
|
-
# St. Andrew's Day is informal 2006 and earlier. Should only show up when :informal is passed
|
113
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2006,11,30), :gb_sct, :informal)[0][:name]
|
114
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2006,11,30), :gb_sct, :informal, :observed)[0][:name]
|
115
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2002,12,2), :gb_sct, :informal, :observed)[0][:name]
|
116
|
-
assert_equal [], Holidays.on(Date.civil(2004,11,30), :gb_sct)
|
117
|
-
assert_equal [], Holidays.on(Date.civil(2005,11,30), :gb_sct)
|
118
|
-
assert_equal [], Holidays.on(Date.civil(2006,11,30), :gb_sct)
|
119
|
-
|
120
|
-
# St. Andrew's Day is considered a formal bank holiday 2007 and later. It should show up regardless of whether
|
121
|
-
# :informal is specified
|
122
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2007,11,30), :gb_sct)[0][:name]
|
123
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2007,11,30), :gb_sct, :informal)[0][:name]
|
124
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2007,11,30), :gb_sct, :informal, :observed)[0][:name]
|
125
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2016,11,30), :gb_sct)[0][:name]
|
126
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2019,11,30), :gb_sct)[0][:name]
|
127
|
-
assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2019,12,2), :gb_sct, :observed)[0][:name]
|
128
|
-
|
129
|
-
assert_equal 'Christmas Day', Holidays.on(Date.civil(2008,12,25), :gb_, :observed)[0][:name]
|
130
|
-
assert_equal 'Christmas Day', Holidays.on(Date.civil(2009,12,25), :gb_, :observed)[0][:name]
|
131
|
-
assert_equal 'Christmas Day', Holidays.on(Date.civil(2010,12,27), :gb_, :observed)[0][:name]
|
132
|
-
|
133
|
-
assert_equal 'Boxing Day', Holidays.on(Date.civil(2008,12,26), :gb_, :observed)[0][:name]
|
134
|
-
assert_equal 'Boxing Day', Holidays.on(Date.civil(2009,12,28), :gb_, :observed)[0][:name]
|
135
|
-
assert_equal 'Boxing Day', Holidays.on(Date.civil(2010,12,28), :gb_, :observed)[0][:name]
|
136
|
-
assert_equal 'Boxing Day', Holidays.on(Date.civil(2011,12,27), :gb_, :observed)[0][:name]
|
137
|
-
|
138
|
-
assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2010,1,1), :gb, :observed)[0][:name]
|
139
|
-
assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2011,1,3), :gb, :observed)[0][:name]
|
140
|
-
assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2012,1,2), :gb, :observed)[0][:name]
|
141
|
-
|
142
|
-
assert_equal '2nd January', Holidays.on(Date.civil(2010,1,4), :gb_sct, :observed)[0][:name]
|
143
|
-
assert_equal '2nd January', Holidays.on(Date.civil(2011,1,4), :gb_sct, :observed)[0][:name]
|
144
|
-
assert_equal '2nd January', Holidays.on(Date.civil(2012,1,3), :gb_sct, :observed)[0][:name]
|
145
|
-
assert_equal '2nd January', Holidays.on(Date.civil(2013,1,2), :gb_sct, :observed)[0][:name]
|
146
|
-
assert_equal '2nd January', Holidays.on(Date.civil(2014,1,2), :gb_sct, :observed)[0][:name]
|
147
|
-
|
148
|
-
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
149
|
-
assert_equal 'Easter Monday', Holidays.on(Date.civil(2008,3,24), r)[0][:name]
|
150
|
-
assert_equal 'Bank Holiday', Holidays.on(Date.civil(2008,8,25), r)[0][:name]
|
151
|
-
end
|