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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
// Copyright 2026 Regit.io — Nicolas Koenig
// SPDX-License-Identifier: Apache-2.0
//! TARGET2 — the Eurosystem closing-days calendar (ECB fixed rule).
//!
//! TARGET2 (Trans-European Automated Real-time Gross settlement Express
//! Transfer system) is the euro-area large-value payment system, and its
//! closing-days schedule defines the "TARGET2 business day" used by every
//! EUR-denominated cashflow this crate processes. Unlike the exchange and
//! bank-holiday calendars catalogued in the other submodules of
//! [`crate::calendar`], TARGET2 is **fully rule-based**: the European
//! Central Bank fixes exactly six closing dates per year, derivable from
//! the year alone, and that schedule has not changed since TARGET2 went
//! live in 2008. No dated snapshot is stored — the rule is exact for every
//! year in the supported [`Date`] range.
//!
//! The six closing dates are:
//!
//! ```text
//! 1. 1 January New Year's Day (fixed)
//! 2. Good Friday Easter Sunday − 2 days (Easter-derived)
//! 3. Easter Monday Easter Sunday + 1 day (Easter-derived)
//! 4. 1 May Labour Day (fixed)
//! 5. 25 December Christmas Day (fixed)
//! 6. 26 December Christmas Holiday / Boxing Day (fixed)
//! ```
//!
//! Whit Monday (Easter + 49 days) was a TARGET closing day in the
//! original 1999–2001 schedule and was removed when TARGET2 succeeded
//! TARGET in 2002; it is **not** a TARGET2 holiday and this module does
//! not return `true` for it.
//!
//! # Algorithm
//!
//! ```text
//! easter = easter_sunday(date.year()) // Computus / Meeus
//! good_friday = easter − 2 days
//! easter_monday = easter + 1 day
//!
//! is_holiday(date) =
//! date == (year, 1, 1) || // New Year's Day
//! date == good_friday ||
//! date == easter_monday ||
//! date == (year, 5, 1) || // Labour Day
//! date == (year, 12, 25) || // Christmas Day
//! date == (year, 12, 26) // Christmas Holiday
//! ```
//!
//! Weekends (Saturday and Sunday) are **not** classified as holidays by
//! this function. They are the responsibility of the caller's business-day
//! predicate (see the `is_business_day` dispatcher in [`crate::calendar`]),
//! which composes a weekend test with this holiday test. The rule dates
//! themselves are reported unconditionally — a holiday is not "shifted"
//! when it falls on a Saturday or Sunday; the TARGET2 schedule simply
//! coincides with the weekend in that case.
//!
//! # Worked example — 2026
//!
//! ```text
//! easter_sunday(2026) = 2026-04-05 (Computus)
//! good_friday = 2026-04-03
//! easter_monday = 2026-04-06
//!
//! holidays(2026) = { 2026-01-01, 2026-04-03, 2026-04-06,
//! 2026-05-01, 2026-12-25, 2026-12-26 }
//! ```
//!
//! # References
//!
//! - European Central Bank, *Decision of the European Central Bank on
//! the TARGET2 closing days* — the six fixed closing dates,
//! unchanged since TARGET2 went live on 19 November 2007 and replaced
//! TARGET on 19 May 2008.
//! - European Central Bank, *TARGET Annual Report* (any year) —
//! reproduces the closing-day list.
//! - Jean Meeus, *Astronomical Algorithms*, 2nd ed., Willmann-Bell, 1998,
//! §8 "The date of Easter" — the Computus used by [`Date::easter_sunday`].
use crateDate;
/// True if `date` is a TARGET2 holiday (a Eurozone-wide bank holiday).
///
/// TARGET2 is the only calendar in this crate that is fully rule-based —
/// the six holidays are derived from the year alone (Easter via the
/// Computus algorithm in [`Date::easter_sunday`]), so no dated table is
/// stored and the calendar is exact for every year in the supported
/// `Date` range.
///
/// Weekends are NOT classified as holidays here — they are handled by the
/// caller's business-day predicate (see the `is_business_day` dispatcher
/// in [`crate::calendar`]).
///
/// # Examples
///
/// ```
/// use regit_daycount::Date;
/// use regit_daycount::calendar::target2;
///
/// // Christmas Day 2026 is a TARGET2 holiday.
/// assert!(target2::is_holiday(Date::ymd(2026, 12, 25).unwrap()));
///
/// // A regular Wednesday is not.
/// assert!(!target2::is_holiday(Date::ymd(2026, 5, 20).unwrap()));
/// ```