bizdays-toolkit 0.31.7 → 0.31.8
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 +13 -1
- package/README.md +1 -1
- package/dist/core/errors.d.ts +8 -2
- package/dist/core/input.js +1 -1
- package/dist/core/migrate.js +2 -2
- package/dist/core/types.d.ts +3 -2
- package/dist/fr/rules.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ Entries from 0.31.0 are in English. Earlier entries remain in Japanese (their **
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.31.8] - 2026-11-13
|
|
10
|
+
|
|
11
|
+
This version fixes one input that was silently accepted and corrects type descriptions and documents. Results of calls that were written correctly do not change.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- A Temporal-like date-time whose `hour` was `null`, a string or another value that is not a number (such as `{ year: 2026, month: 12, day: 28, hour: "15", minute: 30 }`) was read as a date without a time, so `civilOf` returned `time: null` and a check such as `open <= time` was silently false. It now throws `invalid-time`, as `minute: null` does since 0.31.7 (design decisions 6). A Temporal-like value with `minute` but without `hour` is still read as a date. If you build the value from a form or a database, convert `hour` to a number first
|
|
16
|
+
- Type descriptions: `KnownErrorCode` now says that `no-business-day` also covers an nth business day that the month does not have and a calendar's closing month without its own period, and that `time-zone-conflict` also covers calendars combined with `combineCalendars` and the basis calendar of a schedule's nth-business-day rule (where the fix is to make them with the same time zone, not to set `timeZone`). `HolidayProvider` now describes long runs of holidays as below
|
|
17
|
+
- Documentation: the provider guide, the description of `HolidayProvider` and the design decisions (24) said that within a run of holidays longer than 31 days, rules for the day before or after a holiday do not match and `"after-holiday"` rules are not moved. In fact rules for the day before or after a holiday match the day before and the day after a run of any length, and an `"after-holiday"` rule is not moved only when its own day is more than 31 days before the first day after the run. The documents now say so; results are unchanged
|
|
18
|
+
- Documentation: the guide listed 2008 and 2059 as the years when two French holidays fall on the same day; Ascension Day also falls on May 8 in 2070, 2081 and 2092. The English README said that years after a provider's supported range are an error; years before it are too. The provider guide said that the four exceptional keys keep a word the rule would drop; `new-year` drops the possessive "s" as well. The design decisions (1, 3, 9) now list every case of `out-of-range`, describe `invalid-input` as a value in none of the accepted forms, and describe the functions that fix an argument of another by what they are rather than by name. Results are unchanged
|
|
19
|
+
|
|
9
20
|
## [0.31.7] - 2026-11-12
|
|
10
21
|
|
|
11
22
|
This version makes three kinds of options that were silently accepted throw, as the design decisions (6, 8) promise, gives a code to the remaining exceptions without one, and corrects documents. Options that were written correctly give the same results as before. Options that write both a single date and a range in one entry, write `null` in one of seven options, or have a hole in an array now throw; each item below says how to rewrite them.
|
|
@@ -948,7 +959,8 @@ This version rebuilds the `redundant` diagnostic so that the reported rules can
|
|
|
948
959
|
|
|
949
960
|
- 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
|
|
950
961
|
|
|
951
|
-
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.
|
|
962
|
+
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.8...HEAD
|
|
963
|
+
[0.31.8]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.7...v0.31.8
|
|
952
964
|
[0.31.7]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.6...v0.31.7
|
|
953
965
|
[0.31.6]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.5...v0.31.6
|
|
954
966
|
[0.31.5]: https://github.com/inohan77/bizdays-toolkit/compare/v0.31.4...v0.31.5
|
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ The [guide](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md)
|
|
|
68
68
|
| `metropole`, `alsaceMoselle` | `bizdays-toolkit/fr` | `Europe/Paris` | 2000–2099 | data.gouv.fr "Jours fériés en France" |
|
|
69
69
|
| `sg` | `bizdays-toolkit/sg` | `Asia/Singapore` | 2020–2027 | data.gov.sg (Ministry of Manpower) |
|
|
70
70
|
|
|
71
|
-
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
|
|
71
|
+
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 outside 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
72
|
|
|
73
73
|
### Business-day calendars and recurring rules
|
|
74
74
|
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -30,7 +30,10 @@ export type KnownErrorCode =
|
|
|
30
30
|
| "invalid-argument"
|
|
31
31
|
/** 設定の誤り。設定は営業日カレンダー・スケジュールを作る関数が検証するオブジェクトで、オブジェクトでないことも含む(decisions.md の 8 番) */
|
|
32
32
|
| "invalid-option"
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* 同じタイムゾーンでなければならないものが食い違う(1 つの設定の祝日の提供元どうしで、timeZone の指定がない。
|
|
35
|
+
* 合成するカレンダーどうし。スケジュールと、第 n 営業日の規則の数える基準のカレンダー)
|
|
36
|
+
*/
|
|
34
37
|
| "time-zone-conflict"
|
|
35
38
|
/**
|
|
36
39
|
* 対応している年の範囲の外(提供元の対応年、日付の計算や瞬間の変換が 1000〜9999 年の外に出た、祝日の一覧に渡した年が
|
|
@@ -43,7 +46,10 @@ export type KnownErrorCode =
|
|
|
43
46
|
| "invalid-provider"
|
|
44
47
|
/** 祝日の提供元が返したデータの誤り */
|
|
45
48
|
| "invalid-provider-data"
|
|
46
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* 営業日が見つからない(探索が searchDayLimit 日を超えた、月の営業日が第 n 営業日の n に足りない、カレンダーの締めの月に
|
|
51
|
+
* 固有の期間がない)
|
|
52
|
+
*/
|
|
47
53
|
| "no-business-day"
|
|
48
54
|
/** searchDayLimit の日数のうちに休業日が見つからない(nextClosedDay・previousClosedDay) */
|
|
49
55
|
| "no-closed-day";
|
package/dist/core/input.js
CHANGED
|
@@ -120,7 +120,7 @@ export function toCivil(input, timeZone) {
|
|
|
120
120
|
throw rangeError("invalid-date", `Invalid date: year must be an integer from 1000 to 9999: ${describeValue(input.year)}`);
|
|
121
121
|
}
|
|
122
122
|
const date = formatDate(input.year, input.month, input.day);
|
|
123
|
-
if (
|
|
123
|
+
if (input.hour !== undefined) {
|
|
124
124
|
return {
|
|
125
125
|
date,
|
|
126
126
|
minutes: wallTime(input.hour, input.minute === undefined ? 0 : input.minute),
|
package/dist/core/migrate.js
CHANGED
|
@@ -20,8 +20,8 @@ function clone(v) {
|
|
|
20
20
|
}
|
|
21
21
|
const join = (path, key) => (path ? `${path}.${key}` : key);
|
|
22
22
|
function onlyJp(options) {
|
|
23
|
-
const raw = options["holidayProvider"]
|
|
24
|
-
const list = raw === undefined ? [] : Array.isArray(raw) ? raw : [raw];
|
|
23
|
+
const raw = options["holidayProvider"] === undefined ? options["holidays"] : options["holidayProvider"];
|
|
24
|
+
const list = raw === undefined ? [] : Array.isArray(raw) ? Array.from(raw) : [raw];
|
|
25
25
|
return (list.length > 0 &&
|
|
26
26
|
list.every((p) => typeof p === "object" && p !== null && p.id === "JP"));
|
|
27
27
|
}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -38,8 +38,9 @@ export interface Holiday<Kind extends string = string> {
|
|
|
38
38
|
* holidaysInYear が返すデータは、年ごとに初めて使うときに検証され、誤りがあれば
|
|
39
39
|
* code: "invalid-provider-data" の例外になる。返した祝日は、契約の項目(date・name・nameEn・names・
|
|
40
40
|
* kind・confirmed・key)だけを持つ変更できないオブジェクトに複製される。
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* 祝日が長く続くとき、"after-holiday" の規則は、本来の日が振り替わる先の日より 31 日を超えて前にあると振り替わらない
|
|
42
|
+
* (振替元をさかのぼるのは 31 日まで。祝日の前後の規則は連続の長さによらず当てはまる。長い休業は closedDates・
|
|
43
|
+
* closedAnnualDates で書く。decisions.md の 24 番)。
|
|
43
44
|
*
|
|
44
45
|
* 項目を足すときのバージョンは RELEASING.md の区分の表による。1.0.0 以降、マイナーバージョンで足す項目は省略可能なものに限る
|
|
45
46
|
* (必須にすると、自作の提供元が型エラーになるため)。
|
package/dist/fr/rules.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* - 固定日の祝日(1/1・5/1・5/8・7/14・8/15・11/1・11/11・12/25。Alsace-Moselle は 12/26 も)と、
|
|
5
5
|
* 復活祭から決まる祝日(Lundi de Pâques = +1 日、Ascension = +39 日、Lundi de Pentecôte = +50 日。
|
|
6
6
|
* Alsace-Moselle は Vendredi saint = −2 日も)を規則で計算する。振替はない
|
|
7
|
-
* - 2 つの祝日が同じ日に当たる年(復活祭が 3 月 23 日なら 5 月 1 日 = Ascension
|
|
7
|
+
* - 2 つの祝日が同じ日に当たる年(復活祭が 3 月 23 日なら 5 月 1 日 = Ascension、3 月 30 日なら 5 月 8 日 = Ascension)は、
|
|
8
8
|
* 復活祭から決まる祝日の名称・識別子で 1 件にする
|
|
9
9
|
* (data.gouv.fr の JSON と同じ扱い。提供元は 1 日に 1 件を返す契約のため)
|
|
10
10
|
* - 名称は data.gouv.fr の表記(フランス語)。nameEn はライブラリの英訳
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bizdays-toolkit",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.8",
|
|
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",
|