bizdays-toolkit 0.31.2 → 0.31.4
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/CHANGELOG.md +29 -1
- package/dist/core/calendar.d.ts +3 -2
- package/dist/core/calendar.js +56 -34
- package/dist/core/diagnose.d.ts +4 -15
- package/dist/core/diagnose.js +6 -3
- package/dist/core/errors.d.ts +1 -1
- package/dist/core/input.js +4 -1
- package/dist/core/names.d.ts +5 -0
- package/dist/core/names.js +24 -0
- package/dist/core/schedule.d.ts +6 -6
- package/dist/core/schedule.js +7 -24
- package/dist/provider/index.d.ts +4 -3
- package/dist/provider/index.js +25 -10
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@ Entries from 0.31.0 are in English. Earlier entries remain in Japanese (their **
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.31.4] - 2026-11-10
|
|
10
|
+
|
|
11
|
+
This version fixes calls that threw on days that do not affect their result, makes duplicate holiday providers count once as the design decisions say, and corrects type descriptions, messages and documents. Results of calls that did not throw do not change.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `adjust` with `"modified-following"` or `"modified-preceding"`, and `dueDate`, `closingMonth` and `closingPeriod` that use these conventions, looked at the next (or previous) month before searching the current month, so they threw on a day outside the month that cannot change the result: for example, `adjust("2028-12-30", { convention: "modified-following" })` on an English calendar with `unconfirmedHolidayPolicy: "throw"` threw `unconfirmed-holiday` for 1 January 2029, and on a Japanese calendar closed from 29 December to 3 January the same call for 2099-12-31 threw `out-of-range`; with a small `searchDayLimit`, a call threw `no-business-day` while searching a closed next month although the current month had a business day. They now search the current month first and cross the month only when it has no business day (design decisions 21). Returned dates are unchanged. A call that still throws may now throw a different code (`unconfirmed-holiday`, `out-of-range` or `no-business-day`), because the days are evaluated in a different order
|
|
16
|
+
- A calendar or a schedule given the same holiday provider object more than once (such as `[jp, jp]`) counted it twice, while the design decisions (24) say it is counted once: `providers` listed it twice and the option diagnostics reported the same provider error for each occurrence. Duplicates are now removed; diagnostics keep the position you wrote (`holidayProvider[2]` for the third entry), and when only one provider remains, as with `[jp, jp]`, they use `holidayProvider` as for a single provider. Holidays and business days are unchanged
|
|
17
|
+
- Error messages: `unconfirmed-holiday` said that "the result would depend on a predicted holiday", which is not always true (a search or an nth-business-day rule may look up a predicted holiday that does not change the result); it now says that the evaluation looked up a predicted holiday. The guide lists the days an nth-business-day rule evaluates
|
|
18
|
+
- Type descriptions: `unconfirmedHolidayPolicy` described when it matters with an outdated condition; it now refers to the guide. `ScheduleDayInfo.name` and `holiday` used option names from before 0.30.0. `outOfRangePolicy` and `unconfirmedHolidayPolicy` of `HolidayLookup` now say that a combined calendar shows a summary. `closedRecurringRules` and `recurringRules` listed only some of the rule forms; they now refer to the guide. `renameSubstitute` now says that `names` are kept even when the names are changed, as the design decisions (26) say
|
|
19
|
+
- Documentation: the provider guide and `withSubstituteDays` said only that a substitute day can move into the next year; with `"previous"` it can also move into the previous year, and the provider returns it as part of the year it falls in. The design decisions (2) now explain why the policies of a combined calendar have the closed type of the options
|
|
20
|
+
- Documentation: the type description of `combineCalendars` and the design decisions (18) still described the holidays of a combined calendar as the union of the providers; they now describe the current behaviour (each calendar is asked, and the holiday of the earlier calendar is taken). The design decisions (24) now state that the holidays of several providers given to one calendar are their union, keeping the holiday of the earlier provider on the same date. Results are unchanged
|
|
21
|
+
|
|
22
|
+
## [0.31.3] - 2026-11-09
|
|
23
|
+
|
|
24
|
+
This version fixes results that did not keep what the guide, the type descriptions and the design decisions promise. The results of valid calendars and schedules do not change, except that combined calendars no longer throw on days when none of their calendars throws.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Combined calendars (`combineCalendars`) threw on days when none of their calendars throws: the holidays were looked up in the union of the providers with one policy ("throw" if any calendar throws), so the policy of one calendar was applied to the providers of another. For example, a calendar with `unconfirmedHolidayPolicy: "throw"` and Japanese holidays combined with an English calendar threw `unconfirmed-holiday` in `dayInfoOn` for a predicted English holiday, while `isBusinessDay` returned a result. `dayInfoOn`, `isHoliday`, `holidayOn`, `holidaysInYear` and `holidaysBetween` now ask each calendar and throw only when one of them throws, as the guide says (the holiday shown is still the one of the earlier calendar). The rule is now written in the design decisions (17). Calls that threw now return values; other results are unchanged. When two calendars throw for different reasons on the same day, the code is now the one of the earlier calendar
|
|
29
|
+
- `adjust`, `closingMonth` and `closingPeriod` took an array, a function or a `Date` carrying a `convention` as their options; like `dueDate`, they now take only a plain object and throw `invalid-argument` otherwise (design decisions 8). If you passed such a value, pass a plain object
|
|
30
|
+
- `withSubstituteDays` (`bizdays-toolkit/provider`): `directions` with an explicit `undefined` weekday (such as `{ 0: "next", 6: undefined }`) threw; it is now the same as leaving the weekday out (design decisions 6). `directions` given as a `Map` or an array was taken as empty and added no substitute days; it now throws `invalid-argument`. `directions` with all seven weekdays searched until the end of the supported years and threw `out-of-range`; it now throws `invalid-argument` at once. The `names` of the returned holidays were the input objects; they are now frozen copies, as the type description says. `names` of the input holidays and the `name` and `nameEn` returned by `renameSubstitute` are now checked (`invalid-argument`) instead of being returned as they are
|
|
31
|
+
- A Temporal-like date (`{ year, month, day }`) with a year that is not an integer from 1000 to 9999 threw `out-of-range`, while the same date as a string, and a wrong month or day, threw `invalid-date`. It now throws `invalid-date`; `out-of-range` is left for dates computed from an instant or by date arithmetic outside the years 1000–9999 (design decisions 1). If you branch on `out-of-range` for such input, branch on `invalid-date`
|
|
32
|
+
- Error messages: the `month`, `weekday` and `n` of `bizdays-toolkit/provider`, the `dayOfMonth` of `dueDate` and the `date` of `toInstant` are shown in quotes when they are strings, like the other values (the codes are unchanged)
|
|
33
|
+
- Documentation: the guide said that the separator `t` in date-time strings is part of the `DateTimeInput` type; the type has only the upper-case `T`, and a lower-case `t` is accepted at run time (the `time` returned by `civilOf` is then typed `string | null`). The guide now also says that the policies of a combined calendar are a summary and that it throws only when one of its calendars throws
|
|
34
|
+
|
|
9
35
|
## [0.31.2] - 2026-11-09
|
|
10
36
|
|
|
11
37
|
This version fixes results that were not consistent between functions or did not match the type descriptions, and corrects the documentation. The results of valid calendars and schedules do not change.
|
|
@@ -872,7 +898,9 @@ This version rebuilds the `redundant` diagnostic so that the reported rules can
|
|
|
872
898
|
|
|
873
899
|
- 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
|
|
874
900
|
|
|
875
|
-
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.
|
|
901
|
+
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.4...HEAD
|
|
902
|
+
[0.31.4]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.3...v0.31.4
|
|
903
|
+
[0.31.3]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.2...v0.31.3
|
|
876
904
|
[0.31.2]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.1...v0.31.2
|
|
877
905
|
[0.31.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.0...v0.31.1
|
|
878
906
|
[0.31.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.9...v0.31.0
|
package/dist/core/calendar.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface CalendarOptions<Kind extends string = string> extends HolidaySo
|
|
|
64
64
|
/** 臨時営業日(ほかのすべての規則より優先) */
|
|
65
65
|
readonly openDates?: readonly (SpecificDate | DateRange)[];
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* 繰り返しの休業日。書ける規則の形はガイドの「Recurring rules」の表(曜日・周期・月の日・第 n 営業日・祝日・祝日の前後など)。
|
|
68
68
|
* 祝日に当たったときの扱いは規則ごとに holidayOverlapPolicy で指定する(既定: "under-holiday")。
|
|
69
69
|
* 有効期間(effectiveFrom・effectiveTo)を付けると、期間の外では書かれていないのと同じに扱う
|
|
70
70
|
*/
|
|
@@ -290,7 +290,8 @@ export declare function createCalendar<Kind extends string = string>(options?: C
|
|
|
290
290
|
*
|
|
291
291
|
* - dayInfoOn の reason・name・shiftedFrom・optionPath は、合成結果と同じ判定をした最初のカレンダーの結果で、
|
|
292
292
|
* その番号を decidedBy で返す。入れ子の合成では、内側の番号まで含めた列を decidedByPath で返す。
|
|
293
|
-
* holiday・isHoliday
|
|
293
|
+
* holiday・isHoliday・holidaysInYear などは、すべてのカレンダーの同じ参照を呼び、日付ごとに先のカレンダー
|
|
294
|
+
* (その中では先の提供元)の祝日を採る。方針は各カレンダーのもので、どれかのカレンダーが投げる日だけ投げる
|
|
294
295
|
* - タイムゾーンはすべてのカレンダーで同じでなければならない(time-zone-conflict)。
|
|
295
296
|
* 2 つ未満、同じカレンダーを 2 回渡した場合は invalid-argument
|
|
296
297
|
* - 合成したカレンダーをさらに合成することもできる。規則の診断(diagnoseCalendar)の対象にはならないので、
|
package/dist/core/calendar.js
CHANGED
|
@@ -133,9 +133,12 @@ function buildCalendar(lookup, isOpen, info, searchDayLimit) {
|
|
|
133
133
|
return date;
|
|
134
134
|
}
|
|
135
135
|
throw open
|
|
136
|
-
?
|
|
136
|
+
? noBusinessDay(start)
|
|
137
137
|
: rangeError("no-closed-day", `No closed day found within ${searchDayLimit} days from ${start}`);
|
|
138
138
|
}
|
|
139
|
+
function noBusinessDay(start) {
|
|
140
|
+
return rangeError("no-business-day", `No business day found within ${searchDayLimit} days from ${start}`);
|
|
141
|
+
}
|
|
139
142
|
function countOpen(from, toExclusive) {
|
|
140
143
|
let count = 0;
|
|
141
144
|
for (let n = from; n < toExclusive; n++)
|
|
@@ -169,32 +172,28 @@ function buildCalendar(lookup, isOpen, info, searchDayLimit) {
|
|
|
169
172
|
}
|
|
170
173
|
if (isOpen(date))
|
|
171
174
|
return date;
|
|
172
|
-
const month = date.slice(0, 7);
|
|
173
175
|
switch (convention) {
|
|
174
176
|
case "following":
|
|
175
177
|
return search(date, 1);
|
|
176
178
|
case "preceding":
|
|
177
179
|
return search(date, -1);
|
|
178
|
-
case "modified-following":
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const previous = searchWithin(date, -1, month);
|
|
183
|
-
return previous ?? next;
|
|
184
|
-
}
|
|
185
|
-
case "modified-preceding": {
|
|
186
|
-
const previous = search(date, -1);
|
|
187
|
-
if (previous.startsWith(month))
|
|
188
|
-
return previous;
|
|
189
|
-
const next = searchWithin(date, 1, month);
|
|
190
|
-
return next ?? previous;
|
|
191
|
-
}
|
|
180
|
+
case "modified-following":
|
|
181
|
+
return searchInMonth(date, 1, true) ?? searchInMonth(date, -1, false) ?? search(date, 1);
|
|
182
|
+
case "modified-preceding":
|
|
183
|
+
return searchInMonth(date, -1, true) ?? searchInMonth(date, 1, false) ?? search(date, -1);
|
|
192
184
|
default:
|
|
193
185
|
throw rangeError("invalid-argument", `Unknown convention: ${String(convention)}`);
|
|
194
186
|
}
|
|
195
187
|
}
|
|
196
|
-
function
|
|
197
|
-
|
|
188
|
+
function searchInMonth(start, step, limited) {
|
|
189
|
+
const { year, month } = parseMonth(start.slice(0, 7));
|
|
190
|
+
const first = toDayNumber(formatDate(year, month, 1));
|
|
191
|
+
const last = first + lengthOfMonth(year, month) - 1;
|
|
192
|
+
let n = toDayNumber(start);
|
|
193
|
+
for (let i = 0; n >= first && n <= last; i++, n += step) {
|
|
194
|
+
if (limited && i >= searchDayLimit)
|
|
195
|
+
throw noBusinessDay(start);
|
|
196
|
+
const date = fromDayNumber(n);
|
|
198
197
|
if (isOpen(date))
|
|
199
198
|
return date;
|
|
200
199
|
}
|
|
@@ -290,13 +289,18 @@ function buildCalendar(lookup, isOpen, info, searchDayLimit) {
|
|
|
290
289
|
}
|
|
291
290
|
return Object.freeze(result);
|
|
292
291
|
},
|
|
293
|
-
adjust: (input, options) => adjustDate(dateOf(input), options),
|
|
292
|
+
adjust: (input, options) => adjustDate(dateOf(input), adjustOptions(options, "adjust options")),
|
|
294
293
|
nthBusinessDayOfMonth: nthOfMonth,
|
|
295
294
|
firstBusinessDayOfMonth: (month) => nthOfMonth(month, 1),
|
|
296
295
|
lastBusinessDayOfMonth: (month) => nthOfMonth(month, -1),
|
|
297
|
-
closingMonth
|
|
298
|
-
closingPeriod(input, closingDayOfMonth, options) {
|
|
296
|
+
closingMonth(input, closingDayOfMonth, rawOptions) {
|
|
299
297
|
checkClosingDay(closingDayOfMonth);
|
|
298
|
+
const options = adjustOptions(rawOptions, "closingMonth options");
|
|
299
|
+
return formatMonth(closingMonthOf(dateOf(input), closingDayOfMonth, options));
|
|
300
|
+
},
|
|
301
|
+
closingPeriod(input, closingDayOfMonth, rawOptions) {
|
|
302
|
+
checkClosingDay(closingDayOfMonth);
|
|
303
|
+
const options = adjustOptions(rawOptions, "closingPeriod options");
|
|
300
304
|
const isMonth = typeof input === "string" && /^\d{4}-\d{2}$/.test(input);
|
|
301
305
|
const month = isMonth
|
|
302
306
|
? parseMonth(input)
|
|
@@ -312,7 +316,7 @@ function buildCalendar(lookup, isOpen, info, searchDayLimit) {
|
|
|
312
316
|
const o = optionsObject(options, "dueDate options", (v) => renameKeys("throw", ["dueDate"], "", v), true);
|
|
313
317
|
const day = o["dayOfMonth"];
|
|
314
318
|
if (!isDayOfMonthValue(day)) {
|
|
315
|
-
throw rangeError("invalid-argument", `dayOfMonth must be an integer from 1 to 31, or -1 (last day): ${
|
|
319
|
+
throw rangeError("invalid-argument", `dayOfMonth must be an integer from 1 to 31, or -1 (last day): ${describeValue(day)}`);
|
|
316
320
|
}
|
|
317
321
|
return adjustDate(dayOfMonth(parseMonth(month), day), o);
|
|
318
322
|
},
|
|
@@ -329,6 +333,7 @@ function optionsObject(options, what, rename = (v) => v, required = false, code
|
|
|
329
333
|
}
|
|
330
334
|
return withoutUndefined(rename(options));
|
|
331
335
|
}
|
|
336
|
+
const adjustOptions = (options, what) => optionsObject(options, what, undefined, true);
|
|
332
337
|
const isCalendarLike = (v) => typeof v === "object" &&
|
|
333
338
|
v !== null &&
|
|
334
339
|
typeof v.dayInfoOn === "function" &&
|
|
@@ -364,7 +369,7 @@ export function combineCalendars(calendars, options) {
|
|
|
364
369
|
for (const p of c.providers)
|
|
365
370
|
if (!providers.includes(p))
|
|
366
371
|
providers.push(p);
|
|
367
|
-
const
|
|
372
|
+
const base = createHolidayLookup({
|
|
368
373
|
providers: Object.freeze(providers),
|
|
369
374
|
timeZone: zones[0],
|
|
370
375
|
outOfRangePolicy: calendars.every((c) => c.outOfRangePolicy === "ignore") ? "ignore" : "throw",
|
|
@@ -372,6 +377,23 @@ export function combineCalendars(calendars, options) {
|
|
|
372
377
|
? "throw"
|
|
373
378
|
: "accept",
|
|
374
379
|
});
|
|
380
|
+
const merge = (lists) => {
|
|
381
|
+
const byDate = new Map();
|
|
382
|
+
for (const list of lists)
|
|
383
|
+
for (const h of list)
|
|
384
|
+
if (!byDate.has(h.date))
|
|
385
|
+
byDate.set(h.date, h);
|
|
386
|
+
return Object.freeze([...byDate.values()].sort((a, b) => (a.date < b.date ? -1 : a.date > b.date ? 1 : 0)));
|
|
387
|
+
};
|
|
388
|
+
const holidayOn = (input) => calendars.map((c) => c.holidayOn(input)).find((h) => h !== undefined);
|
|
389
|
+
const lookup = {
|
|
390
|
+
...base,
|
|
391
|
+
isHoliday: (input) => holidayOn(input) !== undefined,
|
|
392
|
+
holidayOn,
|
|
393
|
+
getHoliday: holidayOn,
|
|
394
|
+
holidaysInYear: (year) => merge(calendars.map((c) => c.holidaysInYear(year))),
|
|
395
|
+
holidaysBetween: (from, to) => merge(calendars.map((c) => c.holidaysBetween(from, to))),
|
|
396
|
+
};
|
|
375
397
|
const isOpen = (date) => {
|
|
376
398
|
const results = calendars.map((c) => c.isBusinessDay(date));
|
|
377
399
|
return mode === "all" ? results.every(Boolean) : results.some(Boolean);
|
|
@@ -380,25 +402,25 @@ export function combineCalendars(calendars, options) {
|
|
|
380
402
|
const results = calendars.map((c) => c.dayInfoOn(date));
|
|
381
403
|
const open = mode === "all" ? results.every((r) => r.open) : results.some((r) => r.open);
|
|
382
404
|
const decidedBy = results.findIndex((r) => r.open === open);
|
|
383
|
-
const
|
|
405
|
+
const decided = results[decidedBy];
|
|
384
406
|
const result = {
|
|
385
407
|
date,
|
|
386
|
-
weekday:
|
|
408
|
+
weekday: decided.weekday,
|
|
387
409
|
open,
|
|
388
410
|
businessDay: open,
|
|
389
|
-
reason:
|
|
411
|
+
reason: decided.reason,
|
|
390
412
|
};
|
|
391
|
-
if (
|
|
392
|
-
result.name =
|
|
393
|
-
const holiday =
|
|
413
|
+
if (decided.name !== undefined)
|
|
414
|
+
result.name = decided.name;
|
|
415
|
+
const holiday = results.find((r) => r.holiday !== undefined)?.holiday;
|
|
394
416
|
if (holiday !== undefined)
|
|
395
417
|
result.holiday = holiday;
|
|
396
|
-
if (
|
|
397
|
-
result.shiftedFrom =
|
|
398
|
-
if (
|
|
399
|
-
result.optionPath = result.rulePath =
|
|
418
|
+
if (decided.shiftedFrom !== undefined)
|
|
419
|
+
result.shiftedFrom = decided.shiftedFrom;
|
|
420
|
+
if (decided.optionPath !== undefined)
|
|
421
|
+
result.optionPath = result.rulePath = decided.optionPath;
|
|
400
422
|
result.decidedBy = decidedBy;
|
|
401
|
-
result.decidedByPath = Object.freeze([decidedBy, ...(
|
|
423
|
+
result.decidedByPath = Object.freeze([decidedBy, ...(decided.decidedByPath ?? [])]);
|
|
402
424
|
return Object.freeze(result);
|
|
403
425
|
}
|
|
404
426
|
return buildCalendar(lookup, isOpen, info, searchDayLimit);
|
package/dist/core/diagnose.d.ts
CHANGED
|
@@ -4,25 +4,14 @@
|
|
|
4
4
|
* 設定を作るときと同じ検証(IssueCollector)で誤りと知らないキーを集め、誤りがなければ
|
|
5
5
|
* 規則どうしの関係を調べる。例外は投げず、見つけた問題を配列で返す。
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* shadowed … 同じ種類の先の規則に完全に覆われ、決して使われない(relatedPath に先の規則)
|
|
11
|
-
* never-matches … 当てはまる日がない繰り返しの規則(2 月 30 日、有効期間の中に第 5 水曜日がない、提供元のない設定の祝日の翌日・祝前日、など)
|
|
12
|
-
* out-of-range … 個別の日付、または規則の有効期間が祝日の提供元の対応年の外にある(relatedPath に提供元)
|
|
13
|
-
* no-business-day … 営業日が 1 日もない設定(営業日カレンダーのみ)
|
|
14
|
-
* - info … redundant: 取り除いても結果が変わらない規則・設定(判定に祝日を使わない設定の unconfirmedHolidayPolicy: "throw" を含む)。
|
|
15
|
-
* 出た規則はまとめて取り除ける(逐次除去。relatedPath に代わりに決める規則、1 つに定まるときだけ。decisions.md の 31 番)
|
|
16
|
-
* expired: 第 2 引数の asOf より前に終わった規則・日付(asOf を渡したときだけ)
|
|
17
|
-
* counting-basis: 第 n 営業日の規則(businessDayOfMonth・businessDayOfWeek)の数える基準は繰り返しの規則を除くので、
|
|
18
|
-
* 同じ設定の毎週の曜日の規則({ weekday })の曜日は営業日として数えられる(relatedPath にその規則)。
|
|
19
|
-
* 有効期間が重なり、使われている曜日の規則ごとに 1 件
|
|
7
|
+
* 重さは error(createCalendar・createSchedule で例外になる誤り。code は例外と同じ)・warning(作れるが、意図と違う可能性が
|
|
8
|
+
* 高いもの)・info(知らせ)の 3 つ。診断のコードと重さの一覧はガイドの診断の表(docs/guide.md の「Option diagnostics」)、
|
|
9
|
+
* redundant の逐次除去と relatedPath は decisions.md の 31 番
|
|
20
10
|
*
|
|
21
11
|
* 未確定の祝日の扱い(unconfirmedHolidayPolicy)は診断では常に "accept" で評価する。診断は設定の形を調べるもので、
|
|
22
12
|
* 祝日が確定しているかどうかは関係がなく、"throw" のまま評価すると例外を握りつぶして「当てはまらない」と誤判定するため
|
|
23
13
|
*
|
|
24
|
-
*
|
|
25
|
-
* 固定なので、shadowed は同じ種類の規則どうしに限って調べる。種類をまたいで使われない規則は
|
|
14
|
+
* 判定の順番は固定(decisions.md の 11 番)なので、shadowed は同じ種類の規則どうしに限って調べる。種類をまたいで使われない規則は
|
|
26
15
|
* redundant(取り除いても結果が変わらない)として見つかる。
|
|
27
16
|
* 有効期間(effectiveFrom・effectiveTo)のある規則は期間の包含も、周期(interval・cycle)のある規則は周期の包含も
|
|
28
17
|
* shadowed の条件にする。redundant の走査の範囲は、周期がそろう長さと、範囲の外にある有効期間まで広げる
|
package/dist/core/diagnose.js
CHANGED
|
@@ -225,10 +225,13 @@ function without(compiled, rule, dropDates) {
|
|
|
225
225
|
recurring: compiled.recurring.filter((r) => r !== rule),
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
+
const providerPath = (source, i) => source.providers.length === 1
|
|
229
|
+
? "holidayProvider"
|
|
230
|
+
: `holidayProvider[${source.providerIndexes?.[i] ?? i}]`;
|
|
228
231
|
function checkProviderData(c, source) {
|
|
229
232
|
let ok = true;
|
|
230
233
|
source.providers.forEach((provider, i) => {
|
|
231
|
-
const path = source
|
|
234
|
+
const path = providerPath(source, i);
|
|
232
235
|
const lookup = createHolidayLookup({
|
|
233
236
|
...source,
|
|
234
237
|
providers: [provider],
|
|
@@ -405,7 +408,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
405
408
|
const { from, to } = p.supportedYears;
|
|
406
409
|
if (fromYear >= from && toYear <= to)
|
|
407
410
|
return;
|
|
408
|
-
const related = source
|
|
411
|
+
const related = providerPath(source, i);
|
|
409
412
|
c.warning("out-of-range", rule.path, `The date is outside the years supported by holiday provider ${p.id} (${from}-${to}); ` +
|
|
410
413
|
(source.outOfRangePolicy === "throw"
|
|
411
414
|
? "looking up this date throws"
|
|
@@ -431,7 +434,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
431
434
|
c.warning("out-of-range", rule.path, `The effective period is outside the years supported by holiday provider ${p.id} (${from}-${to}); ` +
|
|
432
435
|
(source.outOfRangePolicy === "throw"
|
|
433
436
|
? "looking up these dates throws, so this rule is never used"
|
|
434
|
-
: "holidays are not considered for these dates"), source
|
|
437
|
+
: "holidays are not considered for these dates"), providerPath(source, i));
|
|
435
438
|
});
|
|
436
439
|
}
|
|
437
440
|
const annualMatches = annual.map(annualBits);
|
package/dist/core/errors.d.ts
CHANGED
package/dist/core/input.js
CHANGED
|
@@ -103,6 +103,9 @@ export function toCivil(input, timeZone) {
|
|
|
103
103
|
if (input.calendarId !== undefined && input.calendarId !== "iso8601") {
|
|
104
104
|
throw rangeError("invalid-input", `Unsupported calendar: ${input.calendarId} (only iso8601)`);
|
|
105
105
|
}
|
|
106
|
+
if (!Number.isInteger(input.year) || input.year < 1000 || input.year > 9999) {
|
|
107
|
+
throw rangeError("invalid-date", `Invalid date: year must be an integer from 1000 to 9999: ${describeValue(input.year)}`);
|
|
108
|
+
}
|
|
106
109
|
const date = formatDate(input.year, input.month, input.day);
|
|
107
110
|
if (typeof input.hour === "number") {
|
|
108
111
|
return { date, minutes: wallTime(input.hour, input.minute ?? 0) };
|
|
@@ -152,7 +155,7 @@ export function parseTimeOfDaySeconds(value) {
|
|
|
152
155
|
export function toInstant(date, time, timeZone) {
|
|
153
156
|
const zone = validateTimeZone(timeZone);
|
|
154
157
|
if (typeof date !== "string")
|
|
155
|
-
throw rangeError("invalid-date", `Invalid date: ${
|
|
158
|
+
throw rangeError("invalid-date", `Invalid date: ${describeValue(date)}`);
|
|
156
159
|
parseDate(date);
|
|
157
160
|
const seconds = parseTimeOfDaySeconds(time);
|
|
158
161
|
const ms = civilToInstant(date, Math.floor(seconds / 60), zone) + (seconds % 60) * 1000;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describeValue } from "./errors.js";
|
|
2
|
+
export function checkNames(names) {
|
|
3
|
+
const isObject = typeof names === "object" && names !== null && !Array.isArray(names);
|
|
4
|
+
const proto = isObject ? Object.getPrototypeOf(names) : undefined;
|
|
5
|
+
if (!isObject || (proto !== null && Object.getPrototypeOf(proto) !== null)) {
|
|
6
|
+
return "must be a plain object of { [language tag]: name }";
|
|
7
|
+
}
|
|
8
|
+
for (const [tag, value] of Object.entries(names)) {
|
|
9
|
+
let canonical;
|
|
10
|
+
try {
|
|
11
|
+
canonical = Intl.getCanonicalLocales(tag)[0];
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return `${describeValue(tag)} is not a BCP 47 language tag`;
|
|
15
|
+
}
|
|
16
|
+
if (canonical !== tag) {
|
|
17
|
+
return `${describeValue(tag)} must be written in canonical form ${describeValue(canonical)}`;
|
|
18
|
+
}
|
|
19
|
+
if (typeof value !== "string" || value === "") {
|
|
20
|
+
return `${describeValue(tag)} must be a non-empty string`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
package/dist/core/schedule.d.ts
CHANGED
|
@@ -465,7 +465,7 @@ export interface HolidaySourceOptions<Kind extends string = string> {
|
|
|
465
465
|
* "throw" にすると、dayInfoOn・isBusinessDay に限らず、営業日の探索・調整・期日の計算の途中で評価した日や、祝日の翌日・祝前日の
|
|
466
466
|
* 規則が見る隣の日を含め、祝日を引いた日が未確定の祝日なら unconfirmed-holiday の RangeError を投げる。
|
|
467
467
|
* holidaysInYear・holidaysBetween は投げないので、影響する日の列挙に使える。
|
|
468
|
-
*
|
|
468
|
+
* 判定が祝日に依存する設定でだけ意味がある(条件はガイドの「Unconfirmed holidays」。decisions.md の 17 番)
|
|
469
469
|
*/
|
|
470
470
|
readonly unconfirmedHolidayPolicy?: "accept" | "throw";
|
|
471
471
|
}
|
|
@@ -478,7 +478,7 @@ export interface ScheduleOptions<Value, Kind extends string = string> extends Ho
|
|
|
478
478
|
readonly weekdayValues: readonly [Value, Value, Value, Value, Value, Value, Value];
|
|
479
479
|
/** 祝日の値の決め方(既定: "ignore") */
|
|
480
480
|
readonly holidayPolicy?: ScheduleHolidayPolicy<Value>;
|
|
481
|
-
/**
|
|
481
|
+
/** 繰り返しの規則の値(書ける規則の形はガイドの「Recurring rules」の表) */
|
|
482
482
|
readonly recurringRules?: readonly ScheduleRecurringRule<Value, Kind>[];
|
|
483
483
|
/** 毎年の月日の値 */
|
|
484
484
|
readonly annualDates?: readonly (ScheduleAnnualDate<Value> | ScheduleAnnualRange<Value>)[];
|
|
@@ -512,9 +512,9 @@ export interface ScheduleDayInfo<Value, Kind extends string = string> {
|
|
|
512
512
|
readonly value: Value;
|
|
513
513
|
/** 値を決めた規則 */
|
|
514
514
|
readonly reason: ScheduleDayReason;
|
|
515
|
-
/** 値を決めた規則の名前(dates・
|
|
515
|
+
/** 値を決めた規則の名前(dates・annualDates・recurringRules の name、祝日なら祝日名) */
|
|
516
516
|
readonly name?: string;
|
|
517
|
-
/** その日が祝日なら祝日(
|
|
517
|
+
/** その日が祝日なら祝日(holidayPolicy に関係なく付く) */
|
|
518
518
|
readonly holiday?: Holiday<Kind>;
|
|
519
519
|
/** 祝日から振り替えられた規則で値が決まった場合、振替の元の日付(holidayOverlapPolicy: "after-holiday") */
|
|
520
520
|
readonly shiftedFrom?: DateString;
|
|
@@ -536,9 +536,9 @@ export interface HolidayLookup<Kind extends string = string> {
|
|
|
536
536
|
readonly timeZone: string;
|
|
537
537
|
/** 祝日の提供元 */
|
|
538
538
|
readonly providers: readonly HolidayProvider<Kind>[];
|
|
539
|
-
/**
|
|
539
|
+
/** 祝日の提供元の対応年を外れた日付の扱い(設定の値。合成したカレンダーでは構成カレンダーの要約で、どれかが "throw" なら "throw"。decisions.md の 17 番) */
|
|
540
540
|
readonly outOfRangePolicy: "throw" | "ignore";
|
|
541
|
-
/**
|
|
541
|
+
/** 未確定の祝日に触れたときの扱い(設定の値。合成したカレンダーでは構成カレンダーの要約で、どれかが "throw" なら "throw"。decisions.md の 17 番) */
|
|
542
542
|
readonly unconfirmedHolidayPolicy: "accept" | "throw";
|
|
543
543
|
/** @deprecated 0.30.0 で outOfRangePolicy に改名した(同じ値)。1.0.0 で削除する */
|
|
544
544
|
readonly outOfRange: "throw" | "ignore";
|
package/dist/core/schedule.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { addDays, lengthOfMonth, formatDate, fromDayNumber, isValidDate, parseDate, toDayNumber, weekdayOf, } from "./date.js";
|
|
2
2
|
import { checkUnknownKeys, describeValue, IssueCollector, rangeError, withoutUndefined, } from "./errors.js";
|
|
3
3
|
import { isOptionsObject } from "./options.js";
|
|
4
|
+
import { checkNames } from "./names.js";
|
|
4
5
|
import { RENAMED_VALUES, renameKeys, renameValue, writtenKey } from "./renamed.js";
|
|
5
6
|
import { instantToCivil, isDate, toCivil, toDateTimeParts, toInstant, validateTimeZone, } from "./input.js";
|
|
6
7
|
import { HOLIDAY_KEY_PATTERN } from "./types.js";
|
|
@@ -706,10 +707,13 @@ export function compileHolidaySource(c, options) {
|
|
|
706
707
|
const raw = options["holidayProvider"];
|
|
707
708
|
const list = raw === undefined ? [] : Array.isArray(raw) ? raw : [raw];
|
|
708
709
|
const providers = [];
|
|
710
|
+
const providerIndexes = [];
|
|
709
711
|
list.forEach((p, i) => {
|
|
710
712
|
const path = Array.isArray(raw) ? `holidayProvider[${i}]` : "holidayProvider";
|
|
711
|
-
if (validateProvider(c, path, p))
|
|
713
|
+
if (validateProvider(c, path, p) && !providers.includes(p)) {
|
|
712
714
|
providers.push(p);
|
|
715
|
+
providerIndexes.push(i);
|
|
716
|
+
}
|
|
713
717
|
});
|
|
714
718
|
let timeZone = "UTC";
|
|
715
719
|
if (options["timeZone"] !== undefined) {
|
|
@@ -737,6 +741,7 @@ export function compileHolidaySource(c, options) {
|
|
|
737
741
|
}
|
|
738
742
|
return {
|
|
739
743
|
providers: Object.freeze(providers),
|
|
744
|
+
providerIndexes: Object.freeze(providerIndexes),
|
|
740
745
|
timeZone,
|
|
741
746
|
outOfRangePolicy: outOfRangePolicy === "ignore" ? "ignore" : "throw",
|
|
742
747
|
unconfirmedHolidayPolicy: unconfirmed === "throw" ? "throw" : "accept",
|
|
@@ -788,28 +793,6 @@ function loadProviderYear(provider, year) {
|
|
|
788
793
|
return Object.freeze(holiday);
|
|
789
794
|
});
|
|
790
795
|
}
|
|
791
|
-
function checkNames(names) {
|
|
792
|
-
const proto = isObject(names) ? Object.getPrototypeOf(names) : undefined;
|
|
793
|
-
if (!isObject(names) || (proto !== null && Object.getPrototypeOf(proto) !== null)) {
|
|
794
|
-
return "must be a plain object of { [language tag]: name }";
|
|
795
|
-
}
|
|
796
|
-
for (const [tag, value] of Object.entries(names)) {
|
|
797
|
-
let canonical;
|
|
798
|
-
try {
|
|
799
|
-
canonical = Intl.getCanonicalLocales(tag)[0];
|
|
800
|
-
}
|
|
801
|
-
catch {
|
|
802
|
-
return `${describeValue(tag)} is not a BCP 47 language tag`;
|
|
803
|
-
}
|
|
804
|
-
if (canonical !== tag) {
|
|
805
|
-
return `${describeValue(tag)} must be written in canonical form ${describeValue(canonical)}`;
|
|
806
|
-
}
|
|
807
|
-
if (typeof value !== "string" || value === "") {
|
|
808
|
-
return `${describeValue(tag)} must be a non-empty string`;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
return undefined;
|
|
812
|
-
}
|
|
813
796
|
export function createHolidayLookup(source) {
|
|
814
797
|
const { providers, timeZone, outOfRangePolicy, unconfirmedHolidayPolicy } = source;
|
|
815
798
|
const yearCache = new Map();
|
|
@@ -854,7 +837,7 @@ export function createHolidayLookup(source) {
|
|
|
854
837
|
const through = provider?.confirmedThrough === undefined
|
|
855
838
|
? ""
|
|
856
839
|
: ` (${provider.id} is confirmed through ${provider.confirmedThrough})`;
|
|
857
|
-
throw rangeError("unconfirmed-holiday", `${date} ${h.name} is not yet confirmed${through};
|
|
840
|
+
throw rangeError("unconfirmed-holiday", `${date} ${h.name} is not yet confirmed${through}; this evaluation looked up a predicted holiday`);
|
|
858
841
|
}
|
|
859
842
|
return h;
|
|
860
843
|
}
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -54,7 +54,8 @@ export interface WithSubstituteDaysOptions<Kind extends string> {
|
|
|
54
54
|
/** 振替日に付ける種別(Holiday.kind。例: "substitute"、"observed") */
|
|
55
55
|
readonly kind: Kind;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* 振替日の名称(name・nameEn)。省略時は元の祝日のものを引き継ぐ(GOV.UK・MOM の流儀)。names は、名称を変えたときも
|
|
58
|
+
* 元の祝日のものを引き継ぐ(decisions.md の 26 番)。
|
|
58
59
|
* 変えるなら元の祝日を受け取って返す関数で(例: 日本の「振替休日」、米国の "(observed)")
|
|
59
60
|
*/
|
|
60
61
|
readonly renameSubstitute?: (holiday: Holiday<Kind>) => {
|
|
@@ -83,8 +84,8 @@ export interface WithSubstituteDaysOptions<Kind extends string> {
|
|
|
83
84
|
* 振替日は元の祝日の key・names・confirmed を引き継ぎ、kind は options.kind、名称は省略時は元の祝日のもの。
|
|
84
85
|
*
|
|
85
86
|
* 入力は同じ年の祝日で、日付が有効・重複がないこと(誤りは invalid-argument・invalid-date・invalid-weekday の例外)。
|
|
86
|
-
*
|
|
87
|
-
*
|
|
87
|
+
* 振替日は前後の年に移ることがある(日曜日の 12 月 31 日の振替は翌年の 1 月 1 日、"previous" で土曜日の 1 月 1 日の振替は
|
|
88
|
+
* 前年の 12 月 31 日)。提供元の holidaysInYear はその年の日付だけを返す契約なので、振替日はその日が属する年の分として返すこと。
|
|
88
89
|
* 国民の休日(2 つの祝日に挟まれた日)のような国に固有の規則は含まない。
|
|
89
90
|
* 返す祝日はどれも凍結している(入力のまま返す祝日も、契約の項目だけを持つ複製)。
|
|
90
91
|
*
|
package/dist/provider/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { addDays, lengthOfMonth as daysInMonthOf, easterSunday as easterSundayOf, formatDate, isLeapYear as isLeapYearOf, isValidDate, nthWeekdayOfMonth as nthWeekdayOfMonthIn, parseDate, weekdayOf, } from "../core/date.js";
|
|
2
2
|
import { renameKeys } from "../core/renamed.js";
|
|
3
3
|
import { describeValue, rangeError } from "../core/errors.js";
|
|
4
|
+
import { checkNames } from "../core/names.js";
|
|
4
5
|
import { isOptionsObject } from "../core/options.js";
|
|
5
6
|
import { HOLIDAY_KEY_PATTERN } from "../core/types.js";
|
|
6
7
|
function checkYear(year) {
|
|
@@ -10,7 +11,7 @@ function checkYear(year) {
|
|
|
10
11
|
}
|
|
11
12
|
function checkMonth(month) {
|
|
12
13
|
if (!Number.isInteger(month) || month < 1 || month > 12) {
|
|
13
|
-
throw rangeError("invalid-argument", `month must be an integer from 1 to 12: ${
|
|
14
|
+
throw rangeError("invalid-argument", `month must be an integer from 1 to 12: ${describeValue(month)}`);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
export function easterSunday(year) {
|
|
@@ -21,10 +22,10 @@ export function nthWeekdayOfMonth(year, month, weekday, n) {
|
|
|
21
22
|
checkYear(year);
|
|
22
23
|
checkMonth(month);
|
|
23
24
|
if (!Number.isInteger(weekday) || weekday < 0 || weekday > 6) {
|
|
24
|
-
throw rangeError("invalid-weekday", `weekday must be an integer from 0 (Sunday) to 6 (Saturday): ${
|
|
25
|
+
throw rangeError("invalid-weekday", `weekday must be an integer from 0 (Sunday) to 6 (Saturday): ${describeValue(weekday)}`);
|
|
25
26
|
}
|
|
26
27
|
if (!Number.isInteger(n) || n === 0 || n < -1 || n > 5) {
|
|
27
|
-
throw rangeError("invalid-argument", `n must be an integer from 1 to 5, or -1 (last): ${
|
|
28
|
+
throw rangeError("invalid-argument", `n must be an integer from 1 to 5, or -1 (last): ${describeValue(n)}`);
|
|
28
29
|
}
|
|
29
30
|
const days = daysInMonthOf(year, month);
|
|
30
31
|
if (n === -1) {
|
|
@@ -57,7 +58,7 @@ function checkHolidays(holidays) {
|
|
|
57
58
|
if (typeof h !== "object" || h === null) {
|
|
58
59
|
throw rangeError("invalid-argument", `holidays[${i}] is not an object`);
|
|
59
60
|
}
|
|
60
|
-
const { date, name, nameEn, kind, confirmed, key } = h;
|
|
61
|
+
const { date, name, nameEn, kind, confirmed, key, names } = h;
|
|
61
62
|
if (!isValidDate(date)) {
|
|
62
63
|
throw rangeError("invalid-date", `holidays[${i}] has an invalid date ${describeValue(date)}`);
|
|
63
64
|
}
|
|
@@ -79,6 +80,9 @@ function checkHolidays(holidays) {
|
|
|
79
80
|
if (key !== undefined && (typeof key !== "string" || !HOLIDAY_KEY_PATTERN.test(key))) {
|
|
80
81
|
throw rangeError("invalid-argument", `holidays[${i}] (${date}) key must match ${String(HOLIDAY_KEY_PATTERN)}: ${describeValue(key)}`);
|
|
81
82
|
}
|
|
83
|
+
const problem = names === undefined ? undefined : checkNames(names);
|
|
84
|
+
if (problem !== undefined)
|
|
85
|
+
throw rangeError("invalid-argument", `holidays[${i}] (${date}) names: ${problem}`);
|
|
82
86
|
});
|
|
83
87
|
return holidays;
|
|
84
88
|
}
|
|
@@ -88,10 +92,11 @@ function checkOptions(options) {
|
|
|
88
92
|
}
|
|
89
93
|
const o = renameKeys("throw", ["substitute"], "options", options);
|
|
90
94
|
const { directions: rules, kind, renameSubstitute: name, originalPolicy: original } = o;
|
|
91
|
-
if (
|
|
92
|
-
throw rangeError("invalid-argument",
|
|
95
|
+
if (!isOptionsObject(rules)) {
|
|
96
|
+
throw rangeError("invalid-argument", `options.directions must be an object of { [weekday]: "next" | "previous" }: ${describeValue(rules)}`);
|
|
93
97
|
}
|
|
94
|
-
|
|
98
|
+
const entries = Object.entries(rules).filter(([, direction]) => direction !== undefined);
|
|
99
|
+
for (const [weekday, direction] of entries) {
|
|
95
100
|
if (!/^[0-6]$/.test(weekday)) {
|
|
96
101
|
throw rangeError("invalid-weekday", `options.directions has a weekday that is not 0 (Sunday) to 6 (Saturday): ${describeValue(weekday)}`);
|
|
97
102
|
}
|
|
@@ -99,6 +104,9 @@ function checkOptions(options) {
|
|
|
99
104
|
throw rangeError("invalid-argument", `options.directions[${weekday}] must be "next" or "previous": ${describeValue(direction)}`);
|
|
100
105
|
}
|
|
101
106
|
}
|
|
107
|
+
if (entries.length === 7) {
|
|
108
|
+
throw rangeError("invalid-argument", "options.directions must leave at least one weekday without a direction (there would be no day to move a holiday to)");
|
|
109
|
+
}
|
|
102
110
|
if (typeof kind !== "string" || kind === "") {
|
|
103
111
|
throw rangeError("invalid-argument", "options.kind must be a non-empty string (Holiday.kind)");
|
|
104
112
|
}
|
|
@@ -108,12 +116,13 @@ function checkOptions(options) {
|
|
|
108
116
|
if (original !== undefined && original !== "keep" && original !== "drop") {
|
|
109
117
|
throw rangeError("invalid-argument", 'options.originalPolicy must be "keep" or "drop"');
|
|
110
118
|
}
|
|
111
|
-
return o;
|
|
119
|
+
return { ...o, directions: Object.fromEntries(entries) };
|
|
112
120
|
}
|
|
113
121
|
export function withSubstituteDays(holidays, options) {
|
|
114
122
|
const input = checkHolidays(holidays);
|
|
115
123
|
const { directions: rules, kind, renameSubstitute: name, originalPolicy: original, } = checkOptions(options);
|
|
116
124
|
const sorted = [...input].sort((a, b) => (a.date < b.date ? -1 : 1));
|
|
125
|
+
const namesOf = new Map(sorted.map((h) => [h, h.names === undefined ? undefined : Object.freeze({ ...h.names })]));
|
|
117
126
|
const taken = new Set(sorted.map((h) => h.date));
|
|
118
127
|
const result = sorted
|
|
119
128
|
.filter((h) => original !== "drop" || rules[weekdayOf(h.date)] === undefined)
|
|
@@ -121,7 +130,7 @@ export function withSubstituteDays(holidays, options) {
|
|
|
121
130
|
date: h.date,
|
|
122
131
|
name: h.name,
|
|
123
132
|
nameEn: h.nameEn,
|
|
124
|
-
...(h
|
|
133
|
+
...(namesOf.get(h) === undefined ? {} : { names: namesOf.get(h) }),
|
|
125
134
|
kind: h.kind,
|
|
126
135
|
confirmed: h.confirmed,
|
|
127
136
|
...(h.key === undefined ? {} : { key: h.key }),
|
|
@@ -136,11 +145,17 @@ export function withSubstituteDays(holidays, options) {
|
|
|
136
145
|
day = addDays(day, step);
|
|
137
146
|
taken.add(day);
|
|
138
147
|
const named = name === undefined ? { name: h.name, nameEn: h.nameEn } : name(h);
|
|
148
|
+
if (typeof named !== "object" ||
|
|
149
|
+
named === null ||
|
|
150
|
+
typeof named.name !== "string" ||
|
|
151
|
+
typeof named.nameEn !== "string") {
|
|
152
|
+
throw rangeError("invalid-argument", `options.renameSubstitute must return { name, nameEn } as strings (for ${h.date}): ${describeValue(named)}`);
|
|
153
|
+
}
|
|
139
154
|
result.push(Object.freeze({
|
|
140
155
|
date: day,
|
|
141
156
|
name: named.name,
|
|
142
157
|
nameEn: named.nameEn,
|
|
143
|
-
...(h
|
|
158
|
+
...(namesOf.get(h) === undefined ? {} : { names: namesOf.get(h) }),
|
|
144
159
|
kind,
|
|
145
160
|
confirmed: h.confirmed,
|
|
146
161
|
...(h.key === undefined ? {} : { key: h.key }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bizdays-toolkit",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.4",
|
|
4
4
|
"description": "Holidays, business-day calendar and day-by-day schedules (e.g. store hours) with time zone support. Japanese holidays verified against the Cabinet Office data; UK bank holidays (England, Wales, Scotland, Northern Ireland) verified against GOV.UK and The Gazette; French public holidays (metropole, Alsace-Moselle) verified against data.gouv.fr; Singapore public holidays verified against data.gov.sg. / 祝日と営業日のカレンダー(タイムゾーン対応・日本の祝日は内閣府、英国の bank holidays は GOV.UK と The Gazette、フランスの祝日は data.gouv.fr、シンガポールの祝日は data.gov.sg のデータで全日照合)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bank-holidays",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@types/node": "26.6.6",
|
|
92
|
-
"oxfmt": "0.
|
|
93
|
-
"oxlint": "1.
|
|
92
|
+
"oxfmt": "0.77.0",
|
|
93
|
+
"oxlint": "1.92.0",
|
|
94
94
|
"typescript": "6.0.3"
|
|
95
95
|
},
|
|
96
96
|
"engines": {
|