bizdays-toolkit 0.30.0 → 0.30.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
@@ -4,6 +4,31 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.30.1] - 2026-10-30
8
+
9
+ 0.30.0 の改名の後始末の版です。新しい設定・関数・診断コードはありません。公開物の `.js` の挙動が変わるのは Fixed の 1 つだけです。
10
+
11
+ ### Fixed
12
+
13
+ - 日本の祝日の提供元とほかの提供元を合わせた設定(`holidayProvider: [jp, england]` など)で、旧名の `kinds: ["national"]` が、ほかの提供元の `"regular"` の祝日(英国の bank holidays など)にも当たっていた。0.30.0 の退行で、改名は結果を変えないという約束(`docs/decisions.md` の 54 番)から外れていた。0.22.x と同じく、「種別が `"national"` の祝日、または ID が `"JP"` の提供元が返した `"regular"` の祝日」に当てる。日本の提供元だけの設定の結果は変わらない。パッチで出す根拠は `docs/decisions.md` の 55 番。`id` を変えて包んだ日本の提供元は ID `"JP"` の提供元とみなさないので、`"national"` は 0.30.0 と同じく何にも当たらない(下の Changed の診断のメッセージが理由を示す。`docs/migration.md`)
14
+
15
+ ### Changed
16
+
17
+ - 診断: 和集合の設定の `"national"` の `deprecated-option` のメッセージに、当てている祝日と、1.0.0 で ID `"JP"` の提供元を含む設定の `"national"` が `invalid-option` になることを添えた。ID `"JP"` の提供元がない設定で `"national"` の規則が何にも当たらないときは、`never-matches` のメッセージに改名の前の名前の可能性を添えた(`code` は変わらない)
18
+ - `migrateCalendarOptions`・`migrateScheduleOptions`: `kinds` の `"national"` は、祝日の提供元がすべて ID `"JP"` のときだけ書き換える。和集合では、新しい名前の `"regular"` がほかの提供元の祝日にも当たるので書き換えず、`changes` にも出さない(0.30.0 は和集合でも書き換えていた)
19
+ - ガイド(英日): 保存した設定の `"national"` を `migrate…` で書き換えるには、読み込み時に付ける提供元を入れてから呼ぶこと(提供元がなければ書き換えない)、週の第 n 営業日(`businessDayOfWeek`)も週が対応年の外にかかる日は `out-of-range` になることを足した。月の関数の引数名を `closingDayOfMonth`・`input` に直した
20
+ - `docs/migration.md`: 和集合での `"national"` の扱いと 1.0.0 以降の書き方(日本の提供元を包んで種別を付け替える)、`id` を変えて包んだ提供元の注、週の第 n 営業日と対応年の端、0.30.0 の引数の名前の表を足した。「旧名は取り消し線と診断が示す」を、`combineCalendars`・`createCalendarFromSchedule`・`dueDate`・`withSubstituteDays` の設定の旧名は示さないので検索すること、に直した
21
+ - 型定義の説明: `skipWeekdays` の説明が書けない項目(`WeekdayPattern.dayOfMonth`・`DayOfMonthPattern.weekday`)に付いていたのを正しい項目に移し、例の旧名 `day` を `dayOfMonth` に直した。`@example`・TSDoc の旧名(`holidays`・`recurring` など)を直し、`BusinessDayOfWeekPattern` に対応年の端の挙動を、`HolidayProvider.id` に ISO にない地域の ID(`"FR-AM"`)を書いた。`.js` は変わらない
22
+ - 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:")を直した
23
+ - `docs/decisions.md`: 55 番(直前の版で入った退行の修正はパッチ)を足し、42・50・52・54 番に追記した。`RELEASING.md`: パッチの区分に退行の修正を足し、互換性の約束から型の名前の列挙をやめ、旧名(`outOfRange`)を直した。`src/core/schedule.ts`・`calendar.ts` の冒頭の判定の順番の写しを削り、ガイドと 12 番を指すようにした
24
+
25
+ ### 開発
26
+
27
+ - `scripts/check-names.ts` に、形を分けるための `?: never` の項目に TSDoc が付いていないこと(C13)と、今の状態を書いた文書・スクリプト・型定義の TSDoc に 0.30.0 の旧名が残っていないこと(C14)の検査を足した(`etc/naming.md`)。0.30.0 に当てると、C13 は 2 か所、C14 はガイドの引数名・RELEASING.md・`check-readme-examples.ts` の補い・型定義の `@example` と `day:` を検出する
28
+ - `scripts/check-size.ts`: 上限を変えた版で、CHANGELOG の測定値(「(測定 N)」の形)を 1 つも照合できなければ失敗にし、照合した件数を出すようにした。0.30.0 の節は測定値をこの形で書いておらず、照合が 0 件のまま合格していた(記載の値は、測定の後の内部の関数名の変更で公開物と 6〜7 バイト違っていた)
29
+ - 和集合の `"national"` のテスト(`test/national-union.test.ts`)を足した。日本の提供元を包んだ設定との関係を対応年のすべてで確かめ、公開済みの 0.22.2 の結果(2020〜2027 年)を錨にする(`test/fixtures/national-union-0.22.2.json`)
30
+ - サイズ(gzip): ルート 17,646 → 18,054(測定 18,054)、`./jp` 19,890 → 20,288(測定 20,288)、`./diagnose` 23,919 → 24,492(測定 24,492)。和集合の `"national"` の判定とメッセージのため。上限は変えていない(ルート・`./jp`・`./diagnose` は上限の 97〜98%)
31
+
7
32
  ## [0.30.0] - 2026-10-27
8
33
 
9
34
  公開する名前を 1 つの規則に合わせて改めた版です(`docs/decisions.md` の 54 番)。名前の整理の版を区切るため、版の番号を 0.30.0 にしました(0.23.0〜0.29.0 は欠番)。旧名は 1.0.0 まで受け付けます。作業は「移行」と `docs/migration.md` の 0.30.0 の節にあります。
@@ -704,7 +729,8 @@
704
729
 
705
730
  - 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
706
731
 
