bizdays-toolkit 0.32.0 → 0.32.1
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 +8 -1
- package/dist/core/diagnose.js +10 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ Entries from 0.31.0 are in English. Earlier entries remain in Japanese (their **
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.32.1] - 2026-11-14
|
|
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 throw. This happened only with a holiday provider that returns holidays on more than 31 consecutive days and a `holidayOverlapPolicy: "after-holiday"` rule whose day cannot be moved past that run (the case that throws `holiday-run-too-long` since 0.32.0): when another item decided the first day after the run before the rule was reached (a date in `closedDates` or `openDates`, an annual date, or an earlier recurring rule), the calendar evaluated that day without an exception, the diagnostics reported that item as `redundant`, and removing it as suggested made the day throw `holiday-run-too-long`. The diagnostics now treat a day on which the evaluation throws `holiday-run-too-long` as a day that cannot be judged (an item is not reported as `redundant` when removing it changes whether a day can be judged), so such an item is no longer reported. A wrong diagnostic disappears; no result of a calendar or schedule changes, and the `warning` with code `holiday-run-too-long` is reported as before. The opposite direction remains and is documented (design decisions 31): the `"after-holiday"` rule that loses its day can itself be reported as `redundant`, and removing it makes the exception disappear
|
|
14
|
+
|
|
9
15
|
## [0.32.0] - 2026-11-14
|
|
10
16
|
|
|
11
17
|
This minor version stops one silent loss of closed days, makes aliases of a time zone the same time zone on runtimes with Temporal, and makes one mistaken call a type error. Some code needs a check; see Migration.
|
|
@@ -1001,7 +1007,8 @@ This version rebuilds the `redundant` diagnostic so that the reported rules can
|
|
|
1001
1007
|
|
|
1002
1008
|
- 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
|
|
1003
1009
|
|
|
1004
|
-
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.
|
|
1010
|
+
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.1...HEAD
|
|
1011
|
+
[0.32.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.32.0...v0.32.1
|
|
1005
1012
|
[0.32.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.9...v0.32.0
|
|
1006
1013
|
[0.31.9]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.8...v0.31.9
|
|
1007
1014
|
[0.31.8]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.7...v0.31.8
|
package/dist/core/diagnose.js
CHANGED
|
@@ -3,7 +3,7 @@ import { compileCalendarOptions } from "./calendar.js";
|
|
|
3
3
|
import { internalError, InternalError, describeValue, IssueCollector, rangeError, } from "./errors.js";
|
|
4
4
|
import { isOptionsObject } from "./options.js";
|
|
5
5
|
import { RENAMED_KEYS, RENAMED_VALUES } from "./renamed.js";
|
|
6
|
-
import { compileScheduleOptions, createBasis, createHolidayLookup, createResolver,
|
|
6
|
+
import { compileScheduleOptions, createBasis, createHolidayLookup, createResolver, lostShiftMessage, throwLostShift, inPeriod, MAX_HOLIDAY_RUN, jpUsage, matchMonthDay, matchPattern, isHolidayBasedRule, resultIgnoresHolidays, } from "./schedule.js";
|
|
7
7
|
function editDistance(a, b) {
|
|
8
8
|
const d = Array.from({ length: a.length + 1 }, (_, i) => Array.from({ length: b.length + 1 }, (_, j) => (i === 0 ? j : j === 0 ? i : 0)));
|
|
9
9
|
for (let i = 1; i <= a.length; i++) {
|
|
@@ -51,6 +51,7 @@ const MIN_DAY = toDayNumber("1000-01-01");
|
|
|
51
51
|
const MAX_DAY = toDayNumber("9999-12-31");
|
|
52
52
|
const MAX_WINDOW_YEARS = 200;
|
|
53
53
|
const MAX_DATE_RULE_DAYS = 366 * MAX_WINDOW_YEARS;
|
|
54
|
+
const isLostShift = (error) => error?.code === "holiday-run-too-long";
|
|
54
55
|
const atCalendarEdge = (n, error) => (n < MIN_DAY + MAX_HOLIDAY_RUN || n > MAX_DAY - MAX_HOLIDAY_RUN) &&
|
|
55
56
|
error?.code === "out-of-range";
|
|
56
57
|
function openEndedDays(from, days) {
|
|
@@ -701,14 +702,14 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
701
702
|
}
|
|
702
703
|
}
|
|
703
704
|
if (isCalendar && window && !dates.some((r) => r.value === true)) {
|
|
704
|
-
const resolve = createResolver(without(compiled, null, true), lookup,
|
|
705
|
+
const resolve = createResolver(without(compiled, null, true), lookup, throwLostShift);
|
|
705
706
|
let found = false;
|
|
706
707
|
eachDay(window, (n) => {
|
|
707
708
|
try {
|
|
708
709
|
found = resolve(fromDayNumber(n)).day.value === true;
|
|
709
710
|
}
|
|
710
711
|
catch (error) {
|
|
711
|
-
if (!atCalendarEdge(n, error))
|
|
712
|
+
if (!atCalendarEdge(n, error) && !isLostShift(error))
|
|
712
713
|
throw error;
|
|
713
714
|
found = false;
|
|
714
715
|
}
|
|
@@ -759,7 +760,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
759
760
|
};
|
|
760
761
|
};
|
|
761
762
|
const redundant = (rule, base, days, original) => {
|
|
762
|
-
const resolve = createResolver(without(base, rule, false), lookup,
|
|
763
|
+
const resolve = createResolver(without(base, rule, false), lookup, throwLostShift);
|
|
763
764
|
for (const n of days) {
|
|
764
765
|
let value;
|
|
765
766
|
try {
|
|
@@ -788,7 +789,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
788
789
|
});
|
|
789
790
|
const judgeDate = (rule) => {
|
|
790
791
|
const base = current(true);
|
|
791
|
-
const resolve = createResolver(base, lookup,
|
|
792
|
+
const resolve = createResolver(base, lookup, throwLostShift);
|
|
792
793
|
const decided = [];
|
|
793
794
|
const span = [];
|
|
794
795
|
let checked = 0;
|
|
@@ -829,7 +830,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
829
830
|
const decidedIn = (rule) => {
|
|
830
831
|
if (!decided && window) {
|
|
831
832
|
const map = new Map(candidates.map((r) => [r, new Set()]));
|
|
832
|
-
const resolveNow = createResolver(current(counting.length > 0), lookup,
|
|
833
|
+
const resolveNow = createResolver(current(counting.length > 0), lookup, throwLostShift);
|
|
833
834
|
eachDay(window, (n) => {
|
|
834
835
|
let by;
|
|
835
836
|
try {
|
|
@@ -849,7 +850,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
849
850
|
const refresh = (affected) => {
|
|
850
851
|
if (!decided)
|
|
851
852
|
return;
|
|
852
|
-
const resolveNow = createResolver(current(counting.length > 0), lookup,
|
|
853
|
+
const resolveNow = createResolver(current(counting.length > 0), lookup, throwLostShift);
|
|
853
854
|
for (const n of affected) {
|
|
854
855
|
if (!inWindow(n) || unjudged.has(n))
|
|
855
856
|
continue;
|
|
@@ -860,7 +861,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
860
861
|
decided.get(by)?.add(n);
|
|
861
862
|
}
|
|
862
863
|
};
|
|
863
|
-
const originalNow = originalOf(createResolver(current(counting.length > 0), lookup,
|
|
864
|
+
const originalNow = originalOf(createResolver(current(counting.length > 0), lookup, throwLostShift));
|
|
864
865
|
const unitsOf = new Map();
|
|
865
866
|
const annualUnits = (rule) => {
|
|
866
867
|
const known = unitsOf.get(rule);
|
|
@@ -923,7 +924,7 @@ function analyzeRules(c, compiled, isCalendar, unsure = () => false) {
|
|
|
923
924
|
}
|
|
924
925
|
if (reported.size === 0)
|
|
925
926
|
return;
|
|
926
|
-
const resolveFinal = createResolver(current(true), lookup,
|
|
927
|
+
const resolveFinal = createResolver(current(true), lookup, throwLostShift);
|
|
927
928
|
const relatedOf = (days) => {
|
|
928
929
|
const paths = new Set();
|
|
929
930
|
for (const n of days) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bizdays-toolkit",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.1",
|
|
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",
|