@checkdigit/time 1.0.0-PR.11-7d2f → 1.0.0-PR.11-7a3c
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.
- package/dist/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.d.ts +2 -1
- package/dist/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.d.ts.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.js +13 -6
- package/dist/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.js.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.spec.js +372 -95
- package/dist/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.spec.js.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/get-all-federal-reserve-bank-holidays.d.ts.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/get-all-federal-reserve-bank-holidays.js +8 -7
- package/dist/holidays/united-states/federal-reserve-bank/get-all-federal-reserve-bank-holidays.js.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.d.ts +2 -1
- package/dist/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.d.ts.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.js +2 -1
- package/dist/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.js.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.spec.js +175 -175
- package/dist/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.spec.js.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/plain-date.d.ts +6 -0
- package/dist/holidays/united-states/federal-reserve-bank/plain-date.d.ts.map +1 -0
- package/dist/holidays/united-states/federal-reserve-bank/plain-date.js +4 -0
- package/dist/holidays/united-states/federal-reserve-bank/plain-date.js.map +1 -0
- package/dist/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.d.ts +2 -1
- package/dist/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.d.ts.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.js +13 -6
- package/dist/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.js.map +1 -1
- package/dist/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.spec.js +472 -111
- package/dist/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/holidays/united-states/federal-reserve-bank/add-federal-reserve-bank-business-days.ts +16 -6
- package/src/holidays/united-states/federal-reserve-bank/get-all-federal-reserve-bank-holidays.ts +8 -7
- package/src/holidays/united-states/federal-reserve-bank/is-federal-reserve-bank-holiday.ts +3 -1
- package/src/holidays/united-states/federal-reserve-bank/plain-date.ts +7 -0
- package/src/holidays/united-states/federal-reserve-bank/subtract-federal-reserve-bank-business-days.ts +16 -6
|
@@ -8,138 +8,499 @@ const node_assert_1 = require("node:assert");
|
|
|
8
8
|
const subtract_federal_reserve_bank_business_days_1 = __importDefault(require("./subtract-federal-reserve-bank-business-days"));
|
|
9
9
|
describe('subtract-federal-reserve-bank-business-days', () => {
|
|
10
10
|
it('throws error when amount is NaN', () => {
|
|
11
|
-
node_assert_1.strict.throws(() => (0, subtract_federal_reserve_bank_business_days_1.default)(
|
|
11
|
+
node_assert_1.strict.throws(() => (0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 13 }, Number.NaN), TypeError);
|
|
12
12
|
});
|
|
13
13
|
it('works for 0 business days for the whole week', () => {
|
|
14
|
-
node_assert_1.strict.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
node_assert_1.strict.
|
|
20
|
-
|
|
14
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 13 }, 0), {
|
|
15
|
+
year: 2022,
|
|
16
|
+
month: 10,
|
|
17
|
+
date: 13,
|
|
18
|
+
});
|
|
19
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 14 }, 0), {
|
|
20
|
+
year: 2022,
|
|
21
|
+
month: 10,
|
|
22
|
+
date: 14,
|
|
23
|
+
});
|
|
24
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 15 }, 0), {
|
|
25
|
+
year: 2022,
|
|
26
|
+
month: 10,
|
|
27
|
+
date: 15,
|
|
28
|
+
});
|
|
29
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 16 }, 0), {
|
|
30
|
+
year: 2022,
|
|
31
|
+
month: 10,
|
|
32
|
+
date: 16,
|
|
33
|
+
});
|
|
34
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 17 }, 0), {
|
|
35
|
+
year: 2022,
|
|
36
|
+
month: 10,
|
|
37
|
+
date: 17,
|
|
38
|
+
});
|
|
39
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 18 }, 0), {
|
|
40
|
+
year: 2022,
|
|
41
|
+
month: 10,
|
|
42
|
+
date: 18,
|
|
43
|
+
});
|
|
44
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 19 }, 0), {
|
|
45
|
+
year: 2022,
|
|
46
|
+
month: 10,
|
|
47
|
+
date: 19,
|
|
48
|
+
});
|
|
21
49
|
});
|
|
22
50
|
it('works for 1 business day with Christmas Day and New Years observed on a Monday', () => {
|
|
23
|
-
node_assert_1.strict.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
node_assert_1.strict.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 25 }, 1), {
|
|
52
|
+
year: 2022,
|
|
53
|
+
month: 11,
|
|
54
|
+
date: 23,
|
|
55
|
+
});
|
|
56
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 26 }, 1), {
|
|
57
|
+
year: 2022,
|
|
58
|
+
month: 11,
|
|
59
|
+
date: 23,
|
|
60
|
+
});
|
|
61
|
+
// Since 2022-12-26 is a Federal Reserve Holiday (observed) celebrating Christmas Day
|
|
62
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 27 }, 1), {
|
|
63
|
+
year: 2022,
|
|
64
|
+
month: 11,
|
|
65
|
+
date: 23,
|
|
66
|
+
});
|
|
67
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 28 }, 1), {
|
|
68
|
+
year: 2022,
|
|
69
|
+
month: 11,
|
|
70
|
+
date: 27,
|
|
71
|
+
});
|
|
72
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 29 }, 1), {
|
|
73
|
+
year: 2022,
|
|
74
|
+
month: 11,
|
|
75
|
+
date: 28,
|
|
76
|
+
});
|
|
77
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 30 }, 1), {
|
|
78
|
+
year: 2022,
|
|
79
|
+
month: 11,
|
|
80
|
+
date: 29,
|
|
81
|
+
});
|
|
82
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 31 }, 1), {
|
|
83
|
+
year: 2022,
|
|
84
|
+
month: 11,
|
|
85
|
+
date: 30,
|
|
86
|
+
});
|
|
87
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 1 }, 1), {
|
|
88
|
+
year: 2022,
|
|
89
|
+
month: 11,
|
|
90
|
+
date: 30,
|
|
91
|
+
});
|
|
92
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 2 }, 1), {
|
|
93
|
+
year: 2022,
|
|
94
|
+
month: 11,
|
|
95
|
+
date: 30,
|
|
96
|
+
});
|
|
97
|
+
// Since 2023-01-02 is a Federal Reserve Holiday (observed) celebrating New Year's Day
|
|
98
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 3 }, 1), {
|
|
99
|
+
year: 2022,
|
|
100
|
+
month: 11,
|
|
101
|
+
date: 30,
|
|
102
|
+
});
|
|
103
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 4 }, 1), {
|
|
104
|
+
year: 2023,
|
|
105
|
+
month: 0,
|
|
106
|
+
date: 3,
|
|
107
|
+
});
|
|
34
108
|
});
|
|
35
109
|
it('works for 2 business days for the whole week with no federal holidays in between', () => {
|
|
36
|
-
node_assert_1.strict.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
node_assert_1.strict.
|
|
42
|
-
|
|
110
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 11 }, 2), {
|
|
111
|
+
year: 2022,
|
|
112
|
+
month: 11,
|
|
113
|
+
date: 8,
|
|
114
|
+
});
|
|
115
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 12 }, 2), {
|
|
116
|
+
year: 2022,
|
|
117
|
+
month: 11,
|
|
118
|
+
date: 8,
|
|
119
|
+
});
|
|
120
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 13 }, 2), {
|
|
121
|
+
year: 2022,
|
|
122
|
+
month: 11,
|
|
123
|
+
date: 9,
|
|
124
|
+
});
|
|
125
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 14 }, 2), {
|
|
126
|
+
year: 2022,
|
|
127
|
+
month: 11,
|
|
128
|
+
date: 12,
|
|
129
|
+
});
|
|
130
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 15 }, 2), {
|
|
131
|
+
year: 2022,
|
|
132
|
+
month: 11,
|
|
133
|
+
date: 13,
|
|
134
|
+
});
|
|
135
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 16 }, 2), {
|
|
136
|
+
year: 2022,
|
|
137
|
+
month: 11,
|
|
138
|
+
date: 14,
|
|
139
|
+
});
|
|
140
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 17 }, 2), {
|
|
141
|
+
year: 2022,
|
|
142
|
+
month: 11,
|
|
143
|
+
date: 15,
|
|
144
|
+
});
|
|
43
145
|
});
|
|
44
146
|
it('works for 2 business days for the whole week with a federal holiday(Thanksgiving Day) in between', () => {
|
|
45
|
-
node_assert_1.strict.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
node_assert_1.strict.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
147
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 20 }, 2), {
|
|
148
|
+
year: 2022,
|
|
149
|
+
month: 10,
|
|
150
|
+
date: 17,
|
|
151
|
+
});
|
|
152
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 21 }, 2), {
|
|
153
|
+
year: 2022,
|
|
154
|
+
month: 10,
|
|
155
|
+
date: 17,
|
|
156
|
+
});
|
|
157
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 22 }, 2), {
|
|
158
|
+
year: 2022,
|
|
159
|
+
month: 10,
|
|
160
|
+
date: 18,
|
|
161
|
+
});
|
|
162
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 23 }, 2), {
|
|
163
|
+
year: 2022,
|
|
164
|
+
month: 10,
|
|
165
|
+
date: 21,
|
|
166
|
+
});
|
|
167
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 24 }, 2), {
|
|
168
|
+
year: 2022,
|
|
169
|
+
month: 10,
|
|
170
|
+
date: 22,
|
|
171
|
+
});
|
|
172
|
+
// Since 2022-11-24 is a Federal Reserve Holiday (observed) celebrating Thanksgiving Day
|
|
173
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 25 }, 2), {
|
|
174
|
+
year: 2022,
|
|
175
|
+
month: 10,
|
|
176
|
+
date: 22,
|
|
177
|
+
});
|
|
178
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 26 }, 2), {
|
|
179
|
+
year: 2022,
|
|
180
|
+
month: 10,
|
|
181
|
+
date: 23,
|
|
182
|
+
});
|
|
183
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 27 }, 2), {
|
|
184
|
+
year: 2022,
|
|
185
|
+
month: 10,
|
|
186
|
+
date: 23,
|
|
187
|
+
});
|
|
188
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 28 }, 2), {
|
|
189
|
+
year: 2022,
|
|
190
|
+
month: 10,
|
|
191
|
+
date: 23,
|
|
192
|
+
});
|
|
193
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 10, date: 29 }, 2), {
|
|
194
|
+
year: 2022,
|
|
195
|
+
month: 10,
|
|
196
|
+
date: 25,
|
|
197
|
+
});
|
|
55
198
|
});
|
|
56
199
|
it('works for 2 business days when the daylight savings time begins in 2023', () => {
|
|
57
|
-
node_assert_1.strict.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
node_assert_1.strict.
|
|
63
|
-
|
|
200
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 10 }, 2), {
|
|
201
|
+
year: 2023,
|
|
202
|
+
month: 2,
|
|
203
|
+
date: 8,
|
|
204
|
+
});
|
|
205
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 11 }, 2), {
|
|
206
|
+
year: 2023,
|
|
207
|
+
month: 2,
|
|
208
|
+
date: 9,
|
|
209
|
+
});
|
|
210
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 12 }, 2), {
|
|
211
|
+
year: 2023,
|
|
212
|
+
month: 2,
|
|
213
|
+
date: 9,
|
|
214
|
+
});
|
|
215
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 13 }, 2), {
|
|
216
|
+
year: 2023,
|
|
217
|
+
month: 2,
|
|
218
|
+
date: 9,
|
|
219
|
+
});
|
|
220
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 14 }, 2), {
|
|
221
|
+
year: 2023,
|
|
222
|
+
month: 2,
|
|
223
|
+
date: 10,
|
|
224
|
+
});
|
|
225
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 15 }, 2), {
|
|
226
|
+
year: 2023,
|
|
227
|
+
month: 2,
|
|
228
|
+
date: 13,
|
|
229
|
+
});
|
|
230
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 2, date: 16 }, 2), {
|
|
231
|
+
year: 2023,
|
|
232
|
+
month: 2,
|
|
233
|
+
date: 14,
|
|
234
|
+
});
|
|
64
235
|
});
|
|
65
236
|
it('works for 3 business days when the daylight savings time ends in 2023', () => {
|
|
66
|
-
node_assert_1.strict.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
node_assert_1.strict.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
node_assert_1.strict.
|
|
237
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 1 }, 3), {
|
|
238
|
+
year: 2023,
|
|
239
|
+
month: 9,
|
|
240
|
+
date: 27,
|
|
241
|
+
});
|
|
242
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 2 }, 3), {
|
|
243
|
+
year: 2023,
|
|
244
|
+
month: 9,
|
|
245
|
+
date: 30,
|
|
246
|
+
});
|
|
247
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 3 }, 3), {
|
|
248
|
+
year: 2023,
|
|
249
|
+
month: 9,
|
|
250
|
+
date: 31,
|
|
251
|
+
});
|
|
252
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 4 }, 3), {
|
|
253
|
+
year: 2023,
|
|
254
|
+
month: 10,
|
|
255
|
+
date: 1,
|
|
256
|
+
});
|
|
257
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 5 }, 3), {
|
|
258
|
+
year: 2023,
|
|
259
|
+
month: 10,
|
|
260
|
+
date: 1,
|
|
261
|
+
});
|
|
262
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 6 }, 3), {
|
|
263
|
+
year: 2023,
|
|
264
|
+
month: 10,
|
|
265
|
+
date: 1,
|
|
266
|
+
});
|
|
267
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 7 }, 3), {
|
|
268
|
+
year: 2023,
|
|
269
|
+
month: 10,
|
|
270
|
+
date: 2,
|
|
271
|
+
});
|
|
272
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 8 }, 3), {
|
|
273
|
+
year: 2023,
|
|
274
|
+
month: 10,
|
|
275
|
+
date: 3,
|
|
276
|
+
});
|
|
277
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 9 }, 3), {
|
|
278
|
+
year: 2023,
|
|
279
|
+
month: 10,
|
|
280
|
+
date: 6,
|
|
281
|
+
});
|
|
282
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 10 }, 3), {
|
|
283
|
+
year: 2023,
|
|
284
|
+
month: 10,
|
|
285
|
+
date: 7,
|
|
286
|
+
});
|
|
287
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 10, date: 11 }, 3), {
|
|
288
|
+
year: 2023,
|
|
289
|
+
month: 10,
|
|
290
|
+
date: 8,
|
|
291
|
+
});
|
|
77
292
|
});
|
|
78
293
|
it('works for 3 business days with Christmas Day and New Years observed on a Monday', () => {
|
|
79
|
-
node_assert_1.strict.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
node_assert_1.strict.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
node_assert_1.strict.
|
|
294
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 25 }, 3), {
|
|
295
|
+
year: 2022,
|
|
296
|
+
month: 11,
|
|
297
|
+
date: 21,
|
|
298
|
+
});
|
|
299
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 26 }, 3), {
|
|
300
|
+
year: 2022,
|
|
301
|
+
month: 11,
|
|
302
|
+
date: 21,
|
|
303
|
+
});
|
|
304
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 27 }, 3), {
|
|
305
|
+
year: 2022,
|
|
306
|
+
month: 11,
|
|
307
|
+
date: 21,
|
|
308
|
+
});
|
|
309
|
+
// Since 2022-12-26 is a Federal Reserve Holiday (observed) celebrating Christmas Day
|
|
310
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 28 }, 3), {
|
|
311
|
+
year: 2022,
|
|
312
|
+
month: 11,
|
|
313
|
+
date: 22,
|
|
314
|
+
});
|
|
315
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 29 }, 3), {
|
|
316
|
+
year: 2022,
|
|
317
|
+
month: 11,
|
|
318
|
+
date: 23,
|
|
319
|
+
});
|
|
320
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 30 }, 3), {
|
|
321
|
+
year: 2022,
|
|
322
|
+
month: 11,
|
|
323
|
+
date: 27,
|
|
324
|
+
});
|
|
325
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2022, month: 11, date: 31 }, 3), {
|
|
326
|
+
year: 2022,
|
|
327
|
+
month: 11,
|
|
328
|
+
date: 28,
|
|
329
|
+
});
|
|
330
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 1 }, 3), {
|
|
331
|
+
year: 2022,
|
|
332
|
+
month: 11,
|
|
333
|
+
date: 28,
|
|
334
|
+
});
|
|
335
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 2 }, 3), {
|
|
336
|
+
year: 2022,
|
|
337
|
+
month: 11,
|
|
338
|
+
date: 28,
|
|
339
|
+
});
|
|
340
|
+
// Since 2023-01-02 is a Federal Reserve Holiday (observed) celebrating New Year's Day
|
|
341
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 3 }, 3), {
|
|
342
|
+
year: 2022,
|
|
343
|
+
month: 11,
|
|
344
|
+
date: 28,
|
|
345
|
+
});
|
|
346
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 4 }, 3), {
|
|
347
|
+
year: 2022,
|
|
348
|
+
month: 11,
|
|
349
|
+
date: 29,
|
|
350
|
+
});
|
|
90
351
|
});
|
|
91
352
|
it('works for 3 business days in a leap year', () => {
|
|
92
|
-
node_assert_1.strict.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
node_assert_1.strict.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
353
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 1, date: 26 }, 3), {
|
|
354
|
+
year: 2024,
|
|
355
|
+
month: 1,
|
|
356
|
+
date: 21,
|
|
357
|
+
});
|
|
358
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 1, date: 27 }, 3), {
|
|
359
|
+
year: 2024,
|
|
360
|
+
month: 1,
|
|
361
|
+
date: 22,
|
|
362
|
+
});
|
|
363
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 1, date: 28 }, 3), {
|
|
364
|
+
year: 2024,
|
|
365
|
+
month: 1,
|
|
366
|
+
date: 23,
|
|
367
|
+
});
|
|
368
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 1, date: 29 }, 3), {
|
|
369
|
+
year: 2024,
|
|
370
|
+
month: 1,
|
|
371
|
+
date: 26,
|
|
372
|
+
});
|
|
373
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 2, date: 1 }, 3), {
|
|
374
|
+
year: 2024,
|
|
375
|
+
month: 1,
|
|
376
|
+
date: 27,
|
|
377
|
+
});
|
|
378
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 2, date: 2 }, 3), {
|
|
379
|
+
year: 2024,
|
|
380
|
+
month: 1,
|
|
381
|
+
date: 28,
|
|
382
|
+
});
|
|
383
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 2, date: 3 }, 3), {
|
|
384
|
+
year: 2024,
|
|
385
|
+
month: 1,
|
|
386
|
+
date: 28,
|
|
387
|
+
});
|
|
388
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 2, date: 4 }, 3), {
|
|
389
|
+
year: 2024,
|
|
390
|
+
month: 1,
|
|
391
|
+
date: 28,
|
|
392
|
+
});
|
|
393
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 2, date: 5 }, 3), {
|
|
394
|
+
year: 2024,
|
|
395
|
+
month: 1,
|
|
396
|
+
date: 29,
|
|
397
|
+
});
|
|
398
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2024, month: 2, date: 6 }, 3), {
|
|
399
|
+
year: 2024,
|
|
400
|
+
month: 2,
|
|
401
|
+
date: 1,
|
|
402
|
+
});
|
|
102
403
|
});
|
|
103
404
|
it('works for 3 business days in a leap year when February 29th is a Sunday', () => {
|
|
104
|
-
node_assert_1.strict.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
node_assert_1.strict.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
405
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 1, date: 26 }, 3), {
|
|
406
|
+
year: 2032,
|
|
407
|
+
month: 1,
|
|
408
|
+
date: 23,
|
|
409
|
+
});
|
|
410
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 1, date: 27 }, 3), {
|
|
411
|
+
year: 2032,
|
|
412
|
+
month: 1,
|
|
413
|
+
date: 24,
|
|
414
|
+
});
|
|
415
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 1, date: 28 }, 3), {
|
|
416
|
+
year: 2032,
|
|
417
|
+
month: 1,
|
|
418
|
+
date: 25,
|
|
419
|
+
});
|
|
420
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 1, date: 29 }, 3), {
|
|
421
|
+
year: 2032,
|
|
422
|
+
month: 1,
|
|
423
|
+
date: 25,
|
|
424
|
+
});
|
|
425
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 2, date: 1 }, 3), {
|
|
426
|
+
year: 2032,
|
|
427
|
+
month: 1,
|
|
428
|
+
date: 25,
|
|
429
|
+
});
|
|
430
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 2, date: 2 }, 3), {
|
|
431
|
+
year: 2032,
|
|
432
|
+
month: 1,
|
|
433
|
+
date: 26,
|
|
434
|
+
});
|
|
435
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 2, date: 3 }, 3), {
|
|
436
|
+
year: 2032,
|
|
437
|
+
month: 1,
|
|
438
|
+
date: 27,
|
|
439
|
+
});
|
|
440
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 2, date: 4 }, 3), {
|
|
441
|
+
year: 2032,
|
|
442
|
+
month: 2,
|
|
443
|
+
date: 1,
|
|
444
|
+
});
|
|
445
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 2, date: 5 }, 3), {
|
|
446
|
+
year: 2032,
|
|
447
|
+
month: 2,
|
|
448
|
+
date: 2,
|
|
449
|
+
});
|
|
450
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2032, month: 2, date: 6 }, 3), {
|
|
451
|
+
year: 2032,
|
|
452
|
+
month: 2,
|
|
453
|
+
date: 3,
|
|
454
|
+
});
|
|
114
455
|
});
|
|
115
|
-
it('works for
|
|
456
|
+
it('works for 20 business days every hour with three federal holidays in between', () => {
|
|
116
457
|
// We have 4 Saturdays, 4 Sundays and 3 Federal Reserve Bank holidays (2 observed on a Monday and
|
|
117
458
|
// 1 celebrated on a Monday)
|
|
118
|
-
node_assert_1.strict.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
node_assert_1.strict.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
node_assert_1.strict.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
node_assert_1.strict.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
node_assert_1.strict.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
459
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 23 }, 20), {
|
|
460
|
+
year: 2022,
|
|
461
|
+
month: 11,
|
|
462
|
+
date: 21,
|
|
463
|
+
});
|
|
464
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 24 }, 20), {
|
|
465
|
+
year: 2022,
|
|
466
|
+
month: 11,
|
|
467
|
+
date: 22,
|
|
468
|
+
});
|
|
469
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 25 }, 20), {
|
|
470
|
+
year: 2022,
|
|
471
|
+
month: 11,
|
|
472
|
+
date: 23,
|
|
473
|
+
});
|
|
474
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 26 }, 20), {
|
|
475
|
+
year: 2022,
|
|
476
|
+
month: 11,
|
|
477
|
+
date: 27,
|
|
478
|
+
});
|
|
479
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 27 }, 20), {
|
|
480
|
+
year: 2022,
|
|
481
|
+
month: 11,
|
|
482
|
+
date: 28,
|
|
483
|
+
});
|
|
484
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 28 }, 20), {
|
|
485
|
+
year: 2022,
|
|
486
|
+
month: 11,
|
|
487
|
+
date: 29,
|
|
488
|
+
});
|
|
489
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 29 }, 20), {
|
|
490
|
+
year: 2022,
|
|
491
|
+
month: 11,
|
|
492
|
+
date: 29,
|
|
493
|
+
});
|
|
494
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 30 }, 20), {
|
|
495
|
+
year: 2022,
|
|
496
|
+
month: 11,
|
|
497
|
+
date: 29,
|
|
498
|
+
});
|
|
499
|
+
node_assert_1.strict.deepEqual((0, subtract_federal_reserve_bank_business_days_1.default)({ year: 2023, month: 0, date: 31 }, 20), {
|
|
500
|
+
year: 2022,
|
|
501
|
+
month: 11,
|
|
502
|
+
date: 30,
|
|
503
|
+
});
|
|
143
504
|
});
|
|
144
505
|
});
|
|
145
506
|
//# sourceMappingURL=subtract-federal-reserve-bank-business-days.spec.js.map
|