bizdays-toolkit 0.20.0 → 0.21.0
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 +24 -1
- package/README.md +16 -14
- package/dist/uk/rules.d.ts +7 -4
- package/dist/uk/rules.js +162 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.21.0] - 2026-10-25
|
|
8
|
+
|
|
9
|
+
### 移行
|
|
10
|
+
|
|
11
|
+
動作が変わる既存の API はない(2012 年以降の英国の祝日は変わらない)。英国の 4 つの提供元の `supportedYears.from` が 2012 から 1974 になり、これまで `out-of-range` だった 1974〜2011 年の日付が結果を返すようになる。
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- 英国の 4 つの提供元(`england`・`wales`・`scotland`・`northernIreland`)の対応年を 1974 年まで広げた(これまで 2012 年から)。GOV.UK のデータがない年は、2000〜2011 年は当時の政府が公表した一覧(DTI・BERR・directgov・Scottish Executive/Government・nidirect の Web Archive)を正として The Gazette の国王の布告と北アイルランドの Order で全日を照合し(`test/fixtures/uk-2000-2011-government-lists.json`)、1974〜1999 年は一覧が存在しないので Schedule 1 と The Gazette の布告・Order を正とし、Hansard の書面答弁がある年はそれを第二の出典とした(`test/fixtures/uk-1974-1999-proclamations.json`。テストは Schedule 1 を別に書いた規則で計算し(復活祭は米国海軍天文台の表)、布告の日と合わせて提供元の結果と一致することを確かめる)。出典の記録は `docs/sources/uk-bank-holidays-1974-1999.md`・`docs/sources/uk-bank-holidays-2000-2011.md`。Scotland の 3 日(2010-01-04・2010-12-27・2011-01-04)は当時の一覧にあるが布告がなく、一覧に従って振替日として返す。布告が見つからなかった 1987 年分の毎年の布告と 1975 年・1986〜1990 年の北アイルランドの Order(The Gazette の索引の欠け)は規則どおりに返し、フィクスチャの `unverified` に記録した。臨時の祝日と移動: 1977 年 Silver Jubilee bank holiday(England・Wales・NI は 6 月 7 日、Spring は 6 月 6 日に移動。Scotland は 6 月 6 日)、1981 年 Royal Wedding bank holiday(7 月 29 日)、1995 年の VE Day 50 周年(England・Wales・NI は Early May を 5 月 8 日に移動、Scotland は 5 月 8 日を "Additional bank holiday" として追加)、1999 年 12 月 31 日("Additional bank holiday"。名称は政府の答弁の呼び方に限り、固有の名称がない日は中立の名称)、2002 年 Golden Jubilee(6 月 3 日。Spring は 6 月 4 日に移動)、2011 年 Royal Wedding(4 月 29 日)。毎年布告される日の始まり(England・Wales・NI の Early May と Scotland の Spring は 1978 年から、St Andrew's Day は 2007 年から)を符号化した。振替日の名称の割り当てが当時の一覧・布告と今の GOV.UK で違う年(12 月 25 日が土曜日の 1976・1982・1993・1999・2004 年、Scotland の 1 月 1 日が土曜日の 1977・1983・1994・2000・2005 年、Scotland の 12 月 25 日が日曜日の 1977・1983・1988・1994・2005 年、2011 年の 12 月)は当時の出典に合わせた
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- README・`docs/guide.md`・`docs/guide.ja.md`: 英国の対応年を 1974〜2099 年に改め、1974〜1999 年と 2000〜2011 年の出典、布告のない 3 日・`unverified`・振替日の割り当ての違いの説明を足した。国の記述順を対応年数の多い順(日本 → 英国 → フランス → シンガポール)に揃えた(README の提供元の表・節の見出し・照合のデータの説明・ライセンスの表記・箇条書き、ガイドの各国の節・識別子の表、providers、`RELEASING.md` の各国の節、`package.json` の description。`data-watch.yml` の照合の順は実行順なので変えていない)
|
|
20
|
+
- README: ライセンスの節を「MIT License。全文は LICENSE(リンク)」の形にした
|
|
21
|
+
- `RELEASING.md`: 英国の 1974〜2011 年は監視の対象外で、出典の読み違いが見つかったときだけ直す、と書いた
|
|
22
|
+
- `docs/decisions.md`: 49 番(英国の対応年の拡大と、GOV.UK のない年の正の決め方。一覧のない年は布告が正、`unverified`、`year >= N` の条件の意味)を追加した
|
|
23
|
+
|
|
24
|
+
### 開発
|
|
25
|
+
|
|
26
|
+
- テスト: `test/uk-1974-1999.test.ts`・`test/uk-2000-2011.test.ts` と、フィクスチャ `test/fixtures/uk-1974-1999-proclamations.json`・`test/fixtures/uk-2000-2011-government-lists.json` を追加した。出典の収集の記録を `docs/sources/` に置いた
|
|
27
|
+
- サイズの上限(`size-limits.json`)を上げた。`./uk` 7,500 → 9,000(測定 8,576。1974〜2011 年の `RENAMED`・臨時の祝日・移動の表のため)(gzip)
|
|
28
|
+
|
|
7
29
|
## [0.20.0] - 2026-10-25
|
|
8
30
|
|
|
9
31
|
### 移行
|
|
@@ -543,7 +565,8 @@
|
|
|
543
565
|
|
|
544
566
|
- 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
|
|
545
567
|
|
|
546
|
-
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.
|
|
568
|
+
[Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.21.0...HEAD
|
|
569
|
+
[0.21.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.20.0...v0.21.0
|
|
547
570
|
[0.20.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.19.0...v0.20.0
|
|
548
571
|
[0.19.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.18.0...v0.19.0
|
|
549
572
|
[0.18.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.17.1...v0.18.0
|
package/README.md
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
|
|
20
20
|
A business-day calendar that combines public holidays with company or store closures.
|
|
21
21
|
|
|
22
|
-
- **Holidays verified day by day against official data**: Japan (Cabinet Office, 1955 to the latest year in the Official Gazette),
|
|
22
|
+
- **Holidays verified day by day against official data**: Japan (Cabinet Office, 1955 to the latest year in the Official Gazette), the UK (GOV.UK; for 1974–2011 the Royal Proclamations in The Gazette, and from 2000 the government lists of the time; England, Wales, Scotland and Northern Ireland), France (data.gouv.fr; metropolitan France and Alsace-Moselle, verified for 2006–2031) and Singapore (Ministry of Manpower on data.gov.sg, 2020 onwards). Every date is checked in the tests, differences are watched daily and shipped as patch versions
|
|
23
23
|
- **Business-day arithmetic**: closed weekdays, annual closures (across the new year too), specific closed and open dates and holidays combine into "N business days later", "next business day after the cutoff" and month-based due dates with the four adjustment conventions used in finance
|
|
24
24
|
- **Recurring rules**: "closed on the 3rd Wednesday", "every other Wednesday", "stocktaking on the last day of the month", "closed on Mondays, or the next weekday when Monday is a holiday", "the day after (or before) a holiday", 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 11.0 KB min+gzip (about 12.9 KB with Japanese holidays, about
|
|
27
|
+
- **Lightweight, zero dependencies, time-zone safe**: about 11.0 KB min+gzip (about 12.9 KB with Japanese holidays, about 12.8 KB with UK bank holidays, about 11.9 KB with French holidays, about 11.9 KB with Singapore holidays; measured for 0.20.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
|
|
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
|
|
@@ -60,14 +60,14 @@ The [guide](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/guide.md)
|
|
|
60
60
|
|
|
61
61
|
## What you can do
|
|
62
62
|
|
|
63
|
-
### Holidays of Japan,
|
|
63
|
+
### Holidays of Japan, the UK, France and Singapore
|
|
64
64
|
|
|
65
|
-
| Provider | Subpath | Time zone | Supported years | Verified against
|
|
66
|
-
| ------------------------------------------------- | -------------------- | ---------------- | --------------- |
|
|
67
|
-
| `jp` | `bizdays-toolkit/jp` | `Asia/Tokyo` | 1955–2099 | Cabinet Office "National Holidays" CSV
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `sg` | `bizdays-toolkit/sg` | `Asia/Singapore` | 2020–2027 | data.gov.sg (Ministry of Manpower)
|
|
65
|
+
| Provider | Subpath | Time zone | Supported years | Verified against |
|
|
66
|
+
| ------------------------------------------------- | -------------------- | ---------------- | --------------- | --------------------------------------------------------------------------------------------- |
|
|
67
|
+
| `jp` | `bizdays-toolkit/jp` | `Asia/Tokyo` | 1955–2099 | Cabinet Office "National Holidays" CSV |
|
|
68
|
+
| `england`, `wales`, `scotland`, `northernIreland` | `bizdays-toolkit/uk` | `Europe/London` | 1974–2099 | GOV.UK bank holidays (1974–2011: The Gazette, and the government lists of the time from 2000) |
|
|
69
|
+
| `metropole`, `alsaceMoselle` | `bizdays-toolkit/fr` | `Europe/Paris` | 2000–2099 | data.gouv.fr "Jours fériés en France" |
|
|
70
|
+
| `sg` | `bizdays-toolkit/sg` | `Asia/Singapore` | 2020–2027 | data.gov.sg (Ministry of Manpower) |
|
|
71
71
|
|
|
72
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 `outOfRange: "ignore"` is set, and `unconfirmedHolidays: "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
|
|
|
@@ -129,9 +129,9 @@ A holiday provider is an object with `id`, `timeZone`, `supportedYears` and `hol
|
|
|
129
129
|
|
|
130
130
|
Versioning follows [Semantic Versioning](https://semver.org/). See [RELEASING.md](https://github.com/inohan77/bizdays-toolkit/blob/main/RELEASING.md) (Japanese) for details.
|
|
131
131
|
|
|
132
|
-
- 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, newly gazetted years and revised dates in Singapore
|
|
132
|
+
- 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 `~`
|
|
133
133
|
- To freeze the holiday results, pin an exact version (for example `"bizdays-toolkit": "0.8.0"`)
|
|
134
|
-
- The reflected data is shown by the provider's `dataVersion` (for Japan, the year and month of the Official Gazette reflected; for the UK and Singapore, the year and month of the GOV.UK 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
|
|
134
|
+
- 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
|
|
135
135
|
- 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
136
|
- 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))
|
|
137
137
|
|
|
@@ -141,12 +141,14 @@ Japanese holidays are verified with the "National Holidays" CSV published on the
|
|
|
141
141
|
|
|
142
142
|
UK bank holidays are verified with the GOV.UK bank holidays data (<https://www.gov.uk/bank-holidays.json>, and for earlier years the history of the official GOV.UK repositories [alphagov/calendars](https://github.com/alphagov/calendars) and [alphagov/frontend](https://github.com/alphagov/frontend)), and the Welsh names of the Wales holidays with the Welsh version of GOV.UK (the verification data is a test fixture only; not included in the package).
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
For 2000–2011, which predate GOV.UK's data, the authority is the bank holiday lists the government published at the time (DTI and BERR, directgov, the Scottish Executive and Government, nidirect; captured by the Wayback Machine), checked against the Royal Proclamations and Northern Ireland Orders in The Gazette (<https://www.thegazette.co.uk/>); for 1974–1999 the proclamations are the authority. Thirteen days in 1975–1990 are returned by rule but could not be checked because the issues of The Gazette that carry them are not online (listed as `unverified` in the test fixture, with the reasons). The sources are listed in [docs/sources/uk-bank-holidays-2000-2011.md](https://github.com/inohan77/bizdays-toolkit/blob/main/docs/sources/uk-bank-holidays-2000-2011.md) (test fixture only; not included in the package).
|
|
145
145
|
|
|
146
146
|
French public holidays are verified with the "Jours fériés en France" dataset published by DINUM on data.gouv.fr (<https://www.data.gouv.fr/datasets/jours-feries-en-france>, JSON exports for the Métropole and Alsace-Moselle zones; the verification data is a test fixture only; not included in the package).
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
Singapore public holidays are verified with the "Singapore Public Holidays" collection published by the Ministry of Manpower on data.gov.sg (<https://data.gov.sg/collections/691/view>), with the Ministry's press releases as the authority where the two differ (the verification data is a test fixture only; not included in the package).
|
|
149
|
+
|
|
150
|
+
Contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/), data from data.gouv.fr made available under the [Licence Ouverte / Open Licence 2.0](https://www.etalab.gouv.fr/licence-ouverte-open-licence), and data from data.gov.sg made available under the [Singapore Open Data Licence](https://data.gov.sg/open-data-licence).
|
|
149
151
|
|
|
150
152
|
## License
|
|
151
153
|
|
|
152
|
-
MIT
|
|
154
|
+
This software is released under the MIT License, see [LICENSE](https://github.com/inohan77/bizdays-toolkit/blob/main/LICENSE).
|
package/dist/uk/rules.d.ts
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
* - 臨時の祝日・移動: 布告ごとの日付をテーブルで持つ
|
|
8
8
|
* - 識別子(key): 毎年の祝日に GOV.UK の区分名から 1 つ(KnownUkHolidayKey)。振替日は元の祝日の key、臨時の祝日は持たない
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* (test/fixtures/govuk-bank-holidays.json)で検証している。
|
|
12
|
-
*
|
|
10
|
+
* 2012 年以降は、すべての日付と名称が GOV.UK のデータと一致することをテスト用フィクスチャ
|
|
11
|
+
* (test/fixtures/govuk-bank-holidays.json)で検証している。2000〜2011 年(GOV.UK のデータがない)は、当時の政府の公表一覧
|
|
12
|
+
* (DTI・BERR・directgov・Scottish Executive/Government・nidirect の Web Archive)を正とし、The Gazette の布告で照合した
|
|
13
|
+
* フィクスチャ(test/fixtures/uk-2000-2011-government-lists.json)で検証している。政府の一覧にあるが布告が見つからない日
|
|
14
|
+
* (Scotland の 2010-01-04・2010-12-27・2011-01-04)は、一覧に従って祝日として返す(decisions.md の 49 番)。
|
|
15
|
+
* CONFIRMED_THROUGH より後の年は、規則による予測(confirmed: false)。
|
|
13
16
|
*/
|
|
14
17
|
import type { Holiday } from "../core/types.ts";
|
|
15
18
|
/**
|
|
@@ -40,7 +43,7 @@ export type KnownUkHolidayKey = "new-year" | "2nd-january" | "st-patricks" | "go
|
|
|
40
43
|
export type UkDivision = "england-and-wales" | "scotland" | "northern-ireland";
|
|
41
44
|
/** @internal 対応年 */
|
|
42
45
|
export declare const SUPPORTED_YEARS: Readonly<{
|
|
43
|
-
from:
|
|
46
|
+
from: 1974;
|
|
44
47
|
to: 2099;
|
|
45
48
|
}>;
|
|
46
49
|
/** @internal GOV.UK が日付を公表している最後の年 */
|
package/dist/uk/rules.js
CHANGED
|
@@ -7,14 +7,17 @@
|
|
|
7
7
|
* - 臨時の祝日・移動: 布告ごとの日付をテーブルで持つ
|
|
8
8
|
* - 識別子(key): 毎年の祝日に GOV.UK の区分名から 1 つ(KnownUkHolidayKey)。振替日は元の祝日の key、臨時の祝日は持たない
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* (test/fixtures/govuk-bank-holidays.json)で検証している。
|
|
12
|
-
*
|
|
10
|
+
* 2012 年以降は、すべての日付と名称が GOV.UK のデータと一致することをテスト用フィクスチャ
|
|
11
|
+
* (test/fixtures/govuk-bank-holidays.json)で検証している。2000〜2011 年(GOV.UK のデータがない)は、当時の政府の公表一覧
|
|
12
|
+
* (DTI・BERR・directgov・Scottish Executive/Government・nidirect の Web Archive)を正とし、The Gazette の布告で照合した
|
|
13
|
+
* フィクスチャ(test/fixtures/uk-2000-2011-government-lists.json)で検証している。政府の一覧にあるが布告が見つからない日
|
|
14
|
+
* (Scotland の 2010-01-04・2010-12-27・2011-01-04)は、一覧に従って祝日として返す(decisions.md の 49 番)。
|
|
15
|
+
* CONFIRMED_THROUGH より後の年は、規則による予測(confirmed: false)。
|
|
13
16
|
*/
|
|
14
17
|
import { addDays, daysInMonth, easterSunday, formatDate, nthWeekdayOfMonth, weekdayOf, } from "../core/date.js";
|
|
15
18
|
import { rangeError } from "../core/errors.js";
|
|
16
19
|
/** @internal 対応年 */
|
|
17
|
-
export const SUPPORTED_YEARS = Object.freeze({ from:
|
|
20
|
+
export const SUPPORTED_YEARS = Object.freeze({ from: 1974, to: 2099 });
|
|
18
21
|
/** @internal GOV.UK が日付を公表している最後の年 */
|
|
19
22
|
export const CONFIRMED_THROUGH = 2028;
|
|
20
23
|
/** @internal 反映済みの GOV.UK のデータの年月(2026 年の Scotland の World Cup bank holiday の追加) */
|
|
@@ -32,14 +35,44 @@ const ST_ANDREW = "St Andrew’s Day";
|
|
|
32
35
|
const CHRISTMAS = "Christmas Day";
|
|
33
36
|
const BOXING = "Boxing Day";
|
|
34
37
|
const ALL = ["england-and-wales", "scotland", "northern-ireland"];
|
|
38
|
+
const NOT_SCOTLAND = ["england-and-wales", "northern-ireland"];
|
|
39
|
+
const SCOTLAND = ["scotland"];
|
|
35
40
|
/** 布告で毎年の祝日の日付を移した年(名称が変わる場合は name) */
|
|
36
41
|
const MOVED = [
|
|
37
|
-
|
|
38
|
-
{ year:
|
|
39
|
-
|
|
42
|
+
// 1977 年: Silver Jubilee で England・Wales・NI の Spring を 6 月 6 日に("in its stead")。Scotland に Spring はまだない
|
|
43
|
+
{ year: 1977, from: SPRING, date: "1977-06-06", divisions: NOT_SCOTLAND },
|
|
44
|
+
// 1995 年: VE Day 50 周年で England・Wales・NI の Early May を 5 月 8 日に(5 月 1 日は布告されなかった)。Scotland の 5 月第 1 月曜は附則
|
|
45
|
+
{ year: 1995, from: EARLY_MAY, date: "1995-05-08", divisions: NOT_SCOTLAND },
|
|
46
|
+
{ year: 2002, from: SPRING, date: "2002-06-04", divisions: ALL },
|
|
47
|
+
{ year: 2012, from: SPRING, date: "2012-06-04", divisions: ALL },
|
|
48
|
+
{
|
|
49
|
+
year: 2020,
|
|
50
|
+
from: EARLY_MAY,
|
|
51
|
+
date: "2020-05-08",
|
|
52
|
+
name: "Early May bank holiday (VE day)",
|
|
53
|
+
divisions: ALL,
|
|
54
|
+
},
|
|
55
|
+
{ year: 2022, from: SPRING, date: "2022-06-02", divisions: ALL },
|
|
40
56
|
];
|
|
41
57
|
/** 布告による臨時の祝日 */
|
|
42
58
|
const SPECIAL_DAYS = [
|
|
59
|
+
// 臨時の祝日の名称は布告にはなく(布告は日付だけを指定する)、政府の答弁の呼び方による。固有の呼び方が公式の文書にない日は
|
|
60
|
+
// 中立の "Additional bank holiday"(docs/sources/uk-bank-holidays-1974-1999.md の名称の節)
|
|
61
|
+
// 1977 年の Silver Jubilee: England・Wales・NI は 6 月 7 日を追加(Spring は 6 月 6 日に移動)。Scotland は 6 月 6 日だけを追加。
|
|
62
|
+
// 名称は Hansard 1975-12-18 の公式プログラム "Tuesday 7th (Silver Jubilee Bank Holiday)" と 1977-01-19 "a special Silver Jubilee Bank Holiday"、
|
|
63
|
+
// Scotland は 1976-06-28 "a Jubilee holiday in Scotland"
|
|
64
|
+
{ date: "1977-06-06", name: "Silver Jubilee bank holiday", divisions: SCOTLAND },
|
|
65
|
+
{ date: "1977-06-07", name: "Silver Jubilee bank holiday", divisions: NOT_SCOTLAND },
|
|
66
|
+
// 名称は The London Gazette 48690(1981-07-27)の告示の見出し "ROYAL WEDDING BANK HOLIDAY" と Hansard 1981-07-30 の答弁 "the public holiday on 29 July for the Royal Wedding"
|
|
67
|
+
{ date: "1981-07-29", name: "Royal Wedding bank holiday", divisions: ALL },
|
|
68
|
+
// 1995 年の VE Day 50 周年: England・Wales・NI は Early May を 5 月 8 日に移動、Scotland は 5 月 1 日(附則)に加えて 8 日を追加。
|
|
69
|
+
// 政府は Scotland の分を "an additional day's bank holiday" とだけ呼び(Hansard 1993-12-16・1995-03-02)、固有の名称はない
|
|
70
|
+
{ date: "1995-05-08", name: "Additional bank holiday", divisions: SCOTLAND },
|
|
71
|
+
// 政府は "a one-off additional Bank Holiday throughout the United Kingdom on Friday, 31 December 1999" と呼び(Hansard 1998-06-03)、
|
|
72
|
+
// "Millennium" は質問と Hansard の見出しにあるだけで固有の名称はない
|
|
73
|
+
{ date: "1999-12-31", name: "Additional bank holiday", divisions: ALL },
|
|
74
|
+
{ date: "2002-06-03", name: "Golden Jubilee bank holiday", divisions: ALL },
|
|
75
|
+
{ date: "2011-04-29", name: "Royal Wedding bank holiday", divisions: ALL },
|
|
43
76
|
{ date: "2012-06-05", name: "Queen’s Diamond Jubilee", divisions: ALL },
|
|
44
77
|
{ date: "2022-06-03", name: "Platinum Jubilee bank holiday", divisions: ALL },
|
|
45
78
|
{
|
|
@@ -60,9 +93,112 @@ const SPECIAL_DAYS = [
|
|
|
60
93
|
* 同じ曜日の並びの 2012・2017 年は、附則どおり 1/2 が 2nd January、1/3 が New Year’s Day の振替
|
|
61
94
|
*/
|
|
62
95
|
const RENAMED = [
|
|
63
|
-
|
|
96
|
+
// 12 月 25 日が土曜日の年(1976・1982・1993・1999・2004): 27 日は附則の「25・26 日が日曜日の年の 27 日」(Boxing Day の代わり)、
|
|
97
|
+
// 28 日は Christmas Day の代わり。割り当ての文言があるのは 1982・1999 年の Scotland の布告("in place of Saturday, 25th December")、
|
|
98
|
+
// 2004 年の政府の一覧、1976 年の Hansard 1976-07-27 だけで、1993 年と England・Wales・NI の 28 日(布告はどの日の代わりかを書かない)は
|
|
99
|
+
// それに揃えた(docs/sources/uk-bank-holidays-1974-1999.md の付録 C)
|
|
100
|
+
{ divisions: ALL, date: "1976-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
101
|
+
{ divisions: ALL, date: "1976-12-28", name: CHRISTMAS, kind: "substitute", key: "christmas" },
|
|
102
|
+
// 1 月 1 日が土曜日の年の Scotland(1977・1983・1994・2000・2005): 3 日は附則の「1 月 2 日が日曜日なら 3 日」、4 日は布告で New Year’s Day の代わり
|
|
64
103
|
{
|
|
65
|
-
|
|
104
|
+
divisions: SCOTLAND,
|
|
105
|
+
date: "1977-01-03",
|
|
106
|
+
name: SECOND_JANUARY,
|
|
107
|
+
kind: "substitute",
|
|
108
|
+
key: "2nd-january",
|
|
109
|
+
},
|
|
110
|
+
{ divisions: SCOTLAND, date: "1977-01-04", name: NEW_YEAR, kind: "substitute", key: "new-year" },
|
|
111
|
+
// 12 月 25 日が日曜日の年の Scotland(1977・1983・1988・1994・2005): 26 日は附則の Christmas Day の振替、27 日は布告で追加された Boxing Day
|
|
112
|
+
{
|
|
113
|
+
divisions: SCOTLAND,
|
|
114
|
+
date: "1977-12-26",
|
|
115
|
+
name: CHRISTMAS,
|
|
116
|
+
kind: "substitute",
|
|
117
|
+
key: "christmas",
|
|
118
|
+
},
|
|
119
|
+
{ divisions: SCOTLAND, date: "1977-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
120
|
+
{ divisions: ALL, date: "1982-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
121
|
+
{ divisions: ALL, date: "1982-12-28", name: CHRISTMAS, kind: "substitute", key: "christmas" },
|
|
122
|
+
{
|
|
123
|
+
divisions: SCOTLAND,
|
|
124
|
+
date: "1983-01-03",
|
|
125
|
+
name: SECOND_JANUARY,
|
|
126
|
+
kind: "substitute",
|
|
127
|
+
key: "2nd-january",
|
|
128
|
+
},
|
|
129
|
+
{ divisions: SCOTLAND, date: "1983-01-04", name: NEW_YEAR, kind: "substitute", key: "new-year" },
|
|
130
|
+
{
|
|
131
|
+
divisions: SCOTLAND,
|
|
132
|
+
date: "1983-12-26",
|
|
133
|
+
name: CHRISTMAS,
|
|
134
|
+
kind: "substitute",
|
|
135
|
+
key: "christmas",
|
|
136
|
+
},
|
|
137
|
+
{ divisions: SCOTLAND, date: "1983-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
138
|
+
{
|
|
139
|
+
divisions: SCOTLAND,
|
|
140
|
+
date: "1988-12-26",
|
|
141
|
+
name: CHRISTMAS,
|
|
142
|
+
kind: "substitute",
|
|
143
|
+
key: "christmas",
|
|
144
|
+
},
|
|
145
|
+
{ divisions: SCOTLAND, date: "1988-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
146
|
+
{ divisions: ALL, date: "1993-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
147
|
+
{ divisions: ALL, date: "1993-12-28", name: CHRISTMAS, kind: "substitute", key: "christmas" },
|
|
148
|
+
{
|
|
149
|
+
divisions: SCOTLAND,
|
|
150
|
+
date: "1994-01-03",
|
|
151
|
+
name: SECOND_JANUARY,
|
|
152
|
+
kind: "substitute",
|
|
153
|
+
key: "2nd-january",
|
|
154
|
+
},
|
|
155
|
+
{ divisions: SCOTLAND, date: "1994-01-04", name: NEW_YEAR, kind: "substitute", key: "new-year" },
|
|
156
|
+
{
|
|
157
|
+
divisions: SCOTLAND,
|
|
158
|
+
date: "1994-12-26",
|
|
159
|
+
name: CHRISTMAS,
|
|
160
|
+
kind: "substitute",
|
|
161
|
+
key: "christmas",
|
|
162
|
+
},
|
|
163
|
+
{ divisions: SCOTLAND, date: "1994-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
164
|
+
{ divisions: ALL, date: "1999-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
165
|
+
{ divisions: ALL, date: "1999-12-28", name: CHRISTMAS, kind: "substitute", key: "christmas" },
|
|
166
|
+
// 2000 年・2005 年の Scotland: 布告は 1 月 4 日を「1 月 1 日(土)の代わり」とし、1 月 3 日は附則の「1 月 2 日が日曜日なら 3 日」
|
|
167
|
+
{
|
|
168
|
+
divisions: SCOTLAND,
|
|
169
|
+
date: "2000-01-03",
|
|
170
|
+
name: SECOND_JANUARY,
|
|
171
|
+
kind: "substitute",
|
|
172
|
+
key: "2nd-january",
|
|
173
|
+
},
|
|
174
|
+
{ divisions: SCOTLAND, date: "2000-01-04", name: NEW_YEAR, kind: "substitute", key: "new-year" },
|
|
175
|
+
// 2004 年: 12 月 27 日は附則の「25・26 日が日曜日の年の 27 日」(Boxing Day の代わり)、28 日は布告で Christmas Day の代わり
|
|
176
|
+
{ divisions: ALL, date: "2004-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
177
|
+
{ divisions: ALL, date: "2004-12-28", name: CHRISTMAS, kind: "substitute", key: "christmas" },
|
|
178
|
+
{
|
|
179
|
+
divisions: SCOTLAND,
|
|
180
|
+
date: "2005-01-03",
|
|
181
|
+
name: SECOND_JANUARY,
|
|
182
|
+
kind: "substitute",
|
|
183
|
+
key: "2nd-january",
|
|
184
|
+
},
|
|
185
|
+
{ divisions: SCOTLAND, date: "2005-01-04", name: NEW_YEAR, kind: "substitute", key: "new-year" },
|
|
186
|
+
// 2005 年の Scotland: 12 月 26 日は附則の「Christmas Day が日曜日なら 26 日」、27 日は布告で追加された Boxing Day
|
|
187
|
+
{
|
|
188
|
+
divisions: SCOTLAND,
|
|
189
|
+
date: "2005-12-26",
|
|
190
|
+
name: CHRISTMAS,
|
|
191
|
+
kind: "substitute",
|
|
192
|
+
key: "christmas",
|
|
193
|
+
},
|
|
194
|
+
{ divisions: SCOTLAND, date: "2005-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
195
|
+
// 2011 年: 当時の政府の一覧(directgov・Scottish Government・nidirect)は 26 日を Christmas Day、27 日を Boxing Day の振替とした
|
|
196
|
+
{ divisions: ALL, date: "2011-12-26", name: CHRISTMAS, kind: "substitute", key: "christmas" },
|
|
197
|
+
{ divisions: ALL, date: "2011-12-27", name: BOXING, kind: "substitute", key: "boxing-day" },
|
|
198
|
+
// 2023 年の Scotland: GOV.UK の割り当て(1/2 が New Year’s Day、1/3 が 2nd January)に合わせる
|
|
199
|
+
{ divisions: SCOTLAND, date: "2023-01-02", name: NEW_YEAR, kind: "substitute", key: "new-year" },
|
|
200
|
+
{
|
|
201
|
+
divisions: SCOTLAND,
|
|
66
202
|
date: "2023-01-03",
|
|
67
203
|
name: SECOND_JANUARY,
|
|
68
204
|
kind: "substitute",
|
|
@@ -91,14 +227,13 @@ export function computeUkHolidays(division, year) {
|
|
|
91
227
|
fixed.push({ month: 3, day: 17, name: ST_PATRICK, key: "st-patricks" });
|
|
92
228
|
if (ni)
|
|
93
229
|
fixed.push({ month: 7, day: 12, name: BOYNE, key: "battle-of-the-boyne" });
|
|
94
|
-
|
|
230
|
+
// St Andrew's Day は St Andrew's Day Bank Holiday (Scotland) Act 2007 で加わった(2007 年から)
|
|
231
|
+
if (scotland && year >= 2007)
|
|
95
232
|
fixed.push({ month: 11, day: 30, name: ST_ANDREW, key: "st-andrews" });
|
|
96
233
|
fixed.push({ month: 12, day: 25, name: CHRISTMAS, key: "christmas" }, { month: 12, day: 26, name: BOXING, key: "boxing-day" });
|
|
97
234
|
const easter = easterSunday(year);
|
|
98
235
|
const movable = [
|
|
99
236
|
{ date: addDays(easter, -2), name: GOOD_FRIDAY, kind: "regular", key: "good-friday" },
|
|
100
|
-
{ date: nthWeekdayOfMonth(year, 5, 1, 1), name: EARLY_MAY, kind: "regular", key: "early-may" },
|
|
101
|
-
{ date: lastMonday(year, 5), name: SPRING, kind: "regular", key: "spring" },
|
|
102
237
|
{
|
|
103
238
|
date: scotland ? nthWeekdayOfMonth(year, 8, 1, 1) : lastMonday(year, 8),
|
|
104
239
|
name: SUMMER,
|
|
@@ -114,9 +249,22 @@ export function computeUkHolidays(division, year) {
|
|
|
114
249
|
key: "easter-monday",
|
|
115
250
|
});
|
|
116
251
|
}
|
|
252
|
+
// 5 月の第 1 月曜日: Scotland は附則、England・Wales・NI は 1978 年から毎年布告される(Early May bank holiday)
|
|
253
|
+
if (scotland || year >= 1978) {
|
|
254
|
+
movable.push({
|
|
255
|
+
date: nthWeekdayOfMonth(year, 5, 1, 1),
|
|
256
|
+
name: EARLY_MAY,
|
|
257
|
+
kind: "regular",
|
|
258
|
+
key: "early-may",
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
// 5 月の最終月曜日: England・Wales・NI は附則、Scotland は 1978 年から毎年布告される
|
|
262
|
+
if (!scotland || year >= 1978) {
|
|
263
|
+
movable.push({ date: lastMonday(year, 5), name: SPRING, kind: "regular", key: "spring" });
|
|
264
|
+
}
|
|
117
265
|
const entries = [];
|
|
118
266
|
for (const e of movable) {
|
|
119
|
-
const moved = MOVED.find((m) => m.year === year && m.from === e.name);
|
|
267
|
+
const moved = MOVED.find((m) => m.year === year && m.from === e.name && m.divisions.includes(division));
|
|
120
268
|
entries.push(moved ? { ...e, date: moved.date, name: moved.name ?? e.name } : e);
|
|
121
269
|
}
|
|
122
270
|
for (const s of SPECIAL_DAYS) {
|
|
@@ -147,7 +295,7 @@ export function computeUkHolidays(division, year) {
|
|
|
147
295
|
taken.add(day);
|
|
148
296
|
}
|
|
149
297
|
for (const r of RENAMED) {
|
|
150
|
-
if (r.division
|
|
298
|
+
if (!r.divisions.includes(division) || !r.date.startsWith(`${year}-`))
|
|
151
299
|
continue;
|
|
152
300
|
const i = entries.findIndex((e) => e.date === r.date);
|
|
153
301
|
if (i >= 0)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bizdays-toolkit",
|
|
3
|
-
"version": "0.
|
|
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
|
|
3
|
+
"version": "0.21.0",
|
|
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",
|
|
7
7
|
"bizdays",
|