-
Notifications
You must be signed in to change notification settings - Fork 136
/
tsx.yaml
257 lines (248 loc) · 5 KB
/
tsx.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# Toronto Stock Exchange (TSX)'s holiday definitions for the Ruby Holiday gem.
#
# Source: https://www.tsx.com/trading/calendars-and-trading-hours/calendar
---
months:
0:
- name: Good Friday
regions: [tsx]
function: easter(year)
function_modifier: -2
1:
- name: New Year's Day
regions: [tsx]
mday: 1
observed: to_monday_if_weekend(date)
2:
- name: Family Day
regions: [tsx]
wday: 1
week: 3
year_ranges:
from: 2008
5:
- name: Victoria Day
regions: [tsx]
function: ca_victoria_day(year)
7:
- name: Canada Day
regions: [tsx]
mday: 1
observed: to_monday_if_weekend(date)
8:
- name: Civic Holiday
week: 1
regions: [tsx]
wday: 1
9:
- name: Labour Day
week: 1
regions: [tsx]
wday: 1
10:
- name: Thanksgiving
week: 2
regions: [tsx]
wday: 1
12:
- name: Christmas Day
regions: [tsx]
mday: 25
year_ranges:
until: 2020
observed: to_weekday_if_weekend(date)
- name: Christmas Day
regions: [tsx]
mday: 25
observed: to_monday_if_weekend(date)
year_ranges:
from: 2020
- name: Boxing Day
regions: [tsx]
mday: 26
year_ranges:
until: 2020
observed: to_monday_if_weekend(date)
- name: Boxing Day
regions: [tsx]
mday: 26
year_ranges:
from: 2020
observed: to_weekday_if_boxing_weekend(date)
methods:
ca_victoria_day:
# Monday on or before May 24
arguments: year
ruby: |
date = Date.civil(year,5,24)
if date.wday > 1
date -= (date.wday - 1)
elsif date.wday == 0
date -= 6
end
date
tests:
- given:
date: '2008-01-01'
regions: ["tsx"]
options: ["informal"]
expect:
name: "New Year's Day"
- given:
date: '2008-03-21'
regions: ["tsx"]
options: ["informal"]
expect:
name: "Good Friday"
- given:
date: '2008-07-01'
regions: ["tsx"]
options: ["informal"]
expect:
name: "Canada Day"
- given:
date: '2008-09-01'
regions: ["tsx"]
options: ["informal"]
expect:
name: "Labour Day"
- given:
date: '2008-12-25'
regions: ["tsx"]
options: ["informal"]
expect:
name: "Christmas Day"
# Family Day in Ontario - should not be active before 2008
- given:
date: '1970-02-16'
regions: ["tsx"]
expect:
holiday: false
- given:
date: '1988-02-15'
regions: ["tsx"]
expect:
holiday: false
- given:
date: '1989-02-20'
regions: ["tsx"]
expect:
holiday: false
- given:
date: '2006-02-20'
regions: ["tsx"]
expect:
holiday: false
- given:
date: '2007-02-19'
regions: ["tsx"]
expect:
holiday: false
# New years observed date
- given:
date: '2011-01-03'
regions: ["tsx"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2012-01-02'
regions: ["tsx"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2016-01-01'
regions: ["tsx"]
options: ["observed"]
expect:
name: "New Year's Day"
# Canada Day observed date
- given:
date: '2011-07-01'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Canada Day"
- given:
date: '2012-07-02'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Canada Day"
- given:
date: '2017-07-03'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Canada Day"
# Christmas Day
- given:
date: '2010-12-25'
regions: ["tsx"]
expect:
name: "Christmas Day"
- given:
date: '2018-12-25'
regions: ["tsx"]
expect:
name: "Christmas Day"
- given:
date: '2022-12-25'
regions: ["tsx"]
expect:
name: "Christmas Day"
- given:
date: '2022-12-25'
regions: ["tsx"]
options: ["observed"]
expect:
holiday: false
# Christmas Day observed date
- given:
date: '2010-12-24'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2012-12-25'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2016-12-26'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2021-12-27'
regions: [ "tsx" ]
options: [ "observed" ]
expect:
name: "Christmas Day"
- given:
date: '2022-12-26'
regions: ["tsx"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: ['2010-12-27', '2012-12-26', '2015-12-28']
regions: ["tsx"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: ['2022-05-23', '2021-05-24']
regions: ['tsx']
expect:
name: "Victoria Day"
- given:
date: '2015-05-24'
regions: ["tsx"]
options: ["observed"]
expect:
holiday: false