bizdays-toolkit 0.19.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 CHANGED
@@ -4,6 +4,53 @@
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
+
29
+ ## [0.20.0] - 2026-10-25
30
+
31
+ ### 移行
32
+
33
+ 動作が変わる既存の API はない。サブパス `bizdays-toolkit/fr` が増える。版ごとの作業は [docs/migration.md](./docs/migration.md) にまとめた。
34
+
35
+ ### Added
36
+
37
+ - フランスの祝日の提供元 `bizdays-toolkit/fr` を追加した。`metropole`(ID `FR`。労働法典 L3133-1 の 11 日)と `alsaceMoselle`(ID `FR-AM`。Vendredi saint と 12 月 26 日が加わる)で、タイムゾーンは `Europe/Paris`、対応年は 2000〜2099 年。固定日と復活祭からの日数で計算し、振替はない。名称は data.gouv.fr の表記(フランス語)、`nameEn` は英訳、`key` は英語名から(`labour-day`・`pentecost-monday` など 13 個。型 `KnownFrHolidayKey`)。2 つの祝日が同じ日に当たる年(2008 年・2059 年の Ascension)は復活祭の側の名称で 1 件。祝日は法令で定まり年ごとの告示がないので、すべて `confirmed: true` で `confirmedThrough` は持たない。型 `FrHoliday`・`FrHolidayKind`・`KnownFrHolidayKind` を追加した
38
+ - data.gouv.fr の「Jours fériés en France」(DINUM。Métropole と Alsace-Moselle のゾーンの JSON)の 2006〜2031 年のすべての日付と名称に一致することをテストで確かめる(`test/fixtures/datagouv-jours-feries.json`)
39
+
40
+ ### Changed
41
+
42
+ - README: 提供元の表にフランスを足し、min+gzip のサイズの値を 0.20.0 で測り直した(ルート 10.0 → 11.0 KB。0.18.0・0.19.0 の追加分を含む)
43
+ - `docs/guide.md`・`docs/guide.ja.md`: 「French public holidays / フランスの祝日」の節と、識別子の表のフランスの行を足した
44
+ - `RELEASING.md`: 「フランスのデータの更新」の節を足し、区分の表の「規則で計算する提供元」にフランスを含めた
45
+ - `docs/decisions.md`: 48 番(フランスの提供元と、4 か国目の選び方の基準)を追加した
46
+ - `package.json`: `exports` に `./fr`、keywords に `france` を足した
47
+
48
+ ### 開発
49
+
50
+ - 監視のワークフロー `data-watch.yml` に data.gouv.fr の照合を足した(issue のラベル `datagouv-data`。ハートビートは 4 つの照合がすべて動いたときだけ)。`scripts/verify-datagouv.ts` を英国・シンガポール・日本と同じ形で追加した(`pnpm verify:datagouv`)
51
+ - テスト: `test/fr-rules.test.ts`・`test/fr-datagouv.test.ts` を追加し、`test/holiday-key.test.ts`・ESM/CJS/ブラウザー/workerd の確認・利用者の型チェックにフランスを足した
52
+ - サイズの上限(`size-limits.json`)に `./fr` 6,500(測定 5,404)を足した(gzip)
53
+
7
54
  ## [0.19.0] - 2026-10-25
8
55
 
9
56
  ### 移行
@@ -518,7 +565,9 @@
518
565
 
519
566
  - 日本: 2026 年 2 月の官報(2027 年の春分・秋分の日)まで反映(`dataVersion: "2026-02"`、`confirmedThrough: 2027`)
520
567
 
