bizdays-toolkit 0.32.1 → 0.32.2
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 +9 -1
- package/dist/core/diagnose.js +12 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@ Entries from 0.31.0 are in English. Earlier entries remain in Japanese (their **
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.32.2] - 2026-11-15
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- The option diagnostics reported an item as `redundant` (removing it does not change any result) although removing it made a day at the edge of the holiday provider's supported years throw `out-of-range`. A rule that looks at a neighbouring day (an `"after-holiday"` rule looking back for the day it was moved from, a rule for the day before or after a holiday, an nth-business-day-of-the-week rule) throws `out-of-range` when that day is outside the supported years. When another item decided the edge day first (an earlier recurring rule, a date in `closedDates` or `openDates`), the day was evaluated without an exception, the diagnostics reported that item as `redundant`, and removing it as suggested made the day throw. The diagnostics evaluated days outside the supported years as days without holidays and so did not see the exception. They now evaluate such a day as the calendar does and treat it as a day that cannot be judged, so the item is no longer reported. This applies with `outOfRangePolicy: "throw"` (the default); with `"ignore"` nothing throws and nothing changes. No result of a calendar or schedule changes
|
|
14
|
+
- As a consequence, an item that decides a day at the edge of the supported years is no longer reported as `redundant` even when it is redundant on every other day. For example, with the `jp` provider and an `"after-holiday"` rule for Mondays, a weekly Sunday rule that duplicates `closedWeekdays` is no longer reported, because removing it would make 1955-01-02 (the first Sunday of the supported years) throw; the same rule for Saturdays is still reported. With the `sg` provider and a rule for the day before a holiday, a weekly Friday rule that duplicates `closedWeekdays` is no longer reported, because of 2027-12-31
|
|
15
|
+
|
|
9
16
|
## [0.32.1] - 2026-11-14
|
|
10
17
|
|
|
11
18
|
### Fixed
|
|
@@ -1007,7 +1014,8 @@ This version rebuilds the `redundant` diagnostic so that the reported rules can
|
|
|
1007
1014
|
|
|
1008
1015
|
- 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
|
|
1009
1016
|
|
|
1010
|
-
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.
|
|
1017
|
+
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.2...HEAD
|
|
1018
|
+
[0.32.2]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.1...v0.32.2
|
|
1011
1019
|
[0.32.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.0...v0.32.1
|
|
1012
1020
|
[0.32.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.9...v0.32.0
|
|
1013
1021
|
[0.31.9]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.8...v0.31.9
|
package/dist/core/diagnose.js
CHANGED
|
@@ -54,6 +54,16 @@ const MAX_DATE_RULE_DAYS = 366 * MAX_WINDOW_YEARS;
|
|
|
54
54
|
const isLostShift = (error) => error?.code === "holiday-run-too-long";
|
|
55
55
|
const atCalendarEdge = (n, error) => (n < MIN_DAY + MAX_HOLIDAY_RUN || n > MAX_DAY - MAX_HOLIDAY_RUN) &&
|
|
56
56
|
error?.code === "out-of-range";
|
|
57
|
+
const PROVIDER_EDGE_DAYS = 367;
|
|
58
|
+
const atEdge = (n, error, window) => {
|
|
59
|
+
if (atCalendarEdge(n, error))
|
|
60
|
+
return true;
|
|
61
|
+
if (error?.code !== "out-of-range" || !window)
|
|
62
|
+
return false;
|
|
63
|
+
const first = window.ranges[0].from;
|
|
64
|
+
const last = window.ranges[window.ranges.length - 1].to;
|
|
65
|
+
return n < first + PROVIDER_EDGE_DAYS || n > last - PROVIDER_EDGE_DAYS;
|
|
66
|
+
};
|
|
57
67
|
function openEndedDays(from, days) {
|
|
58
68
|
const lo = Math.max(from, MIN_DAY);
|
|
59
69
|
const hi = Math.min(from + days - 1, MAX_DAY);
|
|
@@ -451,7 +461,7 @@ function checkLostShifts(c, compiled, lookup, window) {
|
|
|
451
461
|
resolve(fromDayNumber(n), false);
|
|
452
462
|
}
|
|
453
463
|
catch (error) {
|
|
454
|
-
if (!
|
|
464
|
+
if (!atEdge(n, error, window))
|
|
455
465
|
throw error;
|
|
456
466
|
}
|
|
457
467
|
}
|
|
@@ -483,7 +493,6 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
483
493
|
return;
|
|
484
494
|
const lookup = createHolidayLookup({
|
|
485
495
|
...source,
|
|
486
|
-
outOfRangePolicy: "ignore",
|
|
487
496
|
unconfirmedHolidayPolicy: "accept",
|
|
488
497
|
});
|
|
489
498
|
const basis = createBasis(compiled, lookup);
|
|
@@ -709,7 +718,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
709
718
|
found = resolve(fromDayNumber(n)).day.value === true;
|
|
710
719
|
}
|
|
711
720
|
catch (error) {
|
|
712
|
-
if (!
|
|
721
|
+
if (!atEdge(n, error, window) && !isLostShift(error))
|
|
713
722
|
throw error;
|
|
714
723
|
found = false;
|
|
715
724
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bizdays-toolkit",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
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",
|