bizdays-toolkit 0.30.9 → 0.31.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 CHANGED
@@ -1,11 +1,51 @@
1
1
  # Changelog
2
2
 
3
- この形式は [Keep a Changelog](https://keepachangelog.com/ja/1.1.0/) に、版の付け方は [Semantic Versioning](https://semver.org/lang/ja/) と [RELEASING.md](./RELEASING.md) の方針に従います。区分には Keep a Changelog の Added / Changed / Deprecated / Removed / Fixed / Security に加えて、祝日データの更新を表す **Data**、マイナー版で利用者がする作業を書く **移行**(RELEASING.md)、公開物の変わらない品質の仕組み(検査・CI・リリースの手順)を書く **開発** を使います。
3
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/) and the policy in [RELEASING.md](./RELEASING.md). Besides the Keep a Changelog sections (Added / Changed / Deprecated / Removed / Fixed / Security), **Data** lists updates of the holiday data and **Migration** lists the work users need to do for a minor version.
4
4
 
5
- 「開発」は 1 項目 1 行で、何を足した・やめた・変えたかだけを書きます(RELEASING.md の「区分」)。0.30.8 までの「開発」も 0.30.9 でこの形に縮めました。縮める前の文(経緯・退けた案・測定の詳しい値)は、各版のタグの `CHANGELOG.md` にあります。
5
+ Entries from 0.31.0 are in English. Earlier entries remain in Japanese (their **Migration** headings were renamed from 移行 in 0.31.0, and their section **開発** corresponds to the development notes). Development notes for 0.30.x and later (changes to the quality tooling that do not change the published package: checks, CI, release steps) are in [docs/development-log.md](./docs/development-log.md) (in Japanese; not published to npm). For versions before 0.30.0 (0.22.x and earlier), they are in the 開発 section of each version below.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.31.1] - 2026-11-08
10
+
11
+ This version fixes behaviour that did not match the documentation and corrects the documentation. The results of valid calendars and schedules do not change.
12
+
13
+ ### Fixed
14
+
15
+ - Option diagnostics: `expired` (with `asOf`) was reported for a rule with `holidayOverlapPolicy: "after-holiday"` whose last day was moved past `effectiveTo` onto or after `asOf`, with a message saying that the rule no longer affects results (for example, a Monday rule ending on a Monday holiday still closes the Tuesday after). Such a rule is now `expired` only once more than 31 days have passed since `effectiveTo` (31 days is the furthest a day can be moved). Likewise, with a rule for the nth business day of the month or week counted on the calendar itself, a specific date or an annual date that ended could still move that nth business day later in its month or week; such an item is now `expired` only after the end of its month (with a monthly rule) or six days after its end (with a weekly rule). Fewer `expired` may be reported
16
+ - Date-time strings with an offset were read with the runtime's `Date.parse`, which differs between runtimes for forms that ECMAScript leaves to the implementation: Firefox and Safari threw `invalid-time` for a lowercase `t` or `z` (such as `"2026-11-22t15:30:00z"`), which the documented pattern accepts. The instant is now computed from the parts of the string, so every runtime gives the same result (fractions of up to 9 digits too)
17
+ - `diffBusinessDays` returned `-0` when `from` was after `to` and there was no business day between them; it now returns `0` (combined calendars and calendars made from a schedule too)
18
+ - Wrong arguments threw a `TypeError` without `code` instead of a `RangeError` with `code: "invalid-argument"`: `today` given something other than a `Date`, `businessDayOnOrAfter` given options that are not an object, and `createCalendarFromSchedule` given a schedule that is not an object or options that are not an object (these options were silently ignored before). Error messages for a Symbol or a BigInt argument no longer fail while being built (they threw a `TypeError` without `code`)
19
+ - Error messages: an hour of 24 is shown as written ("24:00", not "24:0"); a date-time string with seconds of 60 or more is reported as an invalid date-time string, like other malformed strings (the code is unchanged); the bundled providers' `holidaysInYear` given a year that is not an integer says so instead of reporting the year as out of range (the code is unchanged); `dueDate` and `combineCalendars` given options that are not an object say so (the codes are unchanged). Values in messages are written in one way: numbers as written (`NaN`, `Infinity`), strings in quotes, objects such as a `Date` or a `Map` by their kind, Symbols and BigInts readable
20
+ - Documentation: the `cutoff` TSDoc named the error class as `Error` (it is a `RangeError`); the guide and `KnownErrorCode` now mention that dates are limited to the years 1000–9999 (`out-of-range` outside them, also with `outOfRangePolicy: "ignore"`)
21
+
22
+ ## [0.31.0] - 2026-11-08
23
+
24
+ This version rebuilds the `redundant` diagnostic so that the reported rules can be removed all together, narrows the days the diagnostics cannot judge, and brings in the changes postponed in 0.30.x that throw where nothing was thrown before or narrow a type (the return value of `isOpen`, the error classes, the frozen result of `withSubstituteDays`). It also adds the search for closed days.
25
+
26
+ ### Added
27
+
28
+ - `Calendar.nextClosedDay(input)` and `previousClosedDay(input)`: return the next day after the input, or the previous day before it, that is not a business day. If none is found within `searchDayLimit` days, they throw a `RangeError` with the new code `no-closed-day`. Combined calendars and calendars made from a schedule have them too
29
+ - `BusinessDayOnOrAfterOptions.cutoff` accepts `"HH:mm:ss"`. The time of the input is taken to the minute (seconds are dropped) and compared at the start of that minute (with `"14:00:30"`, an input at 14:00 is before the cutoff)
30
+
31
+ ### Changed
32
+
33
+ - Option diagnostics (`diagnoseCalendar`, `diagnoseSchedule`): `redundant` is now judged by sequential removal. Rules that are never used (`shadowed`, `never-matches` and the like) are removed first; then each rule (annual dates and recurring rules in array order, then specific dates) is judged with the rules already reported removed, and the pass is repeated until no other rule can be removed. The reported rules can be removed all together without changing any result (before, each rule was judged as if only that rule were removed: with the same rule written twice, the later one was `shadowed` and the earlier one `redundant`, and removing both changed the result). Impact: fewer `redundant` may be reported (for example, no `redundant` for the earlier of two identical rules), and in some settings more (for example, without closed weekdays, an open date that covers a closed date becomes `redundant` once the covered date is removed)
34
+ - Option diagnostics: `redundant` now has `relatedPath`, the rule that decides the days instead when the rule is removed, set only when one rule decides all of them (not when a closed weekday or the holiday handling decides some of them)
35
+ - Option diagnostics: the days the diagnostics cannot judge (where the counting calendar of a schedule's nth-business-day rule throws) are now found day by day and before the rules are compared: for a monthly rule, the days of the month where the calendar throws; for an nth business day of the week, the seven days of a week that touches such a month. Only rules whose effective period contains such a day get no `never-matches` or `redundant`, and they are not removed in the sequential removal. Before, the months next to such a month and the months of the 28 years used to compare rule shapes (2001–2028) were also treated as unknown, and the diagnostics were dropped after the comparison. Impact: in schedules with counting calendars, more `never-matches` and `redundant` may be reported
36
+ - `createCalendarFromSchedule`: if `isOpen` returns something other than a boolean, it throws a `RangeError` with code `invalid-argument` (before, a day with a value other than `true` was closed). It calls `isOpen` with the weekday values and the value of `holidayPolicy: { value }` when the calendar is created, and checks other values when such a day is evaluated
37
+ - Error classes follow one table by `code`: only `invalid-input` is a `TypeError`; every other code is a `RangeError`. The errors that were `TypeError` (`invalid-argument` for a wrong argument type in the functions of `bizdays-toolkit/provider`, `invalid-argument` from `migrateCalendarOptions` and `migrateScheduleOptions` given a value that is not an object, and `invalid-date` from `toInstant` given a date that is not a string) are now `RangeError`
38
+ - `withSubstituteDays` (`bizdays-toolkit/provider`): the returned array is frozen, and its type is `readonly Holiday<Kind>[]`
39
+
40
+ ### Migration
41
+
42
+ - Tests that compare the whole result of the diagnostics (for example with `deepEqual`) need the new results as expected values: `redundant` may decrease or increase, `relatedPath` is added, and in schedules with counting calendars more `never-matches` and `redundant` may be reported. Removing the reported rules one at a time and diagnosing again is no longer needed; they can be removed together
43
+ - If `isOpen` of `createCalendarFromSchedule` returns values such as `1` or `"open"`, make it return a boolean (otherwise it throws when the calendar is created or when a day with that value is evaluated)
44
+ - If you catch the errors with `instanceof TypeError`, use `isBizdaysError(e)` and `e.code` instead (every code except `invalid-input` is now a `RangeError`)
45
+ - If you change the result of `withSubstituteDays` (for example with `push`), copy it first (`[...result]`). In TypeScript, if you assign it to a mutable array type (`Holiday[]`), use `readonly Holiday[]`
46
+ - Code that branches on `code` should handle the new `no-closed-day` in its default branch (usually no work is needed)
47
+ - No work is needed for `cutoff` with seconds or for `nextClosedDay` and `previousClosedDay`. The old option names are still accepted until 1.0.0
48
+
9
49
  ## [0.30.9] - 2026-11-07
10
50
 
11
51
  品質改善提案(11 通目)の分です。文書で約束していた挙動から外れていた不具合を 2 件直しました。合成したカレンダーが、後のカレンダーが投げる日に投げるようになります(約束の回復。新たに投げる向きですが、RELEASING.md の区分を改めてパッチとしました)。省略可能な項目に明示的に書いた `undefined` は、どの項目でも省略と同じになります(作成できなかった設定が作成できるようになる向き)。正しい設定のカレンダー・スケジュールの判定の結果は変わりません。
@@ -21,22 +61,6 @@
21
61
  - ガイド(英日): 明示的な `undefined` は省略と同じ、を書き、「未確定の祝日」の合成の既知の不具合の記載を消した
22
62
  - 決定の文書: 17 番を実態に合わせて書き換えた(結果が祝日に依存しない設定の値だけの判定は未確定の祝日で投げない、を 0.30.6 から入れていたのに、「実行時に特別扱いを入れない」と書いていた)。6 番に明示的な `undefined` を、32 番に約束の回復の区分を、38 番に CHANGELOG の「開発」の書き方の理由を足した
23
63
 
24
- ### 開発
25
-
26
- - RELEASING.md の区分: 約束した例外が出ていなかった不具合の修正は、新たに投げる向きでもパッチにした(「新たに例外を投げる変更はマイナー」は約束していなかった呼び出しを止める場合に限る)
27
- - RELEASING.md: CHANGELOG の「開発」は 1 項目 1 行にする決まりを足し、0.30.8 までの「開発」を縮めた
28
- - RELEASING.md のサイズの上限: 上限はマイナー版ごとに決め、パッチ版の中では上げない決まりを足した(0.31.0 から適用)
29
- - サイズの上限: `./diagnose` を 26,500 → 26,800 に上げた(測定 26,503)。明示的な `undefined` の扱いと旧名の読み替えの直しで増えた
30
- - タイムゾーンを変えたテストを、瞬間・時刻を渡すテスト(`scripts/test-tz.ts` の `TZ_FILES`)だけの再実行にし、一覧に載っていない瞬間・時刻を書いたテストがあれば失敗にした(手元で約 95 秒 → 約 17 秒)。テストの `tz-run` の飛ばしは外した
31
- - 合成の既知の不具合の `todo` 2 件を、並び順 × `"all"`・`"any"` の通常のテストにした。飛ばしの決まりの自己テストは見本の一覧(`POLICY_SAMPLE`)で確かめる形にした
32
- - 変形しても結果が同じ: 変形 7(書いていない既知の項目を明示的な `undefined` で書いても、結果・診断が同じ)を足した
33
- - 明示的な `undefined` のテスト(`test/explicit-undefined.test.ts`)を足した: メソッド・関数のオプション(`etc/api.md` の Options の型。設定の型は変形 7)で、書いていない項目と旧名を `undefined` で書いても結果が同じ。表にない Options の型があれば失敗する
34
- - API どうしの整合: 事例のテストの整合 9 を、整合 8(`never-matches` も確かめ、有効期間 3 通り)に吸収した。整合 10 は全件(CI)だけで動かす
35
- - 診断の性質のテスト: `pnpm check` では短い提供元・提供元なしの性質だけを動かし、第 n 営業日の規則のある設定と日本の全範囲は全件(CI)だけにした(飛ばしの理由 `ci-full-only`)
36
- - `test/counting-basis.test.ts`: オラクルが確かめる形(有効期間が重ならない組)のテストを 1 件消した
37
- - 診断のオラクル: 項目 3 つの固定の設定 `jointFixed`(同じ曜日の under・over・after の規則。品質改善提案 11 通目の反例)を `test/fixtures/oracle-items.json` に足し、まとめて取り除くテスト(`ORACLE_JOINT=1`)で試す(0.31.0 の作り直しの正解の定義。今は失敗する)
38
- - `src/core/schedule.ts`: 第 n 営業日の基準のキャッシュの上限(240 か月)の意味をコメントに書いた
39
-
40
64
  ## [0.30.8] - 2026-11-06
41
65
 
42
66
  品質改善提案(10 通目)の分です。文書・決定の文書・コメントが実装と食い違っていた箇所を直し、不具合を 4 件直しました。カレンダー・スケジュールの判定の結果は変わりません。変わるのは、診断の結果(カレンダーの個別の日付・毎年の月日の `value` に `unknown-option` が増える。誤った `counting-basis` が消え、曜日の規則ごとに出る)、`no-business-day` の例外のクラス(`Error` → `RangeError`。広がる向き)、`withSubstituteDays` が返す祝日の凍結です。あわせて、品質の仕組みを軽くしました(タイムゾーンを変えたテストを 4 ゾーンから 2 ゾーンに、診断の性質のテストを抜き出しに、全日の結果を比べる補助を 1 つに、同じ恒等式を確かめるテストを 1 か所に。詳しくは「開発」)。公開物の `.js` が変わるのは Fixed の 4 件と、到達しないコードを消した 1 行(`core/input.js`。「開発」)の分だけで、カレンダー・スケジュール・提供元の判定の結果は変わらないので、利用者の作業は要りません。
@@ -53,31 +77,6 @@
53
77
  - ガイド(英日)の「未確定の祝日」: 「`holidaysInYear`・`holidaysBetween` は投げない」を、未確定の祝日では投げない、に限った(対応年の外の `out-of-range` と、提供元のデータの誤りの `invalid-provider-data` は投げる)
54
78
  - ガイド(英日)と `BusinessDayOnOrAfterOptions.cutoff` の TSDoc: `cutoff` が `"HH:mm"` だけを受け付ける理由(入力の時刻は分の精度で比べるので、秒を持つ締め時刻は入力の秒と比べられない)を書いた。秒の受け付けは 0.31.0 で扱う
55
79
 
56
- ### 開発
57
-
58
- - 診断のオラクル: `counting-basis` の確かめを、第 n 営業日の規則と毎週の曜日の規則の有効期間が重なる組を前提にし、前提があるのに出ないとき・出た件数が組の数と違うときも失敗にした
59
- - 前の版との比較: 特徴 `counting-rule-with-period-weekly-rule`(`etc/result-changes.json` で `counting-basis` が消える差分を許す)と `calendar-date-with-value`(増える向きなので許可は足さない)を足し、固定の設定 4 つを足した
60
- - 決定の文書: 3 番に「同じ `code` は同じクラスで投げる」を足した
61
- - `counting-basis` の判定を、規則どうしの走査の後の第 2 の走査にした(規則の並び順で結果が変わらないように)
62
- - `./diagnose` の gzip のサイズ(測定 26,322。上限 26,500)
63
- - 決定の文書: 「版と互換性」の章の見出しの直後にあった番号のない箇条 2 つを 31 番に移した
64
- - 「0.31.0 の P1」を「診断の判定の作り直し(0.31.0)」と言葉で書いた
65
- - API どうしの整合のテスト(`test/consistency.test.ts`)の名前の番号を整合 1〜11 に振り直した
66
- - `bizdays-toolkit/jp` の `jp` の TSDoc に 0.30.0 の旧名 `holidays` が残っていたのを `holidayProvider` に直した
67
- - `src/core/input.ts` の到達しない `replace(" ", "T")` を消した
68
- - `check-package`: `src` が実行環境のタイムゾーンに依存する API を使っていないことを確かめるようにし、`tool-selftest` にその誤りを 2 件足した
69
- - タイムゾーンを変えたテスト(`scripts/test-tz.ts`)を UTC・Asia/Tokyo・America/Los_Angeles・Pacific/Chatham の 4 ゾーンから America/Los_Angeles・Pacific/Chatham の 2 ゾーンにした
70
- - `check-names`: 報告のパスの区切りを `/` にそろえた
71
- - 前の版との比較(`scripts/result-compare.ts`): 意図した差分として許した設定の `id` と対象を一覧に出すようにした(意図しない差分が出たときに、許した側と見比べるため)
72
- - `src/core/input.ts`: `Date.parse` にオフセット付きの文字列だけを渡している理由をコメントに書いた
73
- - 開発用のツールを更新: oxlint 1.88.0 → 1.91.0、oxfmt 0.73.0 → 0.76.0、`@types/node` 24.19.2 → 26.6.6
74
- - `check-package` の実行環境のタイムゾーンに依存する API の検査を直した
75
- - 診断の性質のテストを、ほかの全件のテストと同じ「`pnpm check` は抜き出し、全件は CI」の形にした(全件は `DIAGNOSE_PROPERTY_FULL=1`)
76
- - 変形しても結果が同じ(`test/metamorphic.test.ts`)の全件(`METAMORPHIC_FULL=1`)を CI の `diagnose-consistency` ジョブで動かすようにした
77
- - 全日の結果を比べる補助を `test/support/compare.ts` に 1 つにした
78
- - 同じ恒等式を 3 か所で確かめていたのを 1 か所にした
79
- - `check-package` の実行環境のタイムゾーンに依存する API の検査: 文字列の中身を先に空にしてから `//` のコメントを除くようにした
80
-
81
80
  ## [0.30.7] - 2026-11-05
82
81
 
83
82
  テスト拡充案の第 3 段です。0.30.6 の取り込みで持ち越した項目を片付け、そこで見つけた診断の不具合を 2 つ直したので、公開物の `.js` は 0.30.6 から変わります(Fixed。変わるのは `./diagnose` だけで、カレンダー・スケジュールの判定の結果は変わりません)。テストと道具では、変形しても結果が同じことの検査、文書の例と文章の主張の検査、オラクルの完全性を失敗にする切り替えを入れ、設定の結果の差分の旧名の比較の穴を直しました。設定の結果の差分の定期実行(テスト拡充案の T8)は入れず、手動の広い比較として入れました。自前の変異テスト(T9)は、0.31.0 の診断の作り直しの前に行います。
@@ -87,30 +86,6 @@
87
86
  - 診断: スケジュールの第 n 営業日の規則の基準のカレンダー(`calendar`)が投げる月(判定できない月)がある設定で、判定できない月の影響を受けない診断まで取り除いていた。例: シンガポールの祝日(2020〜2027 年)の基準のカレンダーを持つ規則 `{ businessDayOfMonth: 1, calendar, value }` と、当てはまる日がない規則 `{ dayOfMonth: 31, months: [2], value }` を並べた設定で、後の規則の `never-matches` が出なかった(後の規則だけの設定では出る)。0.30.6 の Fixed の 3 件目(判定できない月の扱い)の取りこぼしで、0.30.5 以前はこの設定で誤った `error` の `out-of-range` を出していた。診断の結果が増える向きの修正。項目は診断の `path` の先頭が規則の位置と一致するもので引き(規則の中のオプションの位置も同じ規則に当たる)、基準のカレンダーを持たない繰り返しの規則の `never-matches` と、その規則の中のオプションの診断は、規則の形と設定だけで決まるので残す。規則そのものの `redundant` は、取り除いた設定と元の設定の結果を比べるので、ほかの規則の基準のカレンダーにも依存し、今までどおり有効期間に判定できない月があれば出さない。旧名のキー(`recurring`・`day` など)で書いても、規則どうしの診断の `path` は新しい名前で出る(API どうしの整合の検査の持ち越しを調べて見つけた。種類は API どうしの食い違い)
88
87
  - 診断: 週の第 n 営業日の規則(`businessDayOfWeek`)で、月をまたぐ週の隣の月が判定できない月のとき、規則の有効期間がその月にかからなければ `never-matches` などを出していた。例: シンガポールの祝日の基準のカレンダーで `{ businessDayOfWeek: 3, weekStart: 1 }` を 2020-01-01〜2020-01-05 に当てると、2019-12-30 から始まる週の 2019 年の日を数えられないのに、`never-matches` を出していた(実際の第 3 営業日は 2020-01-02)。逆向きの例: `{ businessDayOfWeek: -1, weekStart: 3 }` を 2027-12-27〜2027-12-31 に当て、同じ値で 12 月 31 日を決める基準のない規則と並べると、2027-12-29 から始まる週の最後の営業日(2028 年 1 月の祝日次第で、シンガポールの 2028 年の祝日はまだ発表されていない。祝日がなければ 2028-01-04)を 2027-12-31 と数え、後の規則に誤った `redundant` を出していた。週の第 n 営業日の規則では、投げた月の前の月と次の月も判定できない月にする(安全側の扱いなので、隣の月の確かな診断も出さなくなる場合がある)。月の第 n 営業日の規則はその月の基準だけで決まるので、前後の月は記録しない。これも 0.30.6 の Fixed の 3 件目の取りこぼし(0.30.6 の取り込みで見つけた。種類は API どうしの食い違い)
89
88
 
90
- ### 開発
91
-
92
- - サイズ(gzip): `./diagnose` 26,158 → 26,218
93
- - 判定できない月の診断のテストを足した
94
- - API どうしの整合の検査(`test/consistency.test.ts`)の直し: 作成を試す関数は、bizdays のエラーコードを持つ例外だけを「作成できない」とみなし、ほかの例外は投げ直す
95
- - `scripts/result-compare.ts`: スケジュールの第 n 営業日の規則の基準のカレンダーに、スケジュールの設定の `outOfRangePolicy` を受け継がせた
96
- - `scripts/tool-selftest.ts`: 表のセルの `|` を `\|` にし、写しの途中で例外が出ても、そこまでに写したファイルを表の後に出し、`Error` でない値の例外も文にする
97
- - 飛ばしの決まり(`test/support/skip.ts`): 事前の確認で届かなくなった枝を消した
98
- - ガイド(英日)の「対応年の外」: スケジュールの第 n 営業日の規則の文を独立させ、「結果が分からない年の祝日に依存するため」の理由とシンガポールの例が、隣の日を見る規則と週の第 n 営業日の規則の説明として読めるようにした
99
- - 変形しても結果が同じ: 文書で同じ意味だと約束している書き換えで、全日の結果と、位置を読み替えた診断が変わらないことを、目録の設定で確かめる
100
- - 文書の例の検査を厳しくした(テスト拡充案の T6): 例で `createCalendar`・`createSchedule` に渡した設定を自動で診断にもかけ、`error`・`warning` があれば失敗にする
101
- - ガイド(英日)の「カレンダーの合成」に、2 つ以上の別々のカレンダーを渡すことを書き足した(コードにだけあった決まり)
102
- - `SECURITY.md` の Supply chain と Supported versions を英日の併記にそろえ、依存ゼロ(`dependencies` を持たない)と、provenance が付く版を 0.1.0 以降と正確に書いた
103
- - 文章の主張の検査(`scripts/check-claims.ts`。`pnpm check`)を足した。前の版から変わった決定の参照の表は `--decisions --since v<前の版>` で出す
104
- - テスト拡充案の T8(設定の結果の差分の定期実行)は、定期実行としては入れず、種と倍率を指定して広い比較を手動で動かすワークフローとして入れた
105
- - 設定の結果の差分(`scripts/result-compare.ts`)の直し: 診断の結果が増えた設定を一覧に出す
106
- - 目録の生成器(`test/support/catalog.ts`)が、スケジュールの個別の日付の半分ほどを期間(`dates` の `{ from, to }`)にする
107
- - 診断のオラクルの完全性(取り除いても結果が変わらないのに診断が何も言わない項目)を、報告から失敗に切り替えた
108
- - 設定の結果の差分(`scripts/result-compare.ts`)の穴を直した: `latest` との比較の旧名の回が、旧名に書き換わっていなかった
109
- - 設定の結果の差分の意図した差分(`etc/result-changes.json`)に、上の Fixed の 2 件目の項目を足した
110
- - `RELEASING.md` の監視の節: GitHub の失敗の知らせの届き先と、有効にし直すステップの影響を、事実に合わせて書いた
111
- - 飛ばしの決まりの検査(`test/skip-policy.test.ts`): 省略記法・分割代入・`skip`・`todo` の import・export と変数・引数の宣言を、TypeScript のコンパイラーの API で読んで拾うようにした
112
- - `RELEASING.md` の確認の表: 変形しても結果が同じ(T4)と文章の主張(T7)の行を足し、ドキュメントのコード例(T6)・設定の結果の差分(T8)の行を今の検査に合わせた
113
-
114
89
  ## [0.30.6] - 2026-11-02
115
90
 
116
91
  テスト拡充案の第 2 段です。失敗を注入した祝日の提供元と API どうしの整合の検査で見つけた不具合を 3 つ(判定 1・診断 2)直したので、公開物の `.js` は 0.30.5 から変わります(Fixed)。合成したカレンダーの既知の不具合(0.31.0 で直す)を文書に書きました。
@@ -125,46 +100,10 @@
125
100
 
126
101
  - 合成したカレンダーの営業日の判定(`isBusinessDay` や探索)は、`open: "all"` では先のカレンダーが休業日、`open: "any"` では先のカレンダーが営業日と決めた時点で後のカレンダーを判定しないので、後のカレンダーが投げる日(未確定の祝日・提供元の誤りなど)でも投げないことがある(並び順で変わる)。ガイドの「合成したカレンダーは、どれかのカレンダーが投げるなら投げます」から外れる。直すと新たに投げる判定ができるので、0.31.0(マイナー版)で直す。ガイドの該当の箇条に注を足し、確かめるテストは `todo` にした
127
102
 
128
- ### 開発
129
-
130
- - サイズの上限: 上限を 25,800 から 26,500 に上げた `./diagnose`(測定 26,158)
131
- - 診断のオラクル: カナリア(完全性の報告に必ず出る設定)が取り除ける理由を確かめた
132
- - 診断のオラクル: `ORACLE_FULL` なしの `ORACLE_SHARD` を例外にした
133
- - 生成範囲: 危険の分かっている組み合わせの一覧を作り、呼び出し側ごとに 1 回以上作ることを確かめる(作れない組み合わせは事実の理由を付けて除く)
134
- - 生成範囲: `test/properties.test.ts` の性質は、設定を作る乱数(性質の名前から決まる種の列)と、日付などを引く乱数を分けた
135
- - API どうしの整合の検査(`test/consistency.test.ts`)を入れた(全件は `CONSISTENCY_API_FULL=1` で CI の `diagnose-consistency` ジョブ)
136
- - 検査のスクリプトの検査の直し: 取り込み中の変更を `git status -z` で読む(日本語・スペースを含むパスを写せなかった)
137
- - 検査のスクリプトそのものの検査(`scripts/tool-selftest.ts`。CI の `tool-selftest` ジョブ。写しを作る場所は `TOOL_SELFTEST_DIR`)を入れた
138
- - `catch` 節の到達の検査: 除外の一覧の名前が 2 つ以上の節で重なるときと、節の文が `try` と同じ行にあるとき(行で数える lcov では判定できない)を失敗にした。`--lcov` は検査そのものを試すための引数で、CI は使わない
139
- - `catch` 節の到達の検査を入れた
140
- - 飛ばしの決まり: 前提がそろわないときに飛ばす箇所を補助の関数に集め、理由を意図した飛ばしの一覧から引くようにした
141
- - 診断と判定の一致のテストの全件(150 件)を、`CONSISTENCY_FULL=1` で CI の `diagnose-consistency` ジョブで動かす(`pnpm check` は 12 件)
142
- - 失敗を注入する祝日の提供元を作り、判定・診断・合成の結果が文書のとおりかを確かめるテストを足した
143
- - 診断のオラクル: カナリアの理由のテストで、`"over-holiday"` の開く規則を実際に取り除くと全日の結果が変わることまで確かめる
144
- - `scripts/record-generator-features.ts`: 作業ツリーは `--worktree` で指すようにした(`--ref HEAD` は使い方の誤り。CI の `generator-features` ジョブは `--worktree --check`)
145
- - `RELEASING.md`: オラクルと生成範囲の行を実装と 1 文ずつ突き合わせ、消えていた「タイムゾーンを変えた実行では、オラクルと日本の全範囲の走査を飛ばす」を戻し、組み合わせの一覧の検査・カナリアの理由の確認・0 件の検査・`ORACLE_SHARD` の条件・CI の実測の時間を書いた
146
-
147
103
  ## [0.30.5] - 2026-11-01
148
104
 
149
105
  0.30.4 の品質基盤の補修です。公開物の `.js` は 0.30.4 と同じです。0.30.4 で、品質基盤が「動いているように見えて、実は見ていない」箇所と、乱数のテストの生成範囲が縮んだ箇所が見つかったので、それだけを直しました。テスト拡充案の段の番号を 1 つずつずらし、第 2 段は 0.30.6、第 3 段は 0.30.7 で出します。
150
106
 
151
- ### 開発
152
-
153
- - 生成範囲を減らさない検査を入れた(`test/generator-features.test.ts`。記録は `scripts/record-generator-features.ts --update --ref v0.30.3` でだけ作る)
154
- - 呼び出し側の設定の作り方を `test/support/sites.ts`・`test/support/result-cases.ts` の関数にまとめ、呼び出し側と検査が同じ関数を使うようにした
155
- - 生成器の到達性を、呼び出し側の文脈ごと・規則の形ごとに確かめるようにした(`test/catalog.test.ts`)
156
- - 目録の除外の一覧を `"型.キー"` で引くようにし、除外したキーが `etc/api.md` に実在すること、呼び出し側が実際には作らないことも確かめる
157
- - `scripts/result-compare.ts`: スケジュールの第 n 営業日の規則に、数える基準のカレンダー(`calendar`)を付けるようにした
158
- - 診断のオラクルの項目を、目録の乱数から切り離して明示した一覧にした
159
- - 黙って飛ばさない: `test/properties.test.ts` は飛ばした試行の件数をいつも「飛ばした試行: n / N(理由)」で出し、上限(1 割)を超えたら失敗にする。誤った値が黙って既定になっていた `ORACLE_SHARD`・`PROPERTY_SEED`・`ORACLE_FULL`・`ORACLE_JOINT` と、`result-compare.ts` の `--seed`・`--scale`、`bench-compare.ts` の `--ratio` を、例外か使い方の誤りにした
160
- - 診断のオラクルの完全性の報告(取り除けるのに何も出ない項目)を確かめられるようにした
161
- - 診断のオラクルの範囲を広げた(全件の設定 3,481 → 9,976 件。CI の `oracle` ジョブを `ORACLE_SHARD` で 3 つの行列に分けた)
162
- - 診断の `counting-basis` の文を、毎週の曜日の規則が開く規則か閉じる規則かの両側で確かめる単体テストを足した(文の分岐を確かめていなかった穴。種類 C)
163
- - 生成範囲の検査の補修: 特徴の取り出しの診断の走査の範囲(`diagnoseRangeOf`)に、対応年が 1900〜2099 年と重ならないときに先頭の 200 年にする扱いを入れ、単体テストで確かめる(`test/features.test.ts`)
164
- - `RELEASING.md`: 診断のオラクルの環境変数(`ORACLE_FULL`・`ORACLE_SHARD`・`ORACLE_TARGET`・`ORACLE_JOINT`)と、全件の実行の時間の決まりを書いた
165
- - `test/diagnose-properties.test.ts` の冒頭に二重に残っていた古い説明のコメントを消した
166
- - `RELEASING.md`: 品質の確認に生成範囲の行を足し、目録・オラクルの行を今の検査に合わせた
167
-
168
107
  ## [0.30.4] - 2026-11-01
169
108
 
170
109
  品質基盤の整備の第 1 段(正解の定義)です。規則と設定の目録と、診断の総当たりのオラクルを入れました。オラクルで見つけた診断の文の誤りを 1 つ直しました(判定の結果は変わりません)。
@@ -173,16 +112,6 @@
173
112
 
174
113
  - 診断: 第 n 営業日の規則と、毎週の曜日を開く繰り返しの規則がある設定で、`counting-basis` の文が「その曜日の規則は数を減らさない」と、閉じる規則のときの説明をしていた。開く規則のときは「その規則が開いた日は数えない」と説明する。メッセージは API ではないので、診断の `code`・`path` は変わらない(総当たりのオラクルで約束を確かめるときに見つけた。種類は文章の主張の未検証)
175
114
 
176
- ### 開発
177
-
178
- - 規則と設定の目録 `test/support/catalog.ts` を置き、乱数のテストと `scripts/result-compare.ts` の生成器を目録に切り替えた
179
- - `test/properties.test.ts` のカレンダーに、目録の繰り返しの規則を入れた(これまでは繰り返しの規則のないカレンダーだけを試していた)
180
- - `test/diagnose-properties.test.ts` は、対応年の短い自作の提供元(`test/support/provider.ts`)で全日を比べる(400 日の抜き出しをやめた)
181
- - 診断の総当たりのオラクル `test/diagnose-oracle.test.ts` を入れた(出た項目をまとめて取り除く性質は `ORACLE_JOINT=1` で試せる)
182
- - `scripts/test-tz.ts`: タイムゾーンを変えた実行では、オラクルを飛ばす(暦日だけで決まるので)
183
- - `RELEASING.md`: 品質の確認に目録とオラクルを足し、手元の確認は前の版のタグを読める状態で通すことを書いた
184
- - サイズ(gzip): `./diagnose` 25,321 → 25,360(測定 25,360。上の Fixed の文の分)
185
-
186
115
  ## [0.30.3] - 2026-11-01
187
116
 
188
117
  診断の不具合を直すパッチ版です。あわせて、0.30.2 の後に main で整えた決定の文書・規約・CI を含みます。カレンダー・スケジュールの判定の結果は変わりません。
@@ -202,19 +131,6 @@
202
131
  - 規約を見直した(`docs/decisions.md` の 25・26・32・33・37 番、`RELEASING.md`): 約束した挙動から外れていた不具合の修正は、入った版を問わずパッチにする(これまでは直前の版で入った退行だけ)。誤った診断を直したときは、前の版の診断の結果が消えることがある。性能の比較は、正しさのために遅くなることを CHANGELOG に書いた版を通す。同梱の提供元の内部は、前の版との祝日データの比較で差分がなければ置き換えてよい。誤った祝日の `key` を直す手順を決めた
203
132
  - ガイド(英日)の「0.30.0 より前に保存した設定」に 0.30.2 で足した、書き換えた後に診断を実行する例の設定が、`timeZone` を書いていないので `time-zone-conflict`(error)になっていた(日本と英国の提供元はタイムゾーンが違う)。例は `deprecated-option` だけを取り出していたので、コード例の検査は通っていた。`timeZone: "Asia/Tokyo"` と `holidayPolicy: "open"` を足し、診断の結果をすべて示す形にした(誤りがあれば例の検査で止まる)
204
133
 
205
- ### 開発
206
-
207
- - `test/diagnose.test.ts`・`test/diagnose-properties.test.ts`: 上の Fixed の 4 例(月・週の第 n 営業日、閉じる・開く規則)と、スケジュールの第 n 営業日の規則では結果が変わらないことのテストを足した
208
- - `scripts/result-compare.ts`: 意図した差分を、診断の消えた結果のコード(`removedCodes`)で絞れるようにした
209
- - サイズの上限: `./diagnose` を 25,000 から 25,800 に上げた
210
- - サイズ(gzip): `./diagnose` 24,753 → 25,321(測定 25,321)
211
- - Node.js 26 が LTS に入ったので、CI の `check` の行列を 22.23.4・24.22.2・26.13.0 に上げ、ビルド・ブラウザー・ランタイム・比較・公開・監視のジョブの固定の版を 26.13.0 にした
212
- - `scripts/check-package.ts`: 決定の文書の目次が本文の章・見出しと一致すること(番号の重複も)を確かめる
213
- - `scripts/bench-compare.ts`: CHANGELOG の今の版(または [Unreleased])の「開発」に決まった言葉で理由を書いた版は、2 倍を超えて遅くなっても表に記録して合格にする(言葉は `RELEASING.md` の品質の確認の表)
214
- - `etc/result-changes.json` に 0.30.1 の修正(和集合の旧名 `"national"`)を足した
215
- - `scripts/result-compare.ts`: 意図した差分を許す特徴を、比べた対象ごとに付けるようにした
216
- - `test/fixtures/national-union-0.22.2.json` の出典の説明で、`"national"` の扱いの根拠を旧 55 番としていたのを旧 54 番(今の 10 番)に直した
217
-
218
134
  ## [0.30.2] - 2026-10-30
219
135
 
220
136
  0.30.0・0.30.1 の改名の後始末の続きの版です。新しい設定・関数・診断コードはありません。公開物の `.js` の挙動が変わるのは Fixed の 1 つ(診断の結果)で、カレンダー・スケジュールの判定の結果は変わりません。
@@ -233,13 +149,6 @@
233
149
  - ソースのコメントとテストで、`"national"` の扱いの根拠を 55 番としていたのを 54 番に直した
234
150
  - `docs/decisions.md`: 54 番に 0.30.2 の追記(返す値の改名は「改名は結果を変えない」の例外であること、規則どうしの診断の項を実際の挙動に合わせた)を足し、55 番の対象を「直前の版(マイナー版・パッチ版)」に改め、56 番(同じ設定の結果を前の版と CI で比べる)を足した。旧名を本文に持つ 14・16・36・43・44 番に、0.30.0 の改名の追記を足した。`RELEASING.md`: パッチの区分を「直前の版」に改め、互換性の約束の診断の項に前の版の結果は新しい版でも返すことを、品質の確認に決定の文書の旧名と返す値の改名の確かめ方を足した
235
151
 
236
- ### 開発
237
-
238
- - CI に `result-compare` ジョブを足した(`scripts/result-compare.ts`)
239
- - `scripts/check-names.ts`: 前の版を動かす `scripts/result-compare.ts` を、旧名の検査(C14)の対象から外した
240
- - `test/national-union.test.ts` に、日本の提供元だけの設定の `shadowed` の確認を足した
241
- - サイズ(gzip): ルート 18,054 → 17,997(測定 17,997)、`./jp` 20,288 → 20,226(測定 20,226)、`./diagnose` 24,492 → 24,753(測定 24,753)
242
-
243
152
  ## [0.30.1] - 2026-10-30
244
153
 
245
154
  0.30.0 の改名の後始末の版です。新しい設定・関数・診断コードはありません。公開物の `.js` の挙動が変わるのは Fixed の 1 つだけです。
@@ -258,13 +167,6 @@
258
167
  - README の祝日の種別の説明を今の値に直した。README(英日)の minify + gzip のサイズを測り直した(ルート 12.7 → 13.0 KB、日本込み 14.4 → 14.7 KB、英国込み 14.8 → 15.1 KB、フランス込み・シンガポール込み 13.6 → 13.9 KB)。`docs/providers.md` のコード例のコメントに残っていた置き換えの取り残し("US federal holidayProvider:" → "US federal holidays:")を直した
259
168
  - `docs/decisions.md`: 55 番(直前の版で入った退行の修正はパッチ)を足し、42・50・52・54 番に追記した。`RELEASING.md`: パッチの区分に退行の修正を足し、互換性の約束から型の名前の列挙をやめ、旧名(`outOfRange`)を直した。`src/core/schedule.ts`・`calendar.ts` の冒頭の判定の順番の写しを削り、ガイドと 12 番を指すようにした
260
169
 
261
- ### 開発
262
-
263
- - `scripts/check-names.ts` に、形を分けるための `?: never` の項目に TSDoc が付いていないこと(C13)と、今の状態を書いた文書・スクリプト・型定義の TSDoc に 0.30.0 の旧名が残っていないこと(C14)の検査を足した
264
- - `scripts/check-size.ts`: 上限を変えた版で、CHANGELOG の測定値(「(測定 N)」の形)を 1 つも照合できなければ失敗にし、照合した件数を出すようにした
265
- - 和集合の `"national"` のテストを足した
266
- - サイズ(gzip): ルート 17,646 → 18,054(測定 18,054)、`./jp` 19,890 → 20,288(測定 20,288)、`./diagnose` 23,919 → 24,492(測定 24,492)
267
-
268
170
  ## [0.30.0] - 2026-10-27
269
171
 
270
172
  公開する名前を 1 つの規則に合わせて改めた版です(`docs/decisions.md` の 54 番)。名前の整理の版を区切るため、版の番号を 0.30.0 にしました(0.23.0〜0.29.0 は欠番)。旧名は 1.0.0 まで受け付けます。作業は「移行」と `docs/migration.md` の 0.30.0 の節にあります。
@@ -292,7 +194,7 @@
292
194
 
293
195
  - 日本の祝日の `kind` の `"national"` を `"regular"` にした(日付・名称・`key` は変わらない)
294
196
 
295
- ### 移行
197
+ ### Migration
296
198
 
297
199
  - 実行時は旧名のままでも動くが、返す値の変更・対応年の端の挙動・TypeScript で必須のキーの旧名・`dayInfoOn` の結果を丸ごと比べるテストは 0.30.0 に上げた時点で対応が要る(下の箇条)。それ以外は TypeScript の取り消し線と診断の `deprecated-option` を手がかりに新しい名前に書き換える。保存した設定は `migrateCalendarOptions`・`migrateScheduleOptions` で書き換えられる
298
200
  - 型が旧名を持つのは省略可能なキーだけなので、スケジュールの `weekly`・合成の `businessDay`・期日の `day`・振替の `rules`・規則の `day` は、TypeScript では新しい名前に書き換える
@@ -300,15 +202,6 @@
300
202
  - `dayInfoOn` の結果を `deepEqual` で比べているテストは、期待値に `open` と、`rulePath` があれば `optionPath` を足し、`reason` が `"regular"` なら `"default"`(`createCalendarFromSchedule` では `"open-weekday"`)に直す
301
203
  - 対応年の最後の日付の近くで祝前日・祝日の翌日・振替の規則を使っていて例外になったら、`outOfRangePolicy: "ignore"` にするか、対応年の中で使う
302
204
 
303
- ### 開発
304
-
305
- - 名前の規則の検査 `scripts/check-names.ts` を `pnpm check` に足した
306
- - 改名の表を `src/core/renamed.ts` の 1 か所に置き、読み替え・診断・`migrate…` がこの表だけを使う
307
- - `scripts/bench.ts` は、前の版が新しい名前を知らないときは設定を旧名に戻して渡す(CI の bench が同じ場面を比べるため)
308
- - `scripts/check-readme-examples.ts` は、0.30.x の間だけ返す旧名の項目(削除予定の表から決める)を比べない
309
- - サイズの上限を上げた
310
- - README のサイズの値を 0.30.0 で測り直した
311
-
312
205
  ## [0.22.2] - 2026-10-27
313
206
 
314
207
  ### Changed
@@ -346,7 +239,7 @@
346
239
  - `docs/decisions.md`: 53 番(日単位の周期の規則、祝日の翌日・祝前日の絞り込みと `skipWeekdays`、前への振替を足さない判断、`@public` への格上げ)を追加し、15・33・35・43・46・47 番に追記した
347
240
  - `docs/migration.md`: 1.0.0 で削除する非推奨の API の一覧を足した
348
241
 
349
- ### 移行
242
+ ### Migration
350
243
 
351
244
  - 動作が変わる既存の API はない。祝日の翌日・祝前日の規則に `kinds`・`keys`・`skipWeekdays` を付けて `invalid-option` になることを確かめていたテストは、例外が出なくなるので失敗する。テストを書き換える(`docs/migration.md`)
352
245
 
@@ -406,7 +299,7 @@
406
299
 
407
300
  ## [0.21.0] - 2026-10-25
408
301
 
409
- ### 移行
302
+ ### Migration
410
303
 
411
304
  動作が変わる既存の API はない(2012 年以降の英国の祝日は変わらない)。英国の 4 つの提供元の `supportedYears.from` が 2012 から 1974 になり、これまで `out-of-range` だった 1974〜2011 年の日付が結果を返すようになる。
412
305
 
@@ -428,7 +321,7 @@
428
321
 
429
322
  ## [0.20.0] - 2026-10-25
430
323
 
431
- ### 移行
324
+ ### Migration
432
325
 
433
326
  動作が変わる既存の API はない。サブパス `bizdays-toolkit/fr` が増える。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
434
327
 
@@ -453,7 +346,7 @@
453
346
 
454
347
  ## [0.19.0] - 2026-10-25
455
348
 
456
- ### 移行
349
+ ### Migration
457
350
 
458
351
  動作が変わる既存の API はない(`"after-holiday"` の規則に `skipWeekdays` を付けなければ振替先はこれまでどおり)。繰り返しの規則の形 `{ businessDayOfMonth }` と項目 `skipWeekdays`・`calendar`、診断コード `counting-basis` が増える。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
459
352
 
@@ -477,7 +370,7 @@
477
370
 
478
371
  ## [0.18.0] - 2026-10-25
479
372
 
480
- ### 移行
373
+ ### Migration
481
374
 
482
375
  動作が変わる既存の API はない。同梱の提供元が返す祝日に省略可能な項目 `key` が加わるので、`dayInfo` の結果や `holidaysInYear` の要素を `deepEqual` で比べているテストは期待値に足す(国民の休日・臨時の祝日には付かない)。祝日の規則に省略可能な `keys` が加わる。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
483
376
 
@@ -513,7 +406,7 @@
513
406
 
514
407
  ## [0.17.0] - 2026-10-25
515
408
 
516
- ### 移行
409
+ ### Migration
517
410
 
518
411
  動作が変わる既存の API はない(既定値はこれまでどおり)。`Calendar`・`Schedule`・`HolidayLookup` に項目 `unconfirmedHolidays` が加わり、`createCalendar`・`createSchedule` の設定と `diagnoseCalendar`・`diagnoseSchedule` の第 2 引数が増える。監視のワークフローの改名(`govuk-watch.yml` → `data-watch.yml`)により、cron-job.org の URL を直す(RELEASING.md)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
519
412
 
@@ -540,7 +433,7 @@
540
433
 
541
434
  ## [0.16.0] - 2026-10-23
542
435
 
543
- ### 移行
436
+ ### Migration
544
437
 
545
438
  日時の文字列の区切りは `T` だけになり、空白で区切った文字列(`"2026-11-23 10:00"`)は `invalid-time` の Error になる(これまでは実行時だけ受け付けていた。型 `DateTimeInput` は以前から `T` 区切りだけ)。合成した `dayInfo` に `decidedByPath` が加わるので、`deepEqual` で比べているテストは期待値に足す。ほかは動作が変わらない(祝前日の規則・サブパス・合成の項目の追加)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
546
439
 
@@ -566,7 +459,7 @@
566
459
 
567
460
  ## [0.15.0] - 2026-10-21
568
461
 
569
- ### 移行
462
+ ### Migration
570
463
 
571
464
  `businessDayOnOrAfter` に `cutoff` を指定するときは、時刻を持つ入力(`Date`・日時の文字列・時刻を持つ Temporal の値)を渡す。時刻のない入力(暦日の文字列・`PlainDate`)との組み合わせは、これまで暦日を 0 時として扱い締め時刻を黙って無視していたが、`invalid-argument` の Error になる。ほかは動作が変わらない(規則の絞り込み・カレンダーのメソッド・型の追加)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
572
465
 
@@ -598,7 +491,7 @@
598
491
 
599
492
  ## [0.14.0] - 2026-10-20
600
493
 
601
- ### 移行
494
+ ### Migration
602
495
 
603
496
  動作は変わりません(締め期間と、暦日と時刻から瞬間への変換の追加)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
604
497
 
@@ -619,7 +512,7 @@
619
512
 
620
513
  ## [0.13.0] - 2026-10-20
621
514
 
622
- ### 移行
515
+ ### Migration
623
516
 
624
517
  動作は変わりません(スケジュールから営業日カレンダーを作る関数と、判定の理由の新しい値の追加。CI の改善)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
625
518
 
@@ -641,7 +534,7 @@
641
534
 
642
535
  ## [0.12.0] - 2026-10-20
643
536
 
644
- ### 移行
537
+ ### Migration
645
538
 
646
539
  動作は変わりません(繰り返しの規則の新しい形・`dayInfo` の新しい項目の追加と、診断・CI の改善)。`bizdays-toolkit/jp`・`bizdays-toolkit/uk` の定数 `dataVersion`・`confirmedThrough` が非推奨になったので、使っていれば提供元の項目(`jp.dataVersion`・`england.confirmedThrough` など)に書き換える。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
647
540
 
@@ -680,7 +573,7 @@
680
573
 
681
574
  ## [0.11.0] - 2026-10-19
682
575
 
683
- ### 移行
576
+ ### Migration
684
577
 
685
578
  作業は要りません(繰り返しの規則の新しい形と、カレンダーを合成する関数の追加)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
686
579
 
@@ -705,7 +598,7 @@
705
598
 
706
599
  ## [0.10.0] - 2026-10-19
707
600
 
708
- ### 移行
601
+ ### Migration
709
602
 
710
603
  動作は変わりません(繰り返しの規則・毎年の月日の規則への省略可能な項目の追加と、診断の改善)。`bizdays-toolkit/jp` の `toJapanDate`・`toJapanDateTime` が非推奨になったので、使っていれば `toDateString(input, "Asia/Tokyo")`・`toDateTimeParts(input, "Asia/Tokyo")`(または営業日カレンダー・スケジュールの `dateOf`・`civilOf`)に書き換える。書き換え方は [docs/migration.md](./docs/migration.md)。
711
604
 
@@ -745,7 +638,7 @@
745
638
 
746
639
  ## [0.9.0] - 2026-10-18
747
640
 
748
- ### 移行
641
+ ### Migration
749
642
 
750
643
  作業は要りません(機能の追加だけ)。時刻を必ず持つ入力では `time` の型が `string` になったので、これまでの `null` の分岐は不要になります(残しても動く)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
751
644
 
@@ -962,7 +855,9 @@
962
855
 
963
856
  - 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
964
857
 
965
- [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.9...HEAD
858
+ [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.1...HEAD
859
+ [0.31.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.0...v0.31.1
860
+ [0.31.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.9...v0.31.0
966
861
  [0.30.9]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.8...v0.30.9
967
862
  [0.30.8]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.7...v0.30.8
968
863
  [0.30.7]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.6...v0.30.7
package/README.md CHANGED
@@ -23,7 +23,7 @@ A business-day calendar that combines public holidays with company or store clos
23
23
  - **Recurring rules**: "closed on the 3rd Wednesday", "every other Wednesday", "stocktaking on the last day of the month", "closed on Mondays, moved to the next non-holiday when Monday is a holiday", "the day after (or before) a holiday", "the last weekday before a bank holiday", shift cycles such as four days on and two days off, each with its own behaviour on holidays and an optional effective period
24
24
  - **Day-by-day values and combined calendars**: store hours that change by weekday, holiday and date; a business-day calendar made from such a schedule; and the days on which all (or any) of several calendars are open
25
25
  - **Option diagnostics**: `bizdays-toolkit/diagnose` lists rules that never apply, rules that are shadowed or redundant, rules that have ended, typos in option names and options with no business day at all, without throwing. One line in a test keeps options honest
26
- - **Lightweight, zero dependencies, time-zone safe**: about 12.9 KB min+gzip (about 14.6 KB with Japanese holidays, about 15.1 KB with UK bank holidays, about 13.8 KB with French holidays, about 13.8 KB with Singapore holidays; measured for 0.30.2). Standard JavaScript and `Intl` only, ESM with bundled types; tested on Node.js, Chrome, Firefox, Edge, Safari, Cloudflare Workers, Bun and Deno. Instants such as `Date` are converted to a civil date in the calendar's time zone before evaluation
26
+ - **Lightweight, zero dependencies, time-zone safe**: about 13.6 KB min+gzip (about 15.4 KB with Japanese holidays, about 15.8 KB with UK bank holidays, about 14.5 KB with French holidays, about 14.6 KB with Singapore holidays; measured for 0.31.1). Standard JavaScript and `Intl` only, ESM with bundled types; tested on Node.js, Chrome, Firefox, Edge, Safari, Cloudflare Workers, Bun and Deno. Instants such as `Date` are converted to a civil date in the calendar's time zone before evaluation
27
27
  - **Extensible to other countries and regions**: holiday providers are pluggable through the `HolidayProvider` interface, and `bizdays-toolkit/provider` exposes the calendar arithmetic (nth weekday of a month, Easter, substitute days for holidays on a weekend) that most countries' holidays are built from
28
28
 
29
29
  ## Installation
@@ -88,7 +88,7 @@ A calendar is built from the holiday provider and your closures: `closedWeekdays
88
88
  | `skipWeekdays: [0, 6]` | With `"after-holiday"`: also skip weekends ("June 15, or the next business day") |
89
89
  | `effectiveFrom`, `effectiveTo` | The period the rule is in effect |
90
90
 
91
- `dayInfoOn` tells you why a day is open or closed (`reason`, `name`, `optionPath`). Every bundled holiday that recurs each year has a stable `key` (`vernal-equinox`, `good-friday`, `hari-raya-puasa`, …), so a rule can select individual holidays that no date pattern can express. Details: [Business-day calendars](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#business-day-calendars), [Recurring rules](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#recurring-rules), [Holiday keys](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#holiday-keys), [Common recipes](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#common-recipes).
91
+ `dayInfoOn` tells you why a day is open or closed (`reason`, `name`, `optionPath`), and `nextClosedDay` / `previousClosedDay` find the next or previous closed day. Every bundled holiday that recurs each year has a stable `key` (`vernal-equinox`, `good-friday`, `hari-raya-puasa`, …), so a rule can select individual holidays that no date pattern can express. Details: [Business-day calendars](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#business-day-calendars), [Recurring rules](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#recurring-rules), [Holiday keys](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#holiday-keys), [Common recipes](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#common-recipes).
92
92
 
93
93
  ### Due dates, schedules and combined calendars
94
94
 
@@ -112,7 +112,7 @@ diagnoseCalendar({
112
112
  // [["warning", "unknown-option", "closeAnnual"], ["info", "redundant", "closedRecurringRules[0]"]]
113
113
  ```
114
114
 
115
- `diagnoseCalendar` and `diagnoseSchedule` return every problem in the options without throwing: typos (with a suggestion), rules that never match, rules shadowed by earlier ones, rules whose removal changes nothing, options with no business day, and, with `{ asOf }`, rules that have ended. `assert.deepEqual(diagnoseCalendar(options), [])` in a test keeps options honest. Details: [Option diagnostics](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#option-diagnostics), [Errors](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#errors).
115
+ `diagnoseCalendar` and `diagnoseSchedule` return every problem in the options without throwing: typos (with a suggestion), rules that never match, rules shadowed by earlier ones, rules whose removal changes nothing (the reported rules can be removed all together), options with no business day, and, with `{ asOf }`, rules that have ended. `assert.deepEqual(diagnoseCalendar(options), [])` in a test keeps options honest. Details: [Option diagnostics](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#option-diagnostics), [Errors](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#errors).
116
116
 
117
117
  ### Other countries and regions
118
118
 
@@ -133,7 +133,7 @@ Versioning follows [Semantic Versioning](https://semver.org/). See [RELEASING.md
133
133
  - Official data updates (new, moved and one-off holidays by law, Official Gazette or proclamation, fixed equinox days in Japan, newly published years on GOV.UK, changes to the French Labour Code, newly gazetted years and revised dates in Singapore) are released as **patch** versions, so they reach you with either `^` or `~`
134
134
  - To freeze the holiday results, pin an exact version (for example `"bizdays-toolkit": "x.y.z"`)
135
135
  - The reflected data is shown by the provider's `dataVersion` (for Japan, the year and month of the Official Gazette reflected; for the UK, France and Singapore, the year and month of the GOV.UK, data.gouv.fr or data.gov.sg data reflected) and `confirmedThrough` (`jp.dataVersion`, `england.confirmedThrough` and so on). The module-level constants `dataVersion` and `confirmedThrough` in `bizdays-toolkit/jp` and `bizdays-toolkit/uk` are deprecated since 0.12.0 and will be removed in 1.0.0
136
- - Before 1.0.0, minor versions may contain breaking changes. What you need to change when moving between minor versions is listed in the [migration guide](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/migration.md) (Japanese) and in the "移行" (migration) part of each version in the CHANGELOG
136
+ - Before 1.0.0, minor versions may contain breaking changes. What you need to change when moving between minor versions is listed in the [migration guide](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/migration.md) (Japanese) and in each version of the CHANGELOG. The steps in English are in the Migration part of each version in the CHANGELOG (written in English from 0.31.0; in Japanese for earlier versions)
137
137
  - Decision reasons (`reason`), holiday kinds (`kind`), error codes and diagnostic codes may gain values in future versions. When you branch on their values, handle "anything else" too (see "互換性の約束", the compatibility promise, in [RELEASING.md](https://github.com/inohan77/bizdays-toolkit/blob/main/RELEASING.md))
138
138
 
139
139
  ## Data sources
@@ -159,10 +159,10 @@ export interface CombineCalendarsOptions {
159
159
  */
160
160
  export interface BusinessDayOnOrAfterOptions {
161
161
  /**
162
- * 締め時刻 "HH:mm"(カレンダーのタイムゾーン)。
163
- * "HH:mm" のみ。入力の時刻は分の精度で比べるため(秒を持つ締め時刻は、入力の秒と比べられない)。
162
+ * 締め時刻 "HH:mm" または "HH:mm:ss"(カレンダーのタイムゾーン)。
163
+ * 入力の時刻は分の精度(秒を切り捨てた分)で、その分の始まりと比べる("14:00:30" なら 14:00 の入力は締めの前、14:01 は後)。
164
164
  * 入力の時刻がこの時刻以降なら、その日は対象にしない。時刻を持たない入力(暦日の文字列・Temporal の PlainDate など)
165
- * と組み合わせると code: "invalid-argument" の Error(締め時刻が黙って無視されるのを防ぐため)
165
+ * と組み合わせると code: "invalid-argument" の RangeError(締め時刻が黙って無視されるのを防ぐため)
166
166
  */
167
167
  readonly cutoff?: string;
168
168
  }
@@ -213,6 +213,13 @@ export interface Calendar<Kind extends string = string> extends HolidayLookup<Ki
213
213
  nextBusinessDay(input: DateInput): DateString;
214
214
  /** 前営業日(入力日の前日以前) */
215
215
  previousBusinessDay(input: DateInput): DateString;
216
+ /**
217
+ * 翌休業日(入力日の翌日以降の、営業日でない日)。searchDayLimit 日のうちに見つからなければ
218
+ * code: "no-closed-day" の RangeError
219
+ */
220
+ nextClosedDay(input: DateInput): DateString;
221
+ /** 前休業日(入力日の前日以前の、営業日でない日)。見つからなければ code: "no-closed-day" の RangeError */
222
+ previousClosedDay(input: DateInput): DateString;
216
223
  /**
217
224
  * 入力日が営業日ならその日、そうでなければ翌営業日。cutoff で締め時刻を指定できる
218
225
  * (cutoff を指定するときの入力は、時刻を持つもの。時刻のない入力と組み合わせると invalid-argument)
@@ -312,7 +319,8 @@ export interface CalendarFromScheduleOptions {
312
319
  }
313
320
  /**
314
321
  * スケジュール(createSchedule)から営業日カレンダーを作る。isOpen が true を返す値の日を営業日とする
315
- * (true だけを営業日とし、1 や "open" のような boolean でない値を返した日は休業日になる)。
322
+ * isOpen は boolean を返す関数にする(boolean でない値を返すと code: "invalid-argument" の RangeError。作成時に曜日の値と
323
+ * holidayPolicy: { value } の値で呼んで確かめ、ほかの値の日は判定したときに確かめる)。
316
324
  * 営業時間表のような日ごとの値が設定の正本で、営業日の計算(加減算・調整・期日など)も同じ設定から行いたいときに使う
317
325
  * (営業日カレンダーを別に書いて同期を取る必要がなくなる)。
318
326
  *