521
- [Unreleased]: https://github.com/inohan77/bizdays-toolkit/compare/v0.19.0...HEAD
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
570
+ [0.20.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.19.0...v0.20.0
522
571
  [0.19.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.18.0...v0.19.0
523
572
  [0.18.0]: https://github.com/inohan77/bizdays-toolkit/compare/v0.17.1...v0.18.0
524
573
  [0.17.1]: https://github.com/inohan77/bizdays-toolkit/compare/v0.17.0...v0.17.1
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), the UK (GOV.UK; England, Wales, Scotland and Northern Ireland, 2012 onwards) 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
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 10.0 KB min+gzip (about 11.8 KB with Japanese holidays, about 11.7 KB with UK bank holidays, about 10.9 KB with Singapore holidays; measured for 0.17.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 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,13 +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, the UK and Singapore
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
- | `england`, `wales`, `scotland`, `northernIreland` | `bizdays-toolkit/uk` | `Europe/London` | 2012–2099 | GOV.UK bank holidays |
69
- | `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) |
70
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 `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).
72
73
 
@@ -128,9 +129,9 @@ A holiday provider is an object with `id`, `timeZone`, `supportedYears` and `hol
128
129
 
129
130
  Versioning follows [Semantic Versioning](https://semver.org/). See [RELEASING.md](https://github.com/inohan77/bizdays-toolkit/blob/main/RELEASING.md) (Japanese) for details.
130
131
 
131
- - 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) are released as **patch** versions, so they reach you with either `^` or `~`
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 `~`
132
133
  - To freeze the holiday results, pin an exact version (for example `"bizdays-toolkit": "0.8.0"`)
133
- - 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
134
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
135
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))
136
137
 
@@ -140,10 +141,14 @@ Japanese holidays are verified with the "National Holidays" CSV published on the
140
141
 
141
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).
142
143
 
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
+
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
+
143
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).
144
149
 
145
- Contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/), and data from data.gov.sg made available under the [Singapore Open Data Licence](https://data.gov.sg/open-data-licence).
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).
146
151
 
147
152
  ## License
148
153
 
149
- MIT
154
+ This software is released under the MIT License, see [LICENSE](https://github.com/inohan77/bizdays-toolkit/blob/main/LICENSE).
@@ -0,0 +1,35 @@
1
+ /**
2
+ * フランスの祝日(jours fériés)。本土(metropole)と Alsace-Moselle の 2 つの提供元。
3
+ *
4
+ * 労働法典 L3133-1 が定める 11 日(固定日 8 日と復活祭から決まる 3 日)を規則で計算し、Alsace-Moselle には地方法の
5
+ * Vendredi saint と 12 月 26 日が加わる。振替はない。data.gouv.fr の「Jours fériés en France」(DINUM)の JSON と全日照合している。
6
+ *
7
+ * @example
8
+ * import { createCalendar } from "bizdays-toolkit";
9
+ * import { metropole } from "bizdays-toolkit/fr";
10
+ * const paris = createCalendar({ holidays: metropole, closedWeekdays: [0, 6] });
11
+ *
12
+ * @example Lundi de Pentecôte を「連帯の日」として出勤日にする企業(法律上は祝日のまま。既定の扱いの例外として書く)
13
+ * createCalendar({ holidays: metropole, closedWeekdays: [0, 6],
14
+ * openRecurring: [{ holiday: true, keys: ["pentecost-monday"], name: "Journée de solidarité" }] });
15
+ */
16
+ import type { Holiday, HolidayProvider } from "../core/types.ts";
17
+ import { type FrHolidayKind } from "./rules.ts";
18
+ export type { FrHolidayKind, KnownFrHolidayKey, KnownFrHolidayKind } from "./rules.ts";
19
+ /**
20
+ * フランスの祝日。
21
+ * @public
22
+ */
23
+ export type FrHoliday = Holiday<FrHolidayKind>;
24
+ /**
25
+ * フランス本土(および data.gouv.fr の「Métropole」ゾーンに従う地域)の祝日の提供元。ID は FR、タイムゾーンは Europe/Paris。
26
+ * 対応年は 2000〜2099 年で、祝日は法令で定まり年ごとの告示はないので、すべて confirmed: true(confirmedThrough は持たない)。
27
+ * @public
28
+ */
29
+ export declare const metropole: HolidayProvider<FrHolidayKind>;
30
+ /**
31
+ * Alsace-Moselle(Bas-Rhin・Haut-Rhin・Moselle の 3 県。ISO 3166-2 に 1 つのコードがないので、このライブラリの ID は FR-AM)の
32
+ * 祝日の提供元。本土の 11 日に Vendredi saint(kind "regular"、key "good-friday")と 12 月 26 日("saint-stephens")が加わる。
33
+ * @public
34
+ */
35
+ export declare const alsaceMoselle: HolidayProvider<FrHolidayKind>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * フランスの祝日(jours fériés)。本土(metropole)と Alsace-Moselle の 2 つの提供元。
3
+ *
4
+ * 労働法典 L3133-1 が定める 11 日(固定日 8 日と復活祭から決まる 3 日)を規則で計算し、Alsace-Moselle には地方法の
5
+ * Vendredi saint と 12 月 26 日が加わる。振替はない。data.gouv.fr の「Jours fériés en France」(DINUM)の JSON と全日照合している。
6
+ *
7
+ * @example
8
+ * import { createCalendar } from "bizdays-toolkit";
9
+ * import { metropole } from "bizdays-toolkit/fr";
10
+ * const paris = createCalendar({ holidays: metropole, closedWeekdays: [0, 6] });
11
+ *
12
+ * @example Lundi de Pentecôte を「連帯の日」として出勤日にする企業(法律上は祝日のまま。既定の扱いの例外として書く)
13
+ * createCalendar({ holidays: metropole, closedWeekdays: [0, 6],
14
+ * openRecurring: [{ holiday: true, keys: ["pentecost-monday"], name: "Journée de solidarité" }] });
15
+ */
16
+ import { DATA_VERSION, SUPPORTED_YEARS, computeFrHolidays, } from "./rules.js";
17
+ function provider(id, zone) {
18
+ const cache = new Map();
19
+ return Object.freeze({
20
+ id,
21
+ timeZone: "Europe/Paris",
22
+ supportedYears: SUPPORTED_YEARS,
23
+ dataVersion: DATA_VERSION,
24
+ holidaysInYear(year) {
25
+ let list = cache.get(year);
26
+ if (!list) {
27
+ list = Object.freeze(computeFrHolidays(zone, year));
28
+ cache.set(year, list);
29
+ }
30
+ return list;
31
+ },
32
+ });
33
+ }
34
+ /**
35
+ * フランス本土(および data.gouv.fr の「Métropole」ゾーンに従う地域)の祝日の提供元。ID は FR、タイムゾーンは Europe/Paris。
36
+ * 対応年は 2000〜2099 年で、祝日は法令で定まり年ごとの告示はないので、すべて confirmed: true(confirmedThrough は持たない)。
37
+ * @public
38
+ */
39
+ export const metropole = provider("FR", "metropole");
40
+ /**
41
+ * Alsace-Moselle(Bas-Rhin・Haut-Rhin・Moselle の 3 県。ISO 3166-2 に 1 つのコードがないので、このライブラリの ID は FR-AM)の
42
+ * 祝日の提供元。本土の 11 日に Vendredi saint(kind "regular"、key "good-friday")と 12 月 26 日("saint-stephens")が加わる。
43
+ * @public
44
+ */
45
+ export const alsaceMoselle = provider("FR-AM", "alsace-moselle");
@@ -0,0 +1,47 @@
1
+ /**
2
+ * フランスの祝日(jours fériés。労働法典 L3133-1 の 11 日と、Alsace-Moselle の 2 日)の計算。
3
+ *
4
+ * - 固定日の祝日(1/1・5/1・5/8・7/14・8/15・11/1・11/11・12/25。Alsace-Moselle は 12/26 も)と、
5
+ * 復活祭から決まる祝日(Lundi de Pâques = +1 日、Ascension = +39 日、Lundi de Pentecôte = +50 日。
6
+ * Alsace-Moselle は Vendredi saint = −2 日も)を規則で計算する。振替はない
7
+ * - 2 つの祝日が同じ日に当たる年(復活祭が 3 月 23 日なら 5 月 1 日 = Ascension(2008 年)、3 月 30 日なら 5 月 8 日 = Ascension(2059 年))は、
8
+ * 復活祭から決まる祝日の名称・識別子で 1 件にする
9
+ * (data.gouv.fr の JSON と同じ扱い。提供元は 1 日に 1 件を返す契約のため)
10
+ * - 名称は data.gouv.fr の表記(フランス語)。nameEn はライブラリの英訳
11
+ * - 識別子(key)は英語名から 1 つずつ(KnownFrHolidayKey)
12
+ *
13
+ * 対応年のうち data.gouv.fr が公開している範囲(過去 20 年・未来 5 年)のすべての日付と名称が一致することを、
14
+ * テスト用フィクスチャ(test/fixtures/datagouv-jours-feries.json)で検証している。祝日は法令で定まり年ごとの告示はないので、
15
+ * 対応年はすべて confirmed: true(法改正があれば労働法典の改正として反映する)。
16
+ */
17
+ import type { Holiday } from "../core/types.ts";
18
+ /**
19
+ * フランスの祝日の種別(既知の値)。
20
+ * @public
21
+ */
22
+ export type KnownFrHolidayKind =
23
+ /** 労働法典・地方法で定まる祝日(振替・臨時の祝日はない) */
24
+ "regular";
25
+ /**
26
+ * フランスの祝日の種別。将来の版で値が増えることがあるので、分岐では「その他」も扱うこと。
27
+ * すべての値を網羅したことを型で確かめたい場合は KnownFrHolidayKind を使う。
28
+ * @public
29
+ */
30
+ export type FrHolidayKind = KnownFrHolidayKind | (string & {});
31
+ /**
32
+ * フランスの祝日の識別子(Holiday.key。既知の値)。英語名から 1 つずつ。
33
+ * 規則の keys に書くときの補完に使う(型は開いているので他の文字列も通る)。
34
+ * @beta
35
+ */
36
+ export type KnownFrHolidayKey = "new-year" | "easter-monday" | "labour-day" | "victory-in-europe" | "ascension" | "pentecost-monday" | "bastille" | "assumption" | "all-saints" | "armistice" | "christmas" | "good-friday" | "saint-stephens";
37
+ /** @internal 地域(data.gouv.fr のゾーン) */
38
+ export type FrZone = "metropole" | "alsace-moselle";
39
+ /** @internal 対応年 */
40
+ export declare const SUPPORTED_YEARS: Readonly<{
41
+ from: 2000;
42
+ to: 2099;
43
+ }>;
44
+ /** @internal 反映済みの data.gouv.fr のデータの年月(2006〜2031 年の公開) */
45
+ export declare const DATA_VERSION = "2026-10";
46
+ /** @internal その年・地域の祝日(日付順) */
47
+ export declare function computeFrHolidays(zone: FrZone, year: number): Holiday<FrHolidayKind>[];
@@ -0,0 +1,77 @@
1
+ /**
2
+ * フランスの祝日(jours fériés。労働法典 L3133-1 の 11 日と、Alsace-Moselle の 2 日)の計算。
3
+ *
4
+ * - 固定日の祝日(1/1・5/1・5/8・7/14・8/15・11/1・11/11・12/25。Alsace-Moselle は 12/26 も)と、
5
+ * 復活祭から決まる祝日(Lundi de Pâques = +1 日、Ascension = +39 日、Lundi de Pentecôte = +50 日。
6
+ * Alsace-Moselle は Vendredi saint = −2 日も)を規則で計算する。振替はない
7
+ * - 2 つの祝日が同じ日に当たる年(復活祭が 3 月 23 日なら 5 月 1 日 = Ascension(2008 年)、3 月 30 日なら 5 月 8 日 = Ascension(2059 年))は、
8
+ * 復活祭から決まる祝日の名称・識別子で 1 件にする
9
+ * (data.gouv.fr の JSON と同じ扱い。提供元は 1 日に 1 件を返す契約のため)
10
+ * - 名称は data.gouv.fr の表記(フランス語)。nameEn はライブラリの英訳
11
+ * - 識別子(key)は英語名から 1 つずつ(KnownFrHolidayKey)
12
+ *
13
+ * 対応年のうち data.gouv.fr が公開している範囲(過去 20 年・未来 5 年)のすべての日付と名称が一致することを、
14
+ * テスト用フィクスチャ(test/fixtures/datagouv-jours-feries.json)で検証している。祝日は法令で定まり年ごとの告示はないので、
15
+ * 対応年はすべて confirmed: true(法改正があれば労働法典の改正として反映する)。
16
+ */
17
+ import { addDays, easterSunday, formatDate } from "../core/date.js";
18
+ import { rangeError } from "../core/errors.js";
19
+ /** @internal 対応年 */
20
+ export const SUPPORTED_YEARS = Object.freeze({ from: 2000, to: 2099 });
21
+ /** @internal 反映済みの data.gouv.fr のデータの年月(2006〜2031 年の公開) */
22
+ export const DATA_VERSION = "2026-10";
23
+ /** 固定日の祝日 [月, 日, 名称, 英語名, 識別子] */
24
+ const FIXED = [
25
+ [1, 1, "1er janvier", "New Year’s Day", "new-year"],
26
+ [5, 1, "1er mai", "Labour Day", "labour-day"],
27
+ [5, 8, "8 mai", "Victory in Europe Day", "victory-in-europe"],
28
+ [7, 14, "14 juillet", "Bastille Day", "bastille"],
29
+ [8, 15, "Assomption", "Assumption", "assumption"],
30
+ [11, 1, "Toussaint", "All Saints’ Day", "all-saints"],
31
+ [11, 11, "11 novembre", "Armistice Day", "armistice"],
32
+ [12, 25, "Jour de Noël", "Christmas Day", "christmas"],
33
+ ];
34
+ const FIXED_ALSACE_MOSELLE = [[12, 26, "2ème jour de Noël", "Saint Stephen’s Day", "saint-stephens"]];
35
+ /** 復活祭から決まる祝日 [日数差, 名称, 英語名, 識別子] */
36
+ const EASTER_BASED = [
37
+ [1, "Lundi de Pâques", "Easter Monday", "easter-monday"],
38
+ [39, "Ascension", "Ascension Day", "ascension"],
39
+ [50, "Lundi de Pentecôte", "Pentecost Monday", "pentecost-monday"],
40
+ ];
41
+ const EASTER_BASED_ALSACE_MOSELLE = [[-2, "Vendredi saint", "Good Friday", "good-friday"]];
42
+ /** @internal その年・地域の祝日(日付順) */
43
+ export function computeFrHolidays(zone, year) {
44
+ if (!Number.isInteger(year) || year < SUPPORTED_YEARS.from || year > SUPPORTED_YEARS.to) {
45
+ throw rangeError("out-of-range", `French public holidays are supported for ${SUPPORTED_YEARS.from}-${SUPPORTED_YEARS.to}; requested ${year}`);
46
+ }
47
+ const alsaceMoselle = zone === "alsace-moselle";
48
+ const byDate = new Map();
49
+ for (const [month, day, name, nameEn, key] of alsaceMoselle
50
+ ? [...FIXED, ...FIXED_ALSACE_MOSELLE]
51
+ : FIXED) {
52
+ byDate.set(formatDate(year, month, day), {
53
+ date: formatDate(year, month, day),
54
+ name,
55
+ nameEn,
56
+ key,
57
+ });
58
+ }
59
+ // 復活祭から決まる祝日が固定日と同じ日に当たる年は、復活祭の側で上書きする(data.gouv.fr の JSON と同じ)
60
+ const easter = easterSunday(year);
61
+ for (const [offset, name, nameEn, key] of alsaceMoselle
62
+ ? [...EASTER_BASED_ALSACE_MOSELLE, ...EASTER_BASED]
63
+ : EASTER_BASED) {
64
+ const date = addDays(easter, offset);
65
+ byDate.set(date, { date, name, nameEn, key });
66
+ }
67
+ return [...byDate.values()]
68
+ .sort((a, b) => (a.date < b.date ? -1 : 1))
69
+ .map((e) => Object.freeze({
70
+ date: e.date,
71
+ name: e.name,
72
+ nameEn: e.nameEn,
73
+ kind: "regular",
74
+ confirmed: true,
75
+ key: e.key,
76
+ }));
77
+ }
@@ -7,9 +7,12 @@
7
7
  * - 臨時の祝日・移動: 布告ごとの日付をテーブルで持つ
8
8
  * - 識別子(key): 毎年の祝日に GOV.UK の区分名から 1 つ(KnownUkHolidayKey)。振替日は元の祝日の key、臨時の祝日は持たない
9
9
  *
10
- * 対応年のすべての日付と名称が GOV.UK のデータと一致することを、テスト用フィクスチャ
11
- * (test/fixtures/govuk-bank-holidays.json)で検証している。CONFIRMED_THROUGH より後の年は、
12
- * 規則による予測(confirmed: false)。
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: 2012;
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
- * 対応年のすべての日付と名称が GOV.UK のデータと一致することを、テスト用フィクスチャ
11
- * (test/fixtures/govuk-bank-holidays.json)で検証している。CONFIRMED_THROUGH より後の年は、
12
- * 規則による予測(confirmed: false)。
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: 2012, to: 2099 });
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
- { year: 2012, from: SPRING, date: "2012-06-04" },
38
- { year: 2020, from: EARLY_MAY, date: "2020-05-08", name: "Early May bank holiday (VE day)" },
39
- { year: 2022, from: SPRING, date: "2022-06-02" },
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
- { division: "scotland", date: "2023-01-02", name: NEW_YEAR, kind: "substitute", key: "new-year" },
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
- division: "scotland",
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
- if (scotland)
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 !== division || !r.date.startsWith(`${year}-`))
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,13 +1,14 @@
1
1
  {
2
2
  "name": "bizdays-toolkit",
3
- "version": "0.19.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; Singapore public holidays verified against data.gov.sg. / 祝日と営業日のカレンダー(タイムゾーン対応・日本の祝日は内閣府、英国の bank holidays は GOV.UK、シンガポールの祝日は data.gov.sg のデータで全日照合)",
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",
8
8
  "business-day",
9
9
  "business-days",
10
10
  "calendar",
11
+ "france",
11
12
  "holiday",
12
13
  "holidays",
13
14
  "japan",
@@ -51,6 +52,10 @@
51
52
  "types": "./dist/sg/index.d.ts",
52
53
  "default": "./dist/sg/index.js"
53
54
  },
55
+ "./fr": {
56
+ "types": "./dist/fr/index.d.ts",
57
+ "default": "./dist/fr/index.js"
58
+ },
54
59
  "./diagnose": {
55
60
  "types": "./dist/diagnose/index.d.ts",
56
61
  "default": "./dist/diagnose/index.js"
@@ -75,6 +80,7 @@
75
80
  "verify:cao": "node scripts/verify-cao.ts",
76
81
  "verify:govuk": "node scripts/verify-govuk.ts",
77
82
  "verify:datagovsg": "node scripts/verify-datagovsg.ts",
83
+ "verify:datagouv": "node scripts/verify-datagouv.ts",
78
84
  "prepublishOnly": "pnpm check",
79
85
  "release-notes": "node scripts/release-notes.ts",
80
86
  "api:update": "pnpm build && node scripts/api-report.ts --update"