holidays 4.7.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
data/definitions/be_fr.yaml
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# Belgium holiday definitions for the Ruby Holiday gem in French.
|
2
|
-
#
|
3
|
-
# Updated: 2012-06-20.
|
4
|
-
# Sources:
|
5
|
-
# - http://en.wikipedia.org/wiki/Public_holidays_in_Belgium
|
6
|
-
---
|
7
|
-
months:
|
8
|
-
0:
|
9
|
-
- name: Pâques
|
10
|
-
regions: [be_fr]
|
11
|
-
function: easter(year)
|
12
|
-
- name: Lundi de Pâques
|
13
|
-
regions: [be_fr]
|
14
|
-
function: easter(year)
|
15
|
-
function_modifier: 1
|
16
|
-
- name: Ascension
|
17
|
-
regions: [be_fr]
|
18
|
-
function: easter(year)
|
19
|
-
function_modifier: 39
|
20
|
-
- name: Pentecôte
|
21
|
-
regions: [be_fr]
|
22
|
-
function: easter(year)
|
23
|
-
function_modifier: 49
|
24
|
-
- name: Lundi de Pentecôte
|
25
|
-
regions: [be_fr]
|
26
|
-
function: easter(year)
|
27
|
-
function_modifier: 50
|
28
|
-
1:
|
29
|
-
- name: Jour de l'an
|
30
|
-
regions: [be_fr]
|
31
|
-
mday: 1
|
32
|
-
5:
|
33
|
-
- name: Fête du travail
|
34
|
-
regions: [be_fr]
|
35
|
-
mday: 1
|
36
|
-
7:
|
37
|
-
- name: Fête nationale
|
38
|
-
regions: [be_fr]
|
39
|
-
mday: 21
|
40
|
-
8:
|
41
|
-
- name: Assomption
|
42
|
-
regions: [be_fr]
|
43
|
-
mday: 15
|
44
|
-
11:
|
45
|
-
- name: Toussaint
|
46
|
-
regions: [be_fr]
|
47
|
-
mday: 1
|
48
|
-
- name: Armistice 1918
|
49
|
-
regions: [be_fr]
|
50
|
-
mday: 11
|
51
|
-
12:
|
52
|
-
- name: Noël
|
53
|
-
regions: [be_fr]
|
54
|
-
mday: 25
|
55
|
-
tests: |
|
56
|
-
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
57
|
-
Date.civil(2007,4,8) => 'Pâques',
|
58
|
-
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
59
|
-
Date.civil(2007,5,1) => 'Fête du travail',
|
60
|
-
Date.civil(2007,5,17) => 'Ascension',
|
61
|
-
Date.civil(2007,5,27) => 'Pentecôte',
|
62
|
-
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
63
|
-
Date.civil(2007,7,21) => 'Fête nationale',
|
64
|
-
Date.civil(2007,8,15) => 'Assomption',
|
65
|
-
Date.civil(2007,11,1) => 'Toussaint',
|
66
|
-
Date.civil(2007,11,11) => 'Armistice 1918',
|
67
|
-
Date.civil(2007,12,25) => 'Noël'}.each do |date, name|
|
68
|
-
assert_equal name, (Holidays.on(date, :be_fr, :informal)[0] || {})[:name]
|
69
|
-
end
|
data/definitions/be_nl.yaml
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# Belgium holiday definitions for the Ruby Holiday gem. In Dutch.
|
2
|
-
#
|
3
|
-
# Updated: 2016-02-17.
|
4
|
-
# Sources:
|
5
|
-
# - http://en.wikipedia.org/wiki/Public_holidays_in_Belgium
|
6
|
-
---
|
7
|
-
months:
|
8
|
-
0:
|
9
|
-
- name: Pasen
|
10
|
-
regions: [be_nl]
|
11
|
-
function: easter(year)
|
12
|
-
- name: Paasmaandag
|
13
|
-
regions: [be_nl]
|
14
|
-
function: easter(year)
|
15
|
-
function_modifier: 1
|
16
|
-
- name: O.H. Hemelvaart
|
17
|
-
regions: [be_nl]
|
18
|
-
function: easter(year)
|
19
|
-
function_modifier: 39
|
20
|
-
- name: Pinksteren
|
21
|
-
regions: [be_nl]
|
22
|
-
function: easter(year)
|
23
|
-
function_modifier: 49
|
24
|
-
- name: Pinkstermaandag
|
25
|
-
regions: [be_nl]
|
26
|
-
function: easter(year)
|
27
|
-
function_modifier: 50
|
28
|
-
1:
|
29
|
-
- name: Nieuwjaar
|
30
|
-
regions: [be_nl]
|
31
|
-
mday: 1
|
32
|
-
5:
|
33
|
-
- name: Feest van de Arbeid
|
34
|
-
regions: [be_nl]
|
35
|
-
mday: 1
|
36
|
-
7:
|
37
|
-
- name: Nationale Feestdag
|
38
|
-
regions: [be_nl]
|
39
|
-
mday: 21
|
40
|
-
8:
|
41
|
-
- name: O.L.V. Hemelvaart
|
42
|
-
regions: [be_nl]
|
43
|
-
mday: 15
|
44
|
-
11:
|
45
|
-
- name: Allerheiligen
|
46
|
-
regions: [be_nl]
|
47
|
-
mday: 1
|
48
|
-
- name: Wapenstilstand 1918
|
49
|
-
regions: [be_nl]
|
50
|
-
mday: 11
|
51
|
-
12:
|
52
|
-
- name: Kerstmis
|
53
|
-
regions: [be_nl]
|
54
|
-
mday: 25
|
55
|
-
tests: |
|
56
|
-
{Date.civil(2007,1,1) => 'Nieuwjaar',
|
57
|
-
Date.civil(2007,4,8) => 'Pasen',
|
58
|
-
Date.civil(2007,4,9) => 'Paasmaandag',
|
59
|
-
Date.civil(2007,5,1) => 'Feest van de Arbeid',
|
60
|
-
Date.civil(2007,5,17) => 'O.H. Hemelvaart',
|
61
|
-
Date.civil(2007,5,27) => 'Pinksteren',
|
62
|
-
Date.civil(2007,5,28) => 'Pinkstermaandag',
|
63
|
-
Date.civil(2007,7,21) => 'Nationale Feestdag',
|
64
|
-
Date.civil(2007,8,15) => 'O.L.V. Hemelvaart',
|
65
|
-
Date.civil(2007,11,1) => 'Allerheiligen',
|
66
|
-
Date.civil(2007,11,11) => 'Wapenstilstand 1918',
|
67
|
-
Date.civil(2007,12,25) => 'Kerstmis'}.each do |date, name|
|
68
|
-
assert_equal name, (Holidays.on(date, :be_nl, :informal)[0] || {})[:name]
|
69
|
-
end
|
data/definitions/bg.yaml
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
# Bulgaria holiday definitions for the Ruby Holiday gem.
|
2
|
-
#
|
3
|
-
# Updated: 2015-04-01.
|
4
|
-
# Source: http://en.wikipedia.org/wiki/Public_holidays_in_Bulgaria
|
5
|
-
---
|
6
|
-
months:
|
7
|
-
0:
|
8
|
-
- name: Good Friday
|
9
|
-
regions: [bg_en]
|
10
|
-
function: orthodox_easter_julian(year)
|
11
|
-
function_modifier: -2
|
12
|
-
- name: Разпети петък
|
13
|
-
regions: [bg_bg]
|
14
|
-
function: orthodox_easter_julian(year)
|
15
|
-
function_modifier: -2
|
16
|
-
- name: Holy Saturday
|
17
|
-
regions: [bg_en]
|
18
|
-
function: orthodox_easter_julian(year)
|
19
|
-
function_modifier: -1
|
20
|
-
- name: Велика събота
|
21
|
-
regions: [bg_bg]
|
22
|
-
function: orthodox_easter_julian(year)
|
23
|
-
function_modifier: -1
|
24
|
-
- name: Easter Sunday
|
25
|
-
regions: [bg_en]
|
26
|
-
function: orthodox_easter_julian(year)
|
27
|
-
- name: Възкресение Христово. Великден
|
28
|
-
regions: [bg_bg]
|
29
|
-
function: orthodox_easter_julian(year)
|
30
|
-
- name: Easter Monday
|
31
|
-
regions: [bg_en]
|
32
|
-
function: orthodox_easter_julian(year)
|
33
|
-
function_modifier: 1
|
34
|
-
- name: Възкресение Христово. Великден
|
35
|
-
regions: [bg_bg]
|
36
|
-
function: orthodox_easter_julian(year)
|
37
|
-
function_modifier: 1
|
38
|
-
1:
|
39
|
-
- name: New Year's Day
|
40
|
-
regions: [bg_en]
|
41
|
-
mday: 1
|
42
|
-
- name: Нова година
|
43
|
-
regions: [bg_bg]
|
44
|
-
mday: 1
|
45
|
-
3:
|
46
|
-
- name: Liberation Day
|
47
|
-
regions: [bg_en]
|
48
|
-
mday: 3
|
49
|
-
- name: Освобожението на България
|
50
|
-
regions: [bg_bg]
|
51
|
-
mday: 3
|
52
|
-
5:
|
53
|
-
- name: Labour Day
|
54
|
-
regions: [bg_en]
|
55
|
-
mday: 1
|
56
|
-
- name: Ден на труда
|
57
|
-
regions: [bg_bg]
|
58
|
-
mday: 1
|
59
|
-
- name: St. George's Day
|
60
|
-
regions: [bg_en]
|
61
|
-
mday: 6
|
62
|
-
- name: Гергьовден. Ден на храбростта
|
63
|
-
regions: [bg_bg]
|
64
|
-
mday: 6
|
65
|
-
- name: Slavic Literacy Day
|
66
|
-
regions: [bg_en]
|
67
|
-
mday: 24
|
68
|
-
- name: Ден на славянската писменост
|
69
|
-
regions: [bg_bg]
|
70
|
-
mday: 24
|
71
|
-
9:
|
72
|
-
- name: Unification Day
|
73
|
-
regions: [bg_en]
|
74
|
-
mday: 6
|
75
|
-
- name: Ден на Съединението
|
76
|
-
regions: [bg_bg]
|
77
|
-
mday: 6
|
78
|
-
- name: The Independence Day
|
79
|
-
regions: [bg_en]
|
80
|
-
mday: 22
|
81
|
-
- name: Ден на Независимостта
|
82
|
-
regions: [bg_bg]
|
83
|
-
mday: 22
|
84
|
-
11:
|
85
|
-
- name: Revival Leader's Day
|
86
|
-
regions: [bg_en]
|
87
|
-
mday: 1
|
88
|
-
- name: Ден на Народните будители
|
89
|
-
regions: [bg_bg]
|
90
|
-
mday: 1
|
91
|
-
12:
|
92
|
-
- name: Christmas Eve
|
93
|
-
regions: [bg_en]
|
94
|
-
mday: 24
|
95
|
-
- name: Бъдни вечер
|
96
|
-
regions: [bg_bg]
|
97
|
-
mday: 24
|
98
|
-
- name: Christmas
|
99
|
-
regions: [bg_en]
|
100
|
-
mday: 25
|
101
|
-
- name: Рождество Христово. Коледа
|
102
|
-
regions: [bg_bg]
|
103
|
-
mday: 25
|
104
|
-
- name: Christmas
|
105
|
-
regions: [bg_en]
|
106
|
-
mday: 26
|
107
|
-
- name: Рождество Христово. Коледа
|
108
|
-
regions: [bg_bg]
|
109
|
-
mday: 26
|
110
|
-
tests: |
|
111
|
-
{Date.civil(2015,1,1) => "New Year's Day",
|
112
|
-
Date.civil(2015,3,3) => "Liberation Day",
|
113
|
-
Date.civil(2015,3,28) => "Good Friday",
|
114
|
-
Date.civil(2015,3,29) => "Holy Saturday",
|
115
|
-
Date.civil(2015,3,30) => "Easter Sunday",
|
116
|
-
Date.civil(2015,3,31) => "Easter Monday",
|
117
|
-
Date.civil(2015,5,1) => "Labour Day",
|
118
|
-
Date.civil(2015,5,6) => "St. George's Day",
|
119
|
-
Date.civil(2015,5,24) => "Slavic Literacy Day",
|
120
|
-
Date.civil(2015,9,6) => "Unification Day",
|
121
|
-
Date.civil(2015,9,22) => "The Independence Day",
|
122
|
-
Date.civil(2015,11,1) => "Revival Leader's Day",
|
123
|
-
Date.civil(2015,12,24) => "Christmas Eve",
|
124
|
-
Date.civil(2015,12,25) => "Christmas",
|
125
|
-
Date.civil(2015,12,26) => "Christmas"}.each do |date, name|
|
126
|
-
assert_equal name, (Holidays.on(date, :bg_en)[0] || {})[:name]
|
127
|
-
end
|
data/definitions/br.yaml
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# Brazilian holiday definitions for the Ruby Holiday gem.
|
2
|
-
# Provided by Rogério Carrasqueira
|
3
|
-
#
|
4
|
-
# Updated: 2008-11-28.
|
5
|
-
# Sources:
|
6
|
-
# - http://pt.wikipedia.org/wiki/Feriados_no_Brasil
|
7
|
-
|
8
|
-
---
|
9
|
-
months:
|
10
|
-
0:
|
11
|
-
- name: Carnaval # same as Shrove Tuesday
|
12
|
-
regions: [br]
|
13
|
-
function: easter(year)
|
14
|
-
function_modifier: -47
|
15
|
-
type: informal
|
16
|
-
- name: Sexta-feira Santa
|
17
|
-
regions: [br]
|
18
|
-
function: easter(year)
|
19
|
-
function_modifier: -2
|
20
|
-
- name: Páscoa
|
21
|
-
regions: [br]
|
22
|
-
function: easter(year)
|
23
|
-
- name: Corpus Christi
|
24
|
-
regions: [br]
|
25
|
-
function: easter(year)
|
26
|
-
function_modifier: 60
|
27
|
-
1:
|
28
|
-
- name: Dia da Confraternização Universal
|
29
|
-
regions: [br]
|
30
|
-
mday: 1
|
31
|
-
4:
|
32
|
-
- name: Dia de Tiradentes
|
33
|
-
regions: [br]
|
34
|
-
mday: 21
|
35
|
-
5:
|
36
|
-
- name: Dia do Trabalho
|
37
|
-
regions: [br]
|
38
|
-
mday: 1
|
39
|
-
9:
|
40
|
-
- name: Proclamação da Independência
|
41
|
-
regions: [br]
|
42
|
-
mday: 7
|
43
|
-
10:
|
44
|
-
- name: Dia de Nossa Senhora Aparecida
|
45
|
-
regions: [br]
|
46
|
-
mday: 12
|
47
|
-
11:
|
48
|
-
- name: Dia de Finados
|
49
|
-
regions: [br]
|
50
|
-
mday: 2
|
51
|
-
- name: Proclamação da República
|
52
|
-
regions: [br]
|
53
|
-
mday: 15
|
54
|
-
12:
|
55
|
-
- name: Natal
|
56
|
-
regions: [br]
|
57
|
-
mday: 25
|
58
|
-
tests: |
|
59
|
-
{Date.civil(2008,1,1) => 'Dia da Confraternização Universal',
|
60
|
-
Date.civil(2005,2,8) => 'Carnaval',
|
61
|
-
Date.civil(2006,2,28) => 'Carnaval',
|
62
|
-
Date.civil(2007,2,20) => 'Carnaval',
|
63
|
-
Date.civil(2008,2,5) => 'Carnaval',
|
64
|
-
Date.civil(2008,3,21) => 'Sexta-feira Santa',
|
65
|
-
Date.civil(2008,3,23) => 'Páscoa',
|
66
|
-
Date.civil(2008,4,21) => 'Dia de Tiradentes',
|
67
|
-
Date.civil(2008,5,1) => 'Dia do Trabalho',
|
68
|
-
Date.civil(2005,5,26) => 'Corpus Christi',
|
69
|
-
Date.civil(2007,6,7) => 'Corpus Christi',
|
70
|
-
Date.civil(2008,5,22) => 'Corpus Christi',
|
71
|
-
Date.civil(2008,9,7) => 'Proclamação da Independência',
|
72
|
-
Date.civil(2008,10,12) => 'Dia de Nossa Senhora Aparecida',
|
73
|
-
Date.civil(2008,11,2) => 'Dia de Finados',
|
74
|
-
Date.civil(2008,11,15) => 'Proclamação da República',
|
75
|
-
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
|
76
|
-
assert_equal name, (Holidays.on(date, :br, :informal)[0] || {})[:name]
|
77
|
-
end
|
data/definitions/ca.yaml
DELETED
@@ -1,317 +0,0 @@
|
|
1
|
-
# Canadian holiday definitions for the Ruby Holiday gem.
|
2
|
-
# Updated 2016-04-29.
|
3
|
-
#
|
4
|
-
# Notes:
|
5
|
-
# - 'Family Day' in various provinces are only celebrated after certain years: http://www.timeanddate.com/holidays/canada/family-day
|
6
|
-
---
|
7
|
-
months:
|
8
|
-
0:
|
9
|
-
- name: Good Friday
|
10
|
-
regions: [ca]
|
11
|
-
function: easter(year)
|
12
|
-
function_modifier: -2
|
13
|
-
- name: Easter Sunday
|
14
|
-
regions: [ca]
|
15
|
-
function: easter(year)
|
16
|
-
- name: Easter Monday
|
17
|
-
regions: [ca]
|
18
|
-
function: easter(year)
|
19
|
-
function_modifier: 1
|
20
|
-
type: informal
|
21
|
-
1:
|
22
|
-
- name: New Year's Day
|
23
|
-
regions: [ca]
|
24
|
-
mday: 1
|
25
|
-
- name: New Year's
|
26
|
-
regions: [ca_qc]
|
27
|
-
mday: 2
|
28
|
-
2:
|
29
|
-
- name: Family Day
|
30
|
-
regions: [ca_ab]
|
31
|
-
wday: 1
|
32
|
-
week: 3
|
33
|
-
year_ranges:
|
34
|
-
- after: 1990
|
35
|
-
- name: Family Day
|
36
|
-
regions: [ca_sk]
|
37
|
-
wday: 1
|
38
|
-
week: 3
|
39
|
-
year_ranges:
|
40
|
-
- after: 2007
|
41
|
-
- name: Family Day
|
42
|
-
regions: [ca_on]
|
43
|
-
wday: 1
|
44
|
-
week: 3
|
45
|
-
year_ranges:
|
46
|
-
- after: 2008
|
47
|
-
- name: Family Day
|
48
|
-
regions: [ca_bc]
|
49
|
-
wday: 1
|
50
|
-
week: 2
|
51
|
-
year_ranges:
|
52
|
-
- after: 2013
|
53
|
-
- name: Louis Riel Day
|
54
|
-
regions: [ca_mb]
|
55
|
-
wday: 1
|
56
|
-
week: 3
|
57
|
-
- name: Nova Scotia Heritage Day
|
58
|
-
regions: [ca_ns]
|
59
|
-
wday: 1
|
60
|
-
week: 3
|
61
|
-
year_ranges:
|
62
|
-
- after: 2015
|
63
|
-
- name: Islander Day
|
64
|
-
regions: [ca_pe]
|
65
|
-
wday: 1
|
66
|
-
week: 3
|
67
|
-
3:
|
68
|
-
- name: St. Patrick's Day
|
69
|
-
regions: [ca_nf]
|
70
|
-
mday: 17
|
71
|
-
3:
|
72
|
-
- name: St. George's Day
|
73
|
-
regions: [ca_nf]
|
74
|
-
mday: 23
|
75
|
-
5:
|
76
|
-
- name: Victoria Day
|
77
|
-
regions: [ca]
|
78
|
-
function: ca_victoria_day(year)
|
79
|
-
- name: National Patriotes Day
|
80
|
-
regions: [ca_qc]
|
81
|
-
function: ca_victoria_day(year)
|
82
|
-
6:
|
83
|
-
- name: Discovery Day
|
84
|
-
regions: [ca_nf]
|
85
|
-
mday: 24
|
86
|
-
- name: Fête Nationale
|
87
|
-
regions: [ca_qc]
|
88
|
-
mday: 24
|
89
|
-
- name: National Aboriginal Day
|
90
|
-
regions: [ca_nt]
|
91
|
-
mday: 21
|
92
|
-
7:
|
93
|
-
- name: Canada Day
|
94
|
-
regions: [ca]
|
95
|
-
mday: 1
|
96
|
-
observed: to_monday_if_sunday(date)
|
97
|
-
- name: Orangemen's Day
|
98
|
-
regions: [ca_nf]
|
99
|
-
mday: 12
|
100
|
-
- name: Nunavut Day
|
101
|
-
regions: [ca_nu]
|
102
|
-
mday: 9
|
103
|
-
8:
|
104
|
-
- name: BC Day
|
105
|
-
week: 1
|
106
|
-
regions: [ca_bc]
|
107
|
-
wday: 1
|
108
|
-
- name: Saskatchewan Day
|
109
|
-
week: 1
|
110
|
-
regions: [ca_sk]
|
111
|
-
wday: 1
|
112
|
-
- name: Heritage Day
|
113
|
-
week: 1
|
114
|
-
regions: [ca_ab]
|
115
|
-
wday: 1
|
116
|
-
- name: Natal Day
|
117
|
-
week: 1
|
118
|
-
regions: [ca_ns]
|
119
|
-
wday: 1
|
120
|
-
- name: Civic Holiday
|
121
|
-
week: 1
|
122
|
-
regions: [ca_on, ca_nt, ca_nu, ca_pe] # Appears to be a holiday in Ontario by convention
|
123
|
-
wday: 1
|
124
|
-
- name: New Brunswick Day
|
125
|
-
week: 1
|
126
|
-
regions: [ca_nb]
|
127
|
-
wday: 1
|
128
|
-
- name: Discovery Day
|
129
|
-
week: 3
|
130
|
-
regions: [ca_yk]
|
131
|
-
wday: 1
|
132
|
-
9:
|
133
|
-
- name: Labour Day
|
134
|
-
week: 1
|
135
|
-
regions: [ca]
|
136
|
-
wday: 1
|
137
|
-
10:
|
138
|
-
- name: Thanksgiving
|
139
|
-
week: 2
|
140
|
-
regions: [ca]
|
141
|
-
wday: 1
|
142
|
-
11:
|
143
|
-
- name: Remembrance Day
|
144
|
-
regions: [ ca_ab, ca_sk, ca_bc, ca_pe, ca_nf, ca_nt, ca_nu, ca_nb, ca_yk]
|
145
|
-
mday: 11
|
146
|
-
12:
|
147
|
-
- name: Christmas Day
|
148
|
-
regions: [ca]
|
149
|
-
mday: 25
|
150
|
-
- name: Boxing Day
|
151
|
-
regions: [ca]
|
152
|
-
mday: 26
|
153
|
-
methods:
|
154
|
-
ca_victoria_day:
|
155
|
-
# Monday on or before May 24
|
156
|
-
arguments: year
|
157
|
-
source: |
|
158
|
-
date = Date.civil(year,5,24)
|
159
|
-
if date.wday > 1
|
160
|
-
date -= (date.wday - 1)
|
161
|
-
elsif date.wday == 0
|
162
|
-
date -= 6
|
163
|
-
end
|
164
|
-
date
|
165
|
-
tests: |
|
166
|
-
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
167
|
-
Date.civil(2008,3,21) => 'Good Friday',
|
168
|
-
Date.civil(2013,3,31) => 'Easter Sunday',
|
169
|
-
Date.civil(2008,3,24) => 'Easter Monday',
|
170
|
-
Date.civil(2008,5,19) => 'Victoria Day',
|
171
|
-
Date.civil(2008,7,1) => 'Canada Day',
|
172
|
-
Date.civil(2008,9,1) => 'Labour Day',
|
173
|
-
Date.civil(2008,10,13) => 'Thanksgiving',
|
174
|
-
Date.civil(2008,12,25) => 'Christmas Day',
|
175
|
-
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
176
|
-
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
177
|
-
end
|
178
|
-
|
179
|
-
# Family Day in Alberta - Should only be active on 1990 or later
|
180
|
-
[
|
181
|
-
Date.civil(1990,2,19),
|
182
|
-
Date.civil(2013,2,18),
|
183
|
-
Date.civil(2014,2,17),
|
184
|
-
Date.civil(2044,2,15),
|
185
|
-
].each do |date|
|
186
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_ab)[0][:name]
|
187
|
-
end
|
188
|
-
|
189
|
-
# Family Day in Alberta - should not be active before 1990
|
190
|
-
[
|
191
|
-
Date.civil(1970,2,16),
|
192
|
-
Date.civil(1988,2,15),
|
193
|
-
Date.civil(1989,2,20),
|
194
|
-
].each do |date|
|
195
|
-
assert_equal [], Holidays.on(date, :ca_ab)
|
196
|
-
end
|
197
|
-
|
198
|
-
# Family Day in Saskatchewan - Should only be active on 2007 or later
|
199
|
-
[
|
200
|
-
Date.civil(2007,2,19),
|
201
|
-
Date.civil(2013,2,18),
|
202
|
-
Date.civil(2014,2,17),
|
203
|
-
Date.civil(2044,2,15),
|
204
|
-
].each do |date|
|
205
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_sk)[0][:name]
|
206
|
-
end
|
207
|
-
|
208
|
-
# Family Day in Saskatchewan - should not be active before 2007
|
209
|
-
[
|
210
|
-
Date.civil(1970,2,16),
|
211
|
-
Date.civil(1988,2,15),
|
212
|
-
Date.civil(1989,2,20),
|
213
|
-
Date.civil(2006,2,20),
|
214
|
-
].each do |date|
|
215
|
-
assert_equal [], Holidays.on(date, :ca_sk)
|
216
|
-
end
|
217
|
-
|
218
|
-
# Family Day in Ontario - Should only be active on 2008 or later
|
219
|
-
[
|
220
|
-
Date.civil(2008,2,18),
|
221
|
-
Date.civil(2013,2,18),
|
222
|
-
Date.civil(2014,2,17),
|
223
|
-
Date.civil(2044,2,15),
|
224
|
-
].each do |date|
|
225
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_on)[0][:name]
|
226
|
-
end
|
227
|
-
|
228
|
-
# Family Day in Ontario - should not be active before 2008
|
229
|
-
[
|
230
|
-
Date.civil(1970,2,16),
|
231
|
-
Date.civil(1988,2,15),
|
232
|
-
Date.civil(1989,2,20),
|
233
|
-
Date.civil(2006,2,20),
|
234
|
-
Date.civil(2007,2,19),
|
235
|
-
].each do |date|
|
236
|
-
assert_equal [], Holidays.on(date, :ca_on)
|
237
|
-
end
|
238
|
-
|
239
|
-
# Family Day in BC - Should only be active on 2013 or later
|
240
|
-
[
|
241
|
-
Date.civil(2013,2,11),
|
242
|
-
Date.civil(2014,2,10),
|
243
|
-
Date.civil(2044,2,8),
|
244
|
-
].each do |date|
|
245
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_bc)[0][:name]
|
246
|
-
end
|
247
|
-
|
248
|
-
# Family Day in BC - should not be active before 2013
|
249
|
-
[
|
250
|
-
Date.civil(2000,2,14),
|
251
|
-
Date.civil(2011,2,14),
|
252
|
-
Date.civil(2012,2,13),
|
253
|
-
].each do |date|
|
254
|
-
assert_equal [], Holidays.on(date, :ca_bc)
|
255
|
-
end
|
256
|
-
|
257
|
-
# Nova Scotia Heritage Day - should only be active on 2015 and later
|
258
|
-
[
|
259
|
-
Date.civil(2015,2,16),
|
260
|
-
Date.civil(2016,2,15),
|
261
|
-
Date.civil(2017,2,20),
|
262
|
-
Date.civil(2044,2,15),
|
263
|
-
].each do |date|
|
264
|
-
assert_equal 'Nova Scotia Heritage Day', Holidays.on(date, :ca_ns)[0][:name]
|
265
|
-
end
|
266
|
-
|
267
|
-
# Nova Scotia Heritage Day - should not be active before 2015
|
268
|
-
[
|
269
|
-
Date.civil(2000,2,21),
|
270
|
-
Date.civil(2012,2,20),
|
271
|
-
Date.civil(2013,2,18),
|
272
|
-
Date.civil(2014,2,17),
|
273
|
-
].each do |date|
|
274
|
-
assert_equal [], Holidays.on(date, :ca_ns)
|
275
|
-
end
|
276
|
-
|
277
|
-
# Islander Day in PE
|
278
|
-
[ Date.civil(2013,2,18), Date.civil(2014,2,17) ].each do |date|
|
279
|
-
assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
|
280
|
-
end
|
281
|
-
|
282
|
-
# Victoria Day
|
283
|
-
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
284
|
-
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
285
|
-
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
286
|
-
end
|
287
|
-
|
288
|
-
# First Monday in August
|
289
|
-
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
290
|
-
{ :ca_bc => 'BC Day',
|
291
|
-
:ca_sk => 'Saskatchewan Day',
|
292
|
-
:ca_ab => 'Heritage Day',
|
293
|
-
:ca_ns => 'Natal Day',
|
294
|
-
:ca_on => 'Civic Holiday',
|
295
|
-
:ca_nt => 'Civic Holiday',
|
296
|
-
:ca_nu => 'Civic Holiday',
|
297
|
-
:ca_pe => 'Civic Holiday',
|
298
|
-
:ca_nb => 'New Brunswick Day' }.each do |region, name|
|
299
|
-
assert_equal name, Holidays.on(date, region)[0][:name]
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
# Remembrance Day in all Canadian provinces
|
304
|
-
# except (Nova Scotia, Manitoba, Ontario, and Quebec)
|
305
|
-
[
|
306
|
-
:ca_ab,
|
307
|
-
:ca_sk,
|
308
|
-
:ca_bc,
|
309
|
-
:ca_pe,
|
310
|
-
:ca_nf,
|
311
|
-
:ca_nt,
|
312
|
-
:ca_nu,
|
313
|
-
:ca_nb,
|
314
|
-
:ca_yk
|
315
|
-
].each do |province|
|
316
|
-
assert_equal "Remembrance Day", Holidays.on(Date.civil(2016,11,11), province)[0][:name]
|
317
|
-
end
|