707
- [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.0...HEAD
732
+ [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.1...HEAD
733
+ [0.30.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.30.0...v0.30.1
708
734
  [0.30.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.22.2...v0.30.0
709
735
  [0.22.2]: https://github.com/inohan77/bizdays-toolkit/compare/v0.22.1...v0.22.2
710
736
  [0.22.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.22.0...v0.22.1
package/README.md CHANGED
@@ -24,7 +24,7 @@ A business-day calendar that combines public holidays with company or store clos
24
24
  - **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
25
25
  - **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
26
26
  - **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
27
- - **Lightweight, zero dependencies, time-zone safe**: about 12.7 KB min+gzip (about 14.4 KB with Japanese holidays, about 14.8 KB with UK bank holidays, about 13.6 KB with French holidays, about 13.6 KB with Singapore holidays; measured for 0.30.0). 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
+ - **Lightweight, zero dependencies, time-zone safe**: about 13.0 KB min+gzip (about 14.7 KB with Japanese holidays, about 15.1 KB with UK bank holidays, about 13.9 KB with French holidays, about 13.9 KB with Singapore holidays; measured for 0.30.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
28
28
  - **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
29
29
 
30
30
  ## Installation
@@ -69,7 +69,7 @@ The [guide](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md)
69
69
  | `metropole`, `alsaceMoselle` | `bizdays-toolkit/fr` | `Europe/Paris` | 2000–2099 | data.gouv.fr "Jours fériés en France" |
70
70
  | `sg` | `bizdays-toolkit/sg` | `Asia/Singapore` | 2020–2027 | data.gov.sg (Ministry of Manpower) |
71
71
 
72
- Each holiday carries its date, name (and English name), `kind` (national, substitute, citizens' holiday, bank holiday and so on, by country) and `confirmed` (whether the date is officially fixed; the Japanese equinox days and UK bank holidays after the last published year are predictions). Years after the supported range are an error unless `outOfRangePolicy: "ignore"` is set, and `unconfirmedHolidayPolicy: "throw"` stops any result that would depend on a predicted holiday. Details: [Bundled holiday providers](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#bundled-holiday-providers), [Unconfirmed holidays](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#unconfirmed-holidays).
72
+ Each holiday carries its date, name (and English name), `kind` (such as `regular`, `substitute` and `special`; the values differ by country) and `confirmed` (whether the date is officially fixed; the Japanese equinox days and UK bank holidays after the last published year are predictions). Years after the supported range are an error unless `outOfRangePolicy: "ignore"` is set, and `unconfirmedHolidayPolicy: "throw"` stops any result that would depend on a predicted holiday. Details: [Bundled holiday providers](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#bundled-holiday-providers), [Unconfirmed holidays](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md#unconfirmed-holidays).
73
73
 
74
74
  ### Business-day calendars and recurring rules
75
75
 
@@ -1,18 +1,6 @@
1
1
  /**
2
2
  * 祝日と、会社・店舗の休業日を組み合わせた営業日カレンダー。
3
- *
4
- * 1 日の判定は次の優先順位で行う(上が優先):
5
- * 1. openDates … 臨時営業日(個別の日付・期間)
6
- * 2. closedDates … 臨時休業日(個別の日付・期間)
7
- * 3. closedAnnualDates … 毎年の休業日(月日・月日の期間。年をまたぐ期間も可)
8
- * 4. openRecurringRules・closedRecurringRules(holidayOverlapPolicy: "over-holiday")… 祝日でも当てはめる繰り返しの規則
9
- * 5. 祝日 … holidayPolicy に従う(closed: 休業 / open: 営業 / ignore: 判定に使わない)
10
- * 6. openRecurringRules・closedRecurringRules("under-holiday"・"after-holiday" の振替先)… 繰り返しの規則
11
- * 7. closedWeekdays … 定休日の曜日
12
- * 8. それ以外は営業日
13
- *
14
- * 繰り返しの規則は openRecurringRules が closedRecurringRules より優先。"after-holiday" の規則は、
15
- * 祝日には当てはめず、その日以降で最初の祝日でない日に当てはめる(振替)
3
+ * 1 日の判定の優先順位は docs/guide.md の「Business-day calendars」と docs/decisions.md の 12 番。
16
4
  *
17
5
  * 内部では、営業日かどうか(真偽値)を返すスケジュール(createSchedule)として作っている。
18
6
  * 営業日の探索・調整・月の営業日などの機能は buildCalendar に切り出し、作成済みのカレンダーを
@@ -325,7 +313,7 @@ export interface CalendarFromScheduleOptions {
325
313
  * (営業日カレンダーを別に書いて同期を取る必要がなくなる)。
326
314
  *
327
315
  * - isOpen は値だけで決まる純粋な関数であること(日付・時刻・外部の状態を見ない)。営業日の探索は isOpen を繰り返し呼ぶので、
328
- * 結果が変わる関数を渡すと探索の結果が呼ぶたびに変わる。日付で変えたい条件は、スケジュールの規則(dates・recurring)に書く
316
+ * 結果が変わる関数を渡すと探索の結果が呼ぶたびに変わる。日付で変えたい条件は、スケジュールの規則(dates・recurringRules)に書く
329
317
  * - dayInfoOn の reason は、スケジュールの reason と営業・休業の組み合わせ(date → "open-date"/"closed-date"、annual → "open-annual"/
330
318
  * "closed-annual"、recurring → "open-recurring"/"closed-recurring"、holiday → "holiday"、weekday → "open-weekday"/"closed-weekday")。
331
319
  * name・holiday・shiftedFrom・optionPath はスケジュールの結果をそのまま引き継ぐ
@@ -3,7 +3,7 @@ import { checkUnknownKeys, IssueCollector, plainError, rangeError } from "./erro
3
3
  import { renameKeys, writtenKey } from "./renamed.js";
4
4
  import { parseTimeOfDay, toCivil } from "./input.js";
5
5
  import { checkClosingDay, closingDayIn, closingMonth as calendarClosingMonth, dayOfMonth, formatMonth, isDayOfMonthValue, parseMonth, shiftMonth, } from "./month.js";
6
- import { buildSchedule, compileAnnualRules, compileDateRules, compileHolidaySource, compileRecurringRules, createHolidayLookup, infoOfSchedule, isWeekday, mapDays, RECURRING_RULE_KEYS, usesJp, } from "./schedule.js";
6
+ import { buildSchedule, compileAnnualRules, compileDateRules, compileHolidaySource, compileRecurringRules, createHolidayLookup, infoOfSchedule, isWeekday, mapDays, RECURRING_RULE_KEYS, jpUsage, } from "./schedule.js";
7
7
  const CALENDAR_OPTION_KEYS = [
8
8
  "holidayProvider",
9
9
  "timeZone",
@@ -54,8 +54,8 @@ export function compileCalendarOptions(c, options) {
54
54
  const annual = compileAnnualRules(c, "closedAnnualDates", o["closedAnnualDates"], () => false, true);
55
55
  const open = compileDateRules(c, "openDates", o["openDates"], () => true, true);
56
56
  const closed = compileDateRules(c, "closedDates", o["closedDates"], () => false, true);
57
- const openRecurringRules = compileRecurringRules(c, "openRecurringRules", o["openRecurringRules"], () => true, RECURRING_RULE_KEYS, "calendar", writtenKey(places, written, "openRecurringRules"), usesJp(source));
58
- const closedRecurringRules = compileRecurringRules(c, "closedRecurringRules", o["closedRecurringRules"], () => false, RECURRING_RULE_KEYS, "calendar", writtenKey(places, written, "closedRecurringRules"), usesJp(source));
57
+ const openRecurringRules = compileRecurringRules(c, "openRecurringRules", o["openRecurringRules"], () => true, RECURRING_RULE_KEYS, "calendar", writtenKey(places, written, "openRecurringRules"), jpUsage(source));
58
+ const closedRecurringRules = compileRecurringRules(c, "closedRecurringRules", o["closedRecurringRules"], () => false, RECURRING_RULE_KEYS, "calendar", writtenKey(places, written, "closedRecurringRules"), jpUsage(source));
59
59
  return {
60
60
  schedule: {
61
61
  source,
@@ -1,8 +1,8 @@
1
1
  import { lengthOfMonth, fromDayNumber, isValidDate, parseDate, toDayNumber, } from "./date.js";
2
2
  import { compileCalendarOptions } from "./calendar.js";
3
3
  import { IssueCollector, rangeError } from "./errors.js";
4
- import { RENAMED_KEYS } from "./renamed.js";
5
- import { compileScheduleOptions, createBasis, createHolidayLookup, createResolver, inPeriod, matchMonthDay, matchPattern, } from "./schedule.js";
4
+ import { RENAMED_KEYS, RENAMED_VALUES } from "./renamed.js";
5
+ import { compileScheduleOptions, createBasis, createHolidayLookup, createResolver, inPeriod, jpUsage, matchMonthDay, matchPattern, } from "./schedule.js";
6
6
  function editDistance(a, b) {
7
7
  const d = Array.from({ length: a.length + 1 }, (_, i) => Array.from({ length: b.length + 1 }, (_, j) => (i === 0 ? j : j === 0 ? i : 0)));
8
8
  for (let i = 1; i <= a.length; i++) {
@@ -310,7 +310,9 @@ function analyze(c, compiled, isCalendar) {
310
310
  if (source.providers.length === 0 || !window)
311
311
  return false;
312
312
  let found = false;
313
- eachDay(window, (n) => (found = inPeriod(rule, n) && matchPattern(rule, fromDayNumber(n), holidayOfSafe)));
313
+ eachDay(window, (n) => (found =
314
+ inPeriod(rule, n) &&
315
+ matchPattern(rule, fromDayNumber(n), holidayOfSafe, undefined, lookup.fromJp)));
314
316
  return found;
315
317
  };
316
318
  const businessDayRuleMatches = (rule) => {
@@ -321,7 +323,7 @@ function analyze(c, compiled, isCalendar) {
321
323
  if (!inPeriod(rule, n))
322
324
  return false;
323
325
  try {
324
- found = matchPattern(rule, fromDayNumber(n), holidayOfSafe, basis);
326
+ found = matchPattern(rule, fromDayNumber(n), holidayOfSafe, basis, lookup.fromJp);
325
327
  }
326
328
  catch {
327
329
  found = false;
@@ -347,7 +349,11 @@ function analyze(c, compiled, isCalendar) {
347
349
  : matchesAnyDay(rule, cycle);
348
350
  if (!matches) {
349
351
  unused.add(rule);
350
- c.warning("never-matches", rule.path, holidayBased
352
+ const national = holidayBased &&
353
+ source.providers.length > 0 &&
354
+ jpUsage(source) === "none" &&
355
+ rule.kinds?.has(RENAMED_VALUES.find((x) => x.key === "kinds").from) === true;
356
+ c.warning("never-matches", rule.path, (holidayBased
351
357
  ? source.providers.length === 0
352
358
  ? "This rule matches no day: there are no holidays without a holiday provider"
353
359
  : rule.holiday
@@ -361,7 +367,10 @@ function analyze(c, compiled, isCalendar) {
361
367
  : "This rule matches no day: no month has that many business days of the counting basis in the selected months within its effective period"
362
368
  : rule.effectiveFrom === null && rule.effectiveTo === null
363
369
  ? "This rule matches no day (for example, a day that does not exist in the selected months)"
364
- : "This rule matches no day within its effective period");
370
+ : "This rule matches no day within its effective period") +
371
+ (national
372
+ ? '; "national" was renamed to "regular" in 0.30.0 and is not read so without a provider whose ID is "JP"'
373
+ : ""));
365
374
  return;
366
375
  }
367
376
  if (businessDayBased &&
@@ -22,10 +22,11 @@ function clone(v) {
22
22
  return out;
23
23
  }
24
24
  const join = (path, key) => (path ? `${path}.${key}` : key);
25
- function usesJp(options) {
25
+ function onlyJp(options) {
26
26
  const raw = options["holidayProvider"] ?? options["holidays"];
27
- const list = Array.isArray(raw) ? raw : [raw];
28
- return list.some((p) => typeof p === "object" && p !== null && p.id === "JP");
27
+ const list = raw === undefined ? [] : Array.isArray(raw) ? raw : [raw];
28
+ return (list.length > 0 &&
29
+ list.every((p) => typeof p === "object" && p !== null && p.id === "JP"));
29
30
  }
30
31
  function renameObject(value, places, path, changes) {
31
32
  const out = {};
@@ -61,7 +62,7 @@ function migrate(input, places, ruleLists, policyValueKey) {
61
62
  throw typeError("invalid-argument", "options must be a plain object");
62
63
  const changes = [];
63
64
  const copied = clone(input);
64
- const jp = usesJp(copied);
65
+ const jp = onlyJp(copied);
65
66
  const written = new Map();
66
67
  for (const key of Object.keys(copied)) {
67
68
  const r = RENAMED_KEYS.find((x) => places.includes(x.place) && x.from === key);
@@ -22,7 +22,8 @@ export interface RenamedValue {
22
22
  readonly to: string;
23
23
  }
24
24
  /**
25
- * @internal 改名した値の表(0.30.0)。kinds の "national" は、ID が "JP" の祝日の提供元を使う設定でだけ読み替える
25
+ * @internal 改名した値の表(0.30.0)。kinds の "national" は、ID が "JP" の祝日の提供元を使う設定でだけ扱いを変える。
26
+ * 作成と診断は値を読み替えずに知らせ(schedule.ts の reportNational)、migrate… は日本の提供元だけの設定で書き換える(docs/decisions.md の 55 番)
26
27
  */
27
28
  export declare const RENAMED_VALUES: readonly RenamedValue[];
28
29
  /** @internal 改名を見つけたときの扱い(作成・診断は記録して読み替える。合成などの記録先がない設定は読み替えるだけ) */
@@ -1,21 +1,6 @@
1
1
  /**
2
2
  * 日ごとに値を返すスケジュール(営業時間・受付枠など、曜日・祝日・特定日で変わるもの)。
3
- *
4
- * 1 日の値は次の優先順位で決まる(上が優先):
5
- * 1. dates … 個別の日付・期間(配列で先に書いたものが優先)
6
- * 2. annual … 毎年の月日・月日の期間(年をまたぐ期間も可。配列で先に書いたものが優先)
7
- * 3. recurring(holidayOverlapPolicy: "over-holiday")… 祝日でも当てはめる繰り返しの規則
8
- * 4. 祝日 … holiday の規則("weekday": 曜日どおり / { sameAs: 曜日 }: その曜日の値 / { value }: 指定の値)
9
- * 5. recurring("under-holiday"・"after-holiday" の振替先)… 繰り返しの規則(配列で先に書いたものが優先)
10
- * 6. weekly … 曜日ごとの値
11
- *
12
- * "under-holiday" の規則は、祝日の扱いが "weekday"(曜日どおり)なら祝日にも当てはまる。
13
- * "after-holiday" の規則は、祝日には当てはめず、その日以降で最初の祝日でない日に当てはめる(振替)。
14
- * 毎年の月日・繰り返しの規則の有効期間(effectiveFrom・effectiveTo)の外では、その規則は書かれていないのと同じ。
15
- * 祝日の翌日の規則(dayAfterHoliday)は、前日が祝日でその日自身は祝日でない日に当てはまる(提供元の祝日だけで判定)。
16
- * 祝前日の規則(dayBeforeHoliday)は、翌日が祝日でその日自身は祝日でない日に当てはまる(同じく提供元の祝日だけ)。
17
- * 祝日の規則(holiday: true。kinds で種別を、keys で個別の祝日を絞れる)は、「祝日の上」の段階で判定する
18
- *
3
+ * 1 日の値を決める優先順位は docs/guide.md の「Day-by-day values」と docs/decisions.md の 12 番。
19
4
  * 営業日カレンダー(createCalendar)は、このスケジュールの真偽値版として作られている。
20
5
  */
21
6
  import { type DateString, type Weekday } from "./date.ts";
@@ -100,12 +85,6 @@ export interface WeekdayPattern {
100
85
  readonly anchor?: DateString;
101
86
  /** 当てはめる月(省略時はすべての月) */
102
87
  readonly months?: readonly Month[];
103
- /**
104
- * holidayOverlapPolicy: "after-holiday" と組で、祝日に加えて飛ばす曜日(0 = 日曜日〜6 = 土曜日)。
105
- * 本来の日が祝日かこの曜日なら、その日以降で最初の、祝日でもこの曜日でもない日に振り替える
106
- * (例: 月曜定休で、月曜が祝日なら翌平日(土曜日には落とさない)は { weekday: 1, holidayOverlapPolicy: "after-holiday", skipWeekdays: [6] })。
107
- * weekday 自身は含められない。"after-holiday" 以外と組にすると invalid-option
108
- */
109
88
  readonly dayOfMonth?: never;
110
89
  readonly businessDayOfMonth?: never;
111
90
  readonly calendar?: never;
@@ -129,11 +108,6 @@ export interface DayOfMonthPattern {
129
108
  readonly dayOfMonth: DayOfMonth | readonly DayOfMonth[];
130
109
  /** 当てはめる月(省略時はすべての月) */
131
110
  readonly months?: readonly Month[];
132
- /**
133
- * holidayOverlapPolicy: "after-holiday" と組で、祝日に加えて飛ばす曜日。本来の日が祝日かこの曜日なら、その日以降で最初の、
134
- * 祝日でもこの曜日でもない日に振り替える(例: 「6 月 15 日は創立記念日。土日祝なら翌営業日」は
135
- * { day: 15, months: [6], holidayOverlapPolicy: "after-holiday", skipWeekdays: [0, 6] })。"after-holiday" 以外と組にすると invalid-option
136
- */
137
111
  readonly weekday?: never;
138
112
  readonly nth?: never;
139
113
  readonly interval?: never;
@@ -163,7 +137,7 @@ export interface DayOfMonthPattern {
163
137
  * 祝日の段階が先に決めてこの規則は当てはまらない(曜日の規則と同じ優先順位)。「第 1 営業日は祝日でも休業」は "over-holiday" で書く。
164
138
  * holidayPolicy: "closed" では祝日が基準の営業日にならないので "over-holiday" は結果を変えない(診断が info で知らせる)。
165
139
  *
166
- * スケジュール(createSchedule の recurring)では、スケジュール自身に営業・休業の概念がないので、数える基準にする作成済みの
140
+ * スケジュール(createSchedule の recurringRules)では、スケジュール自身に営業・休業の概念がないので、数える基準にする作成済みの
167
141
  * カレンダーを calendar で指定する(必須。タイムゾーンはスケジュールと同じであること)。カレンダー(closedRecurringRules・openRecurringRules)
168
142
  * では calendar は指定できない(invalid-option。基準は自分の設定で決まる)。
169
143
  * @public
@@ -199,6 +173,7 @@ export interface BusinessDayOfMonthPattern {
199
173
  * その週にない回は当てはまらない。数える基準・calendar・holidayOverlapPolicy の扱いは businessDayOfMonth と同じ
200
174
  * (カレンダーでは自分の設定の「繰り返しの規則をすべて除いた判定」、スケジュールでは必須の calendar で数える)。
201
175
  * 週の始まりは地域・業種で違うので、weekStart は省略できない。months は当てはまる日の月で絞る。
176
+ * 週の 7 日をすべて数えるので、週の一部が祝日の提供元の対応年の外にかかる日は、outOfRangePolicy: "throw" では out-of-range になる。
202
177
  * @public
203
178
  */
204
179
  export interface BusinessDayOfWeekPattern {
@@ -336,7 +311,7 @@ export interface CyclePattern {
336
311
  }
337
312
  /**
338
313
  * 祝日(提供元の祝日である日)。kinds で祝日の種別を、keys で個別の祝日を絞れる(省略時はすべての祝日)。
339
- * 「祝日の上」の段階(holidayPolicy・スケジュールの holiday より先)で判定し、祝日の既定の扱いの例外を書く
314
+ * 「祝日の上」の段階(holidayPolicy より先)で判定し、祝日の既定の扱いの例外を書く
340
315
  * (例: 「2027 年 4 月から祝日も営業」「振替休日は診療」「5 月の祝日は特別営業時間」)。
341
316
  * 当てはまる日は祝日なので、holidayOverlapPolicy は指定できない(指定すると invalid-option)。
342
317
  * @public
@@ -380,7 +355,11 @@ export interface HolidayPattern<Kind extends string = string> {
380
355
  export type RecurringPattern<Kind extends string = string> = (WeekdayPattern & ({
381
356
  /** 祝日に当たったら、その日以降で最初の祝日でない日に振り替える */
382
357
  readonly holidayOverlapPolicy: "after-holiday";
383
- /** 振替先を探すときに、祝日に加えて飛ばす曜日 */
358
+ /**
359
+ * 振替先を探すときに、祝日に加えて飛ばす曜日(0 = 日曜日〜6 = 土曜日)。本来の日が祝日かこの曜日なら、その日以降で最初の、
360
+ * 祝日でもこの曜日でもない日に振り替える(例: 月曜定休で、月曜が祝日なら翌平日(土曜日には落とさない)は
361
+ * { weekday: 1, holidayOverlapPolicy: "after-holiday", skipWeekdays: [6] })。weekday 自身は含められない
362
+ */
384
363
  readonly skipWeekdays?: readonly Weekday[];
385
364
  } | {
386
365
  /** 祝日に当たったときの扱い(既定: "under-holiday") */
@@ -389,7 +368,11 @@ export type RecurringPattern<Kind extends string = string> = (WeekdayPattern & (
389
368
  })) | (DayOfMonthPattern & ({
390
369
  /** 祝日に当たったら、その日以降で最初の祝日でない日に振り替える */
391
370
  readonly holidayOverlapPolicy: "after-holiday";
392
- /** 振替先を探すときに、祝日に加えて飛ばす曜日 */
371
+ /**
372
+ * 振替先を探すときに、祝日に加えて飛ばす曜日(0 = 日曜日〜6 = 土曜日)。本来の日が祝日かこの曜日なら、その日以降で最初の、
373
+ * 祝日でもこの曜日でもない日に振り替える(例: 「6 月 15 日は創立記念日。土日祝なら翌営業日」は
374
+ * { dayOfMonth: 15, months: [6], holidayOverlapPolicy: "after-holiday", skipWeekdays: [0, 6] })
375
+ */
393
376
  readonly skipWeekdays?: readonly Weekday[];
394
377
  } | {
395
378
  /** 祝日に当たったときの扱い(既定: "under-holiday") */
@@ -674,6 +657,8 @@ export interface RecurringRuleCompiled<Value> extends CompiledPeriod {
674
657
  readonly holiday: boolean;
675
658
  /** 祝日・祝日の翌日・祝前日の規則で絞る種別(null はすべての祝日) */
676
659
  readonly kinds: ReadonlySet<string> | null;
660
+ /** kinds の旧名 "national" を、日本の提供元が返した "regular" の祝日にも当てるか(docs/decisions.md の 55 番) */
661
+ readonly nationalOfJp: boolean;
677
662
  /** 祝日・祝日の翌日・祝前日の規則で絞る識別子(null はすべての祝日) */
678
663
  readonly keys: ReadonlySet<string> | null;
679
664
  /** 祝日・祝日の翌日・祝前日の規則で絞る曜日(null はすべての曜日) */
@@ -692,18 +677,20 @@ export type BasisOfMonth = (year: number, month: number) => readonly number[];
692
677
  /** @internal カレンダーの判定関数から、月ごとに結果をキャッシュする基準を作る */
693
678
  export declare function basisFromPredicate(isOpen: (date: DateString) => boolean): BasisOfMonth;
694
679
  /** @internal 繰り返しの規則を検証して取り込む */
695
- export declare function compileRecurringRules<Value>(c: IssueCollector, path: string, entries: unknown, valueOf: (entry: Record<string, unknown>, path: string) => Value | undefined, keys: readonly string[], context: "calendar" | "schedule", writtenPath?: string, jp?: boolean): RecurringRuleCompiled<Value>[];
680
+ export declare function compileRecurringRules<Value>(c: IssueCollector, path: string, entries: unknown, valueOf: (entry: Record<string, unknown>, path: string) => Value | undefined, keys: readonly string[], context: "calendar" | "schedule", writtenPath?: string, jp?: JpUsage): RecurringRuleCompiled<Value>[];
696
681
  /** @internal その日の祝日を返す関数(祝日・祝日の翌日・祝前日の規則の判定に使う。提供元の対応年の外は祝日でないとみなすこと) */
697
682
  export type HolidayOf = (date: DateString) => Holiday<string> | undefined;
683
+ /** @internal その日の祝日(HolidayOf が返したもの)が、ID が "JP" の提供元のものか */
684
+ export type FromJp = (date: DateString) => boolean;
698
685
  /**
699
686
  * @internal 繰り返しの規則の形(曜日・第 n 回目・周期・日・第 n 営業日・祝日・祝日の翌日・祝前日・月)がその日に当てはまるか。
700
687
  * 有効期間は考えない(規則の診断で、形どうしの包含を調べるために分けている)。
701
688
  * 祝日に従属する規則は holidayOf で判定し、holidayOf を渡さなければ当てはまらない。
702
689
  * 第 n 営業日の規則は、規則自身の基準(スケジュールの calendar)か basis で数え、どちらもなければ当てはまらない
703
690
  */
704
- export declare function matchPattern(rule: RecurringRuleCompiled<unknown>, date: DateString, holidayOf?: HolidayOf, basis?: BasisOfMonth): boolean;
691
+ export declare function matchPattern(rule: RecurringRuleCompiled<unknown>, date: DateString, holidayOf?: HolidayOf, basis?: BasisOfMonth, fromJp?: FromJp): boolean;
705
692
  /** @internal 繰り返しの規則がその日に当てはまるか(有効期間を含む) */
706
- export declare function matchRecurring(rule: RecurringRuleCompiled<unknown>, date: DateString, holidayOf: HolidayOf, basis?: BasisOfMonth): boolean;
693
+ export declare function matchRecurring(rule: RecurringRuleCompiled<unknown>, date: DateString, holidayOf: HolidayOf, basis?: BasisOfMonth, fromJp?: FromJp): boolean;
707
694
  /**
708
695
  * @internal 第 n 営業日の規則が自分の設定を基準にする場合の基準を作る(繰り返しの規則をすべて除いた判定で営業日か)。
709
696
  * 基準が要らない設定(第 n 営業日の規則がない、またはすべて calendar を持つ)では undefined
@@ -716,13 +703,19 @@ export interface HolidaySource<Kind extends string> {
716
703
  readonly outOfRangePolicy: "throw" | "ignore";
717
704
  readonly unconfirmedHolidayPolicy: "accept" | "throw";
718
705
  }
719
- /** @internal 日本の祝日の提供元(ID が "JP"。包んだものを含む)を使うか(0.30.0 で改名した kinds の "national" を読み替えるため) */
720
- export declare function usesJp(source: HolidaySource<string>): boolean;
706
+ /**
707
+ * @internal 日本の祝日の提供元(ID が "JP"。包んだものを含む)の使い方(kinds の旧名 "national" の扱いを決めるため)。
708
+ * "mixed" はほかの ID の提供元と合わせて使う設定
709
+ */
710
+ export type JpUsage = "none" | "only" | "mixed";
711
+ /** @internal 設定の祝日の提供元の、日本の提供元の使い方 */
712
+ export declare function jpUsage(source: HolidaySource<string>): JpUsage;
721
713
  /** @internal 祝日の提供元とタイムゾーンの設定を検証する */
722
714
  export declare function compileHolidaySource<Kind extends string>(c: IssueCollector, options: Record<string, unknown>): HolidaySource<Kind>;
723
715
  /** @internal 祝日を調べる機能を作る(設定は検証済みであること) */
724
716
  export declare function createHolidayLookup<Kind extends string>(source: HolidaySource<Kind>): HolidayLookup<Kind> & {
725
717
  holidayOfDate(date: DateString): Holiday<Kind> | undefined;
718
+ fromJp: FromJp;
726
719
  };
727
720
  /** @internal 検証済みのスケジュールの規則 */
728
721
  export interface CompiledSchedule<Value, Kind extends string> {
@@ -1,6 +1,6 @@
1
1
  import { addDays, lengthOfMonth, formatDate, fromDayNumber, isValidDate, parseDate, toDayNumber, weekdayOf, } from "./date.js";
2
2
  import { checkUnknownKeys, IssueCollector, rangeError } from "./errors.js";
3
- import { renameKeys, renameValue, writtenKey } from "./renamed.js";
3
+ import { RENAMED_VALUES, renameKeys, renameValue, writtenKey } from "./renamed.js";
4
4
  import { instantToCivil, toCivil, toDateTimeParts, toInstant, validateTimeZone, } from "./input.js";
5
5
  import { HOLIDAY_KEY_PATTERN } from "./types.js";
6
6
  const MONTH_DAY_RE = /^(\d{2})-(\d{2})$/;
@@ -182,7 +182,7 @@ function checkSet(c, path, raw, valid, expected) {
182
182
  }
183
183
  return new Set(list);
184
184
  }
185
- export function compileRecurringRules(c, path, entries, valueOf, keys, context, writtenPath = path, jp = false) {
185
+ export function compileRecurringRules(c, path, entries, valueOf, keys, context, writtenPath = path, jp = "none") {
186
186
  if (entries === undefined)
187
187
  return [];
188
188
  if (!Array.isArray(entries)) {
@@ -198,8 +198,7 @@ export function compileRecurringRules(c, path, entries, valueOf, keys, context,
198
198
  }
199
199
  const written = `${writtenPath}[${i}]`;
200
200
  const entry = renameKeys(c, ["rule"], written, rawEntry);
201
- if (jp && entry["kinds"] !== undefined)
202
- entry["kinds"] = renameValue(c, "rule", "kinds", `${written}.kinds`, entry["kinds"]);
201
+ const nationalOfJp = jp !== "none" && reportNational(c, `${written}.kinds`, entry["kinds"], jp === "mixed");
203
202
  checkUnknownKeys(c, p, entry, keys);
204
203
  const value = valueOf(entry, p);
205
204
  const name = checkName(c, p, entry["name"]);
@@ -528,6 +527,7 @@ export function compileRecurringRules(c, path, entries, valueOf, keys, context,
528
527
  dayBeforeHoliday: hasBefore,
529
528
  holiday: hasHoliday,
530
529
  kinds,
530
+ nationalOfJp,
531
531
  keys: holidayKeys,
532
532
  weekdays,
533
533
  months,
@@ -540,7 +540,7 @@ export function compileRecurringRules(c, path, entries, valueOf, keys, context,
540
540
  });
541
541
  return rules;
542
542
  }
543
- export function matchPattern(rule, date, holidayOf, basis) {
543
+ export function matchPattern(rule, date, holidayOf, basis, fromJp) {
544
544
  const { year, month, day } = parseDate(date);
545
545
  if (rule.months && !rule.months.has(month))
546
546
  return false;
@@ -573,7 +573,9 @@ export function matchPattern(rule, date, holidayOf, basis) {
573
573
  return false;
574
574
  if (rule.weekdays && !rule.weekdays.has(weekdayOf(date)))
575
575
  return false;
576
- const selected = (h) => (rule.kinds === null || rule.kinds.has(h.kind)) &&
576
+ const selected = (h) => (rule.kinds === null ||
577
+ rule.kinds.has(h.kind) ||
578
+ (rule.nationalOfJp && h.kind === "regular" && fromJp?.(h.date) === true)) &&
577
579
  (rule.keys === null || (h.key !== undefined && rule.keys.has(h.key)));
578
580
  if (rule.holiday) {
579
581
  const h = holidayOf(date);
@@ -609,8 +611,8 @@ export function matchPattern(rule, date, holidayOf, basis) {
609
611
  }
610
612
  return rule.days.has(day) || (rule.days.has(-1) && day === dim);
611
613
  }
612
- export function matchRecurring(rule, date, holidayOf, basis) {
613
- return inPeriod(rule, toDayNumber(date)) && matchPattern(rule, date, holidayOf, basis);
614
+ export function matchRecurring(rule, date, holidayOf, basis, fromJp) {
615
+ return inPeriod(rule, toDayNumber(date)) && matchPattern(rule, date, holidayOf, basis, fromJp);
614
616
  }
615
617
  export function createBasis(compiled, lookup) {
616
618
  if (!compiled.recurring.some((r) => r.businessDays !== null && r.basis === null))
@@ -662,8 +664,25 @@ function validateProvider(c, path, p) {
662
664
  return bad('"holidaysInYear" must be a function');
663
665
  return true;
664
666
  }
665
- export function usesJp(source) {
666
- return source.providers.some((p) => p.id === "JP");
667
+ function reportNational(c, path, kinds, mixed) {
668
+ if (!Array.isArray(kinds))
669
+ return false;
670
+ const { from, to } = RENAMED_VALUES.find((r) => r.key === "kinds");
671
+ let found = false;
672
+ kinds.forEach((v, i) => {
673
+ if (v !== from)
674
+ return;
675
+ found = true;
676
+ c.warning("deprecated-option", `${path}[${i}]`, `"${from}" was renamed to "${to}" in 0.30.0` +
677
+ (mixed
678
+ ? `; here it matches Japan's "${to}" and other providers' "${from}" holidays. From 1.0.0 it is an invalid-option with a "JP" provider: wrap the Japanese provider and rename your own "${from}" kind (see the migration guide)`
679
+ : ""));
680
+ });
681
+ return found;
682
+ }
683
+ export function jpUsage(source) {
684
+ const jp = source.providers.filter((p) => p.id === "JP").length;
685
+ return jp === 0 ? "none" : jp === source.providers.length ? "only" : "mixed";
667
686
  }
668
687
  export function compileHolidaySource(c, options) {
669
688
  const raw = options["holidayProvider"];
@@ -776,10 +795,12 @@ function checkNames(names) {
776
795
  export function createHolidayLookup(source) {
777
796
  const { providers, timeZone, outOfRangePolicy, unconfirmedHolidayPolicy } = source;
778
797
  const yearCache = new Map();
798
+ const jpCache = new Map();
779
799
  function holidayMap(year) {
780
800
  let map = yearCache.get(year);
781
801
  if (!map) {
782
802
  map = new Map();
803
+ const jpDates = new Set();
783
804
  for (const provider of providers) {
784
805
  const { from, to } = provider.supportedYears;
785
806
  if (year < from || year > to) {
@@ -788,11 +809,15 @@ export function createHolidayLookup(source) {
788
809
  throw rangeError("out-of-range", `Holidays for ${provider.id} are supported for ${from}-${to}; requested ${year}`);
789
810
  }
790
811
  for (const h of loadProviderYear(provider, year)) {
791
- if (!map.has(h.date))
792
- map.set(h.date, h);
812
+ if (map.has(h.date))
813
+ continue;
814
+ map.set(h.date, h);
815
+ if (provider.id === "JP")
816
+ jpDates.add(h.date);
793
817
  }
794
818
  }
795
819
  yearCache.set(year, map);
820
+ jpCache.set(year, jpDates);
796
821
  }
797
822
  return map;
798
823
  }
@@ -826,6 +851,7 @@ export function createHolidayLookup(source) {
826
851
  outOfRange: outOfRangePolicy,
827
852
  unconfirmedHolidays: unconfirmedHolidayPolicy,
828
853
  holidayOfDate,
854
+ fromJp: (date) => jpCache.get(parseDate(date).year)?.has(date) === true,
829
855
  dateOf,
830
856
  civilOf: ((input) => toDateTimeParts(input, timeZone)),
831
857
  instantOf: (date, time) => toInstant(date, time, timeZone),
@@ -921,7 +947,7 @@ export function compileScheduleOptions(c, options) {
921
947
  }
922
948
  const annual = compileAnnualRules(c, "annualDates", o["annualDates"], requiredValue(c), false);
923
949
  const dates = compileDateRules(c, "dates", o["dates"], requiredValue(c), false);
924
- const recurring = compileRecurringRules(c, "recurringRules", o["recurringRules"], requiredValue(c), [...RECURRING_RULE_KEYS, "value"], "schedule", writtenKey(["source", "schedule"], written, "recurringRules"), usesJp(source));
950
+ const recurring = compileRecurringRules(c, "recurringRules", o["recurringRules"], requiredValue(c), [...RECURRING_RULE_KEYS, "value"], "schedule", writtenKey(["source", "schedule"], written, "recurringRules"), jpUsage(source));
925
951
  for (const rule of recurring) {
926
952
  if (rule.businessDays === null)
927
953
  continue;
@@ -953,7 +979,7 @@ export function createResolver(compiled, lookup) {
953
979
  const prev = addDays(date, -k);
954
980
  if (!isHolidayOfNeighbour(prev) && !rule.skipWeekdays?.has(weekdayOf(prev)))
955
981
  return undefined;
956
- if (matchRecurring(rule, prev, holidayOfNeighbour))
982
+ if (matchRecurring(rule, prev, holidayOfNeighbour, undefined, lookup.fromJp))
957
983
  return prev;
958
984
  }
959
985
  return undefined;
@@ -987,7 +1013,7 @@ export function createResolver(compiled, lookup) {
987
1013
  return make(byAnnual.value, "annual", byAnnual, byAnnual.name);
988
1014
  if (holiday) {
989
1015
  const over = recurring.find((r) => r.holidayOverlapPolicy === "over-holiday" &&
990
- matchRecurring(r, date, holidayOfNeighbour, basis));
1016
+ matchRecurring(r, date, holidayOfNeighbour, basis, lookup.fromJp));
991
1017
  if (over)
992
1018
  return make(over.value, "recurring", over, over.name);
993
1019
  if (holidayRule !== "ignore") {
@@ -995,7 +1021,7 @@ export function createResolver(compiled, lookup) {
995
1021
  return make(value, "holiday", null, holiday.name);
996
1022
  }
997
1023
  const under = recurring.find((r) => r.holidayOverlapPolicy === "under-holiday" &&
998
- matchRecurring(r, date, holidayOfNeighbour, basis));
1024
+ matchRecurring(r, date, holidayOfNeighbour, basis, lookup.fromJp));
999
1025
  if (under)
1000
1026
  return make(under.value, "recurring", under, under.name);
1001
1027
  return make(weekly[weekday], "weekday", null, undefined);
@@ -1003,7 +1029,7 @@ export function createResolver(compiled, lookup) {
1003
1029
  for (const rule of recurring) {
1004
1030
  if (rule.skipWeekdays?.has(weekday))
1005
1031
  continue;
1006
- if (matchRecurring(rule, date, holidayOfNeighbour, basis))
1032
+ if (matchRecurring(rule, date, holidayOfNeighbour, basis, lookup.fromJp))
1007
1033
  return make(rule.value, "recurring", rule, rule.name);
1008
1034
  if (hasShift && rule.holidayOverlapPolicy === "after-holiday") {
1009
1035
  const origin = shiftedOrigin(rule, date);
@@ -45,7 +45,10 @@ export interface Holiday<Kind extends string = string> {
45
45
  * @public
46
46
  */
47
47
  export interface HolidayProvider<Kind extends string = string> {
48
- /** ISO 3166-1 alpha-2(国)または ISO 3166-2(地域)のコード。例: "JP", "US-CA" */
48
+ /**
49
+ * ISO 3166-1 alpha-2(国)・ISO 3166-2(地域)のコード、または該当するコードがない地域ではその形に合わせた独自のコード
50
+ * (大文字で書く)。例: "JP", "US-CA", "FR-AM"
51
+ */
49
52
  readonly id: string;
50
53
  /** 祝日を判定する基準のタイムゾーン(IANA 名)。例: "Asia/Tokyo" */
51
54
  readonly timeZone: string;
@@ -7,10 +7,10 @@
7
7
  * @example
8
8
  * import { createCalendar } from "bizdays-toolkit";
9
9
  * import { metropole } from "bizdays-toolkit/fr";
10
- * const paris = createCalendar({ holidays: metropole, closedWeekdays: [0, 6] });
10
+ * const paris = createCalendar({ holidayProvider: metropole, closedWeekdays: [0, 6] });
11
11
  *
12
12
  * @example Lundi de Pentecôte を「連帯の日」として出勤日にする企業(法律上は祝日のまま。既定の扱いの例外として書く)
13
- * createCalendar({ holidays: metropole, closedWeekdays: [0, 6],
13
+ * createCalendar({ holidayProvider: metropole, closedWeekdays: [0, 6],
14
14
  * openRecurringRules: [{ holiday: true, keys: ["pentecost-monday"], name: "Journée de solidarité" }] });
15
15
  */
16
16
  import type { Holiday, HolidayProvider } from "../core/types.ts";
@@ -4,7 +4,7 @@
4
4
  * @example
5
5
  * import { createCalendar } from "bizdays-toolkit";
6
6
  * import { sg } from "bizdays-toolkit/sg";
7
- * const calendar = createCalendar({ holidays: sg, closedWeekdays: [0, 6] });
7
+ * const calendar = createCalendar({ holidayProvider: sg, closedWeekdays: [0, 6] });
8
8
  */
9
9
  import type { Holiday, HolidayProvider } from "../core/types.ts";
10
10
  import { type SgHolidayKind } from "./rules.ts";
@@ -7,7 +7,7 @@
7
7
  * @example
8
8
  * import { createCalendar } from "bizdays-toolkit";
9
9
  * import { scotland } from "bizdays-toolkit/uk";
10
- * const calendar = createCalendar({ holidays: scotland, closedWeekdays: [0, 6] });
10
+ * const calendar = createCalendar({ holidayProvider: scotland, closedWeekdays: [0, 6] });
11
11
  */
12
12
  import type { Holiday, HolidayProvider } from "../core/types.ts";
13
13
  import { type UkHolidayKind } from "./rules.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bizdays-toolkit",
3
- "version": "0.30.0",
3
+ "version": "0.30.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",