bizdays-toolkit 0.11.0 → 0.11.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/README.md +38 -0
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,11 +4,20 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.11.1] - 2026-10-19
8
+
9
+ ライブラリのコードは 0.11.0 と同じ。
10
+
11
+ ### Changed
12
+
13
+ - README: よくある設定の例に、「その日が月の第何営業日か」(`businessDaysBetween` + 1。`nthBusinessDayOfMonth` の逆算)、「次の休業日と、その理由」(`daysBetween` で営業日でない最初の日)、「銀行の営業日」(3 行の設定。着金日は合成で求める)の 3 件を足した
14
+ - CHANGELOG: 0.11.0 の「移行」に `docs/migration.md` への案内を足した(GitHub Release の本文は公開後に直してあり、これでリポジトリ側もそろう)
15
+
7
16
  ## [0.11.0] - 2026-10-19
8
17
 
9
18
  ### 移行
10
19
 
11
- 作業は要りません(繰り返しの規則の新しい形と、カレンダーを合成する関数の追加)。
20
+ 作業は要りません(繰り返しの規則の新しい形と、カレンダーを合成する関数の追加)。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
12
21
 
13
22
  ### Added
14
23
 
@@ -291,7 +300,8 @@
291
300
 
292
301
  - 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
293
302
 
294
- [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.11.0...HEAD
303
+ [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.11.1...HEAD
304
+ [0.11.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.11.0...v0.11.1
295
305
  [0.11.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.10.0...v0.11.0
296
306
  [0.10.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.9.1...v0.10.0
297
307
  [0.9.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.9.0...v0.9.1
package/README.md CHANGED
@@ -296,6 +296,44 @@ const special = createSchedule<Hours>({
296
296
  special.valueOn("2027-01-01"); // null
297
297
  ```
298
298
 
299
+ **Which business day of the month a date is**: count the business days from the first of the month up to (and excluding) the date, then add one. `businessDaysBetween` excludes `to`, so the date itself is the `+ 1`. This is the inverse of `nthBusinessDayOfMonth`.
300
+
301
+ ```ts
302
+ import { monthOf } from "bizdays-toolkit";
303
+
304
+ const calendar = createCalendar({ holidays: jp, closedWeekdays: [0, 6] });
305
+ const businessDayIndex = (date: string): number =>
306
+ calendar.isBusinessDay(date) ? calendar.businessDaysBetween(`${monthOf(date)}-01`, date) + 1 : 0;
307
+ businessDayIndex("2026-10-07"); // 5 (the 5th business day of October)
308
+ businessDayIndex("2026-10-03"); // 0 (Saturday: not a business day)
309
+ calendar.nthBusinessDayOfMonth("2026-10", 5); // "2026-10-07"
310
+ ```
311
+
312
+ **The next closed day and why**: there is no `nextClosedDay`, but `daysBetween` returns `dayInfo` for every day, so take the first one that is not a business day.
313
+
314
+ ```ts
315
+ import { addDays } from "bizdays-toolkit";
316
+
317
+ const calendar = createCalendar({ holidays: jp, closedWeekdays: [0, 6] });
318
+ const nextClosedDay = (date: string) =>
319
+ calendar.daysBetween(addDays(date, 1), addDays(date, 60)).find((d) => !d.businessDay);
320
+ nextClosedDay("2026-10-05")?.date; // "2026-10-10"
321
+ nextClosedDay("2026-10-05")?.reason; // "closed-weekday"
322
+ nextClosedDay("2026-10-11")?.reason; // "holiday" (Sports Day, October 12)
323
+ ```
324
+
325
+ **Business days of Japanese banks**: banks are closed on weekends, holidays and December 31 to January 3, so a bank calendar is three lines. Combine it with your own calendar for a remittance date (see "Combining calendars").
326
+
327
+ ```ts
328
+ const bank = createCalendar({
329
+ holidays: jp,
330
+ closedWeekdays: [0, 6],
331
+ closedAnnual: [{ from: "12-31", to: "01-03", name: "Bank holiday period" }],
332
+ });
333
+ bank.isBusinessDay("2026-12-30"); // true
334
+ bank.nextBusinessDay("2026-12-30"); // "2027-01-04"
335
+ ```
336
+
299
337
  **Build per-store calendars from shared options**: options are plain objects, so spread and extend them.
300
338
 
301
339
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bizdays-toolkit",
3
- "version": "0.11.0",
3
+ "version": "0.11.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. / 祝日と営業日のカレンダー(タイムゾーン対応・日本の祝日は内閣府、英国の bank holidays は GOV.UK のデータで全日照合)",
5
5
  "keywords": [
6
6
  "bank-holidays",