From 09df87fd02892b90cf5817621b822e08ee360847 Mon Sep 17 00:00:00 2001 From: jjohnnystwsss <33243683+jjohnnystwsss@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:34:30 +0800 Subject: [PATCH] fix(TW): substitute days, Children's Day and the 2025 holidays act - Substitute days follow the DGPA rules: a holiday on a Saturday is observed on the previous Friday, on a Sunday on the next Monday. - Chinese New Year days on a weekend are observed after the holiday; replaces the "4th day" and "Saturdayif" rules. - Children's Day is the day before Tomb Sweeping Day when both fall on the same day, or the day after when that is a Thursday. - Commemoration Days and Holidays Implementation Act (2025-05-28): the day before New Year's Eve, Labour Day, Confucius' Birthday, Retrocession Day and Constitution Day are public holidays. Checked against the DGPA government office calendars for 2017-2027. Closes #490 Co-Authored-By: Claude Opus 5.5 --- data/countries/TW.yaml | 138 +++++++++++++++++++++++++++++++++---- test/fixtures/TW-2015.json | 74 ++++++++++++++------ test/fixtures/TW-2016.json | 48 ++++++------- test/fixtures/TW-2017.json | 32 +++++---- test/fixtures/TW-2018.json | 24 ++++--- test/fixtures/TW-2019.json | 32 ++------- test/fixtures/TW-2020.json | 52 ++++++++++---- test/fixtures/TW-2021.json | 60 ++++++++-------- test/fixtures/TW-2022.json | 42 +++++------ test/fixtures/TW-2023.json | 24 ++++--- test/fixtures/TW-2024.json | 34 ++++----- test/fixtures/TW-2025.json | 86 +++++++++++++---------- test/fixtures/TW-2026.json | 96 ++++++++++++++++++-------- test/fixtures/TW-2027.json | 87 ++++++++++++++--------- test/fixtures/TW-2028.json | 72 +++++++++---------- test/fixtures/TW-2029.json | 86 ++++++++++++++--------- 16 files changed, 609 insertions(+), 378 deletions(-) diff --git a/data/countries/TW.yaml b/data/countries/TW.yaml index d8d96edd3..eba7c2bc0 100644 --- a/data/countries/TW.yaml +++ b/data/countries/TW.yaml @@ -10,12 +10,31 @@ holidays: - Asia/Taipei dayoff: "" days: + # @source https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=D0020095 + # Commemoration Days and Holidays Implementation Act (紀念日及節日實施條例), + # in force since 2025-05-28 + # @source https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=D0020033 + # Regulations on the Implementation of Memorial Days and Holidays (紀念日及節日實施辦法), + # repealed 2025-06-06. Art. 5-1, in force since 2015: a holiday on a Saturday is + # observed on the previous working day, on a Sunday on the next working day; days of + # Chinese New Year on a weekend are observed on the working days after the holiday. + # @source https://data.gov.tw/dataset/14718 + # Government office calendars of the DGPA (行政院人事行政總處), used to check + # the rules for 2017-2027. Extra days off which are made up on a Saturday + # (調整放假) are not included. 01-01 and if Saturday then previous Friday if Sunday then next Monday: substitute: true _name: 01-01 name: zh: 中華民國開國紀念日 / 元旦 en: Founding of the Republic of China + # Since 2025-05-28 the holiday starts on the day before New Year's Eve + 1 day before chinese 01-0-00: + name: + en: Day before Chinese New Year’s Eve + zh: 小年夜 + active: + - from: "2025-05-28" chinese 01-0-00: name: en: Chinese New Year’s Eve @@ -24,10 +43,6 @@ holidays: name: en: Chinese New Year zh: 農曆年初一 - chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday: - name: - en: Chinese New Year Holiday - zh: 农历新年假期 chinese 01-0-02: name: en: The second day of the Chinese New Year @@ -36,40 +51,127 @@ holidays: name: en: The third day of the Chinese New Year zh: 農曆年初三 - chinese 01-0-04: + # Days of the Chinese New Year holiday on a Saturday or Sunday are observed on the + # working days after the holiday. The holiday is a block of 4 days (5 days since + # 2025-05-28) which ends on the 3rd day, so the weekday of the 3rd day gives the + # substitute days. + substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday: + substitute: true name: - en: The forth day of the Chinese New Year - zh: 農曆年初四 - 02-28 and if Sunday then next Monday: + en: Chinese New Year + zh: 春節 + active: + - to: "2025-05-28" + substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday: + substitute: true + name: + en: Chinese New Year + zh: 春節 + active: + - to: "2025-05-28" + substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Thursday then next Friday if Saturday then next Monday if Sunday then next Monday: + substitute: true + name: + en: Chinese New Year + zh: 春節 + active: + - from: "2025-05-28" + substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Wednesday then next Friday if Sunday then next Tuesday: + substitute: true + name: + en: Chinese New Year + zh: 春節 + active: + - from: "2025-05-28" + 02-28 and if Saturday then previous Friday if Sunday then next Monday: substitute: true name: en: Peace Memorial Day zh: 228和平紀念日 - 04-04 and if Sunday then next Monday: + # Children's Day (04-04) is observed the day before Tomb Sweeping Day when both fall + # on the same day, or the day after when that day is a Thursday. Tomb Sweeping Day + # is on April 4 or 5, so Children's Day is always the day before it, except in the + # Thursday case, which is moved with disable/enable (Tomb Sweeping Day on Thursday, + # April 4 in 2013-2100). On a Saturday the previous + # Friday is a day off; on a Sunday the next Monday is Tomb Sweeping Day, so the + # substitute is the Tuesday. + 1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday: substitute: true + disable: + - "2013-04-03" + - "2024-04-03" + - "2041-04-03" + - "2052-04-03" + - "2058-04-03" + - "2069-04-03" + - "2075-04-03" + - "2080-04-03" + - "2086-04-03" + - "2097-04-03" + enable: + - "2013-04-05" + - "2024-04-05" + - "2041-04-05" + - "2052-04-05" + - "2058-04-05" + - "2069-04-05" + - "2075-04-05" + - "2080-04-05" + - "2086-04-05" + - "2097-04-05" name: en: Children’s Day zh: 兒童節 - chinese 5-01 solarterm and if Sunday then next Monday: + # On a Saturday, the previous Friday is Children's Day, so the substitute is the + # Thursday + chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday: substitute: true name: en: Tomb Sweeping Day - zh: 淸明節 - chinese 05-0-05 and if Sunday then next Monday: + zh: 民族掃墓節 / 清明節 + "05-01 and if Saturday then previous Friday if Sunday then next Monday #1": + substitute: true + _name: 05-01 + name: + zh: 勞動節 + active: + - from: "2025-05-28" + chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday: substitute: true name: en: Dragon Boat Festival zh: 端午節 - chinese 08-0-15 and if Sunday then next Monday: + chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday: substitute: true name: en: Mid-Autumn Festival zh: 中秋節 - 10-10 and if Sunday then next Monday: + 09-28 and if Saturday then previous Friday if Sunday then next Monday: + substitute: true + name: + en: Confucius’ Birthday / Teachers’ Day + zh: 孔子誕辰紀念日 / 教師節 + active: + - from: "2025-05-28" + 10-10 and if Saturday then previous Friday if Sunday then next Monday: substitute: true name: en: National Day / Double Tenth Day zh: 國慶日 / 雙十節 + 10-25 and if Saturday then previous Friday if Sunday then next Monday: + substitute: true + name: + en: Taiwan Retrocession and Guningtou Victory Day + zh: 臺灣光復暨金門古寧頭大捷紀念日 + active: + - from: "2025-05-28" + 12-25 and if Saturday then previous Friday if Sunday then next Monday: + substitute: true + name: + en: Constitution Day + zh: 行憲紀念日 + active: + - from: "2025-05-28" # observed 02-04: name: @@ -96,6 +198,8 @@ holidays: zh: 勞動節 type: observance note: private sector + active: + - to: "2025-05-28" 05-04: name: en: Literary Day @@ -131,6 +235,8 @@ holidays: en: Teachers’ Day zh: 孔子誕辰紀念日 type: observance + active: + - to: "2025-05-28" 10-21: name: en: Overseas Chinese Day @@ -141,6 +247,8 @@ holidays: en: Taiwan Retrocession Day zh: 臺灣光復節 type: observance + active: + - to: "2025-05-28" 11-12: name: en: Sun Yat-sen’s Birthday @@ -157,6 +265,8 @@ holidays: en: Constitution Day zh: 行憲紀念日 type: observance + active: + - to: "2025-05-28" chinese 01-0-15: name: en: Lantern Festival diff --git a/test/fixtures/TW-2015.json b/test/fixtures/TW-2015.json index b7cbce221..a431133db 100644 --- a/test/fixtures/TW-2015.json +++ b/test/fixtures/TW-2015.json @@ -53,31 +53,33 @@ "rule": "chinese 01-0-03", "_weekday": "Sat" }, - { - "date": "2015-02-22 00:00:00", - "start": "2015-02-21T16:00:00.000Z", - "end": "2015-02-22T16:00:00.000Z", - "name": "農曆年初四", - "type": "public", - "rule": "chinese 01-0-04", - "_weekday": "Sun" - }, { "date": "2015-02-23 00:00:00", "start": "2015-02-22T16:00:00.000Z", "end": "2015-02-23T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Mon" }, + { + "date": "2015-02-27 00:00:00", + "start": "2015-02-26T16:00:00.000Z", + "end": "2015-02-27T16:00:00.000Z", + "name": "228和平紀念日 (更换日)", + "type": "public", + "substitute": true, + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2015-02-28 00:00:00", "start": "2015-02-27T16:00:00.000Z", "end": "2015-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -134,32 +136,42 @@ "rule": "03-29", "_weekday": "Sun" }, + { + "date": "2015-04-03 00:00:00", + "start": "2015-04-02T16:00:00.000Z", + "end": "2015-04-03T16:00:00.000Z", + "name": "兒童節 (更换日)", + "type": "public", + "substitute": true, + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Fri" + }, { "date": "2015-04-04 00:00:00", "start": "2015-04-03T16:00:00.000Z", "end": "2015-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Sat" }, { "date": "2015-04-05 00:00:00", "start": "2015-04-04T16:00:00.000Z", "end": "2015-04-05T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Sun" }, { "date": "2015-04-06 00:00:00", "start": "2015-04-05T16:00:00.000Z", "end": "2015-04-06T16:00:00.000Z", - "name": "淸明節 (更换日)", + "name": "民族掃墓節 / 清明節 (更换日)", "type": "public", "substitute": true, - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -235,13 +247,23 @@ "rule": "06-03", "_weekday": "Wed" }, + { + "date": "2015-06-19 00:00:00", + "start": "2015-06-18T16:00:00.000Z", + "end": "2015-06-19T16:00:00.000Z", + "name": "端午節 (更换日)", + "type": "public", + "substitute": true, + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2015-06-20 00:00:00", "start": "2015-06-19T16:00:00.000Z", "end": "2015-06-20T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -313,7 +335,7 @@ "end": "2015-09-27T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -323,7 +345,7 @@ "name": "中秋節 (更换日)", "type": "public", "substitute": true, - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -335,13 +357,23 @@ "rule": "09-28", "_weekday": "Mon" }, + { + "date": "2015-10-09 00:00:00", + "start": "2015-10-08T16:00:00.000Z", + "end": "2015-10-09T16:00:00.000Z", + "name": "國慶日 / 雙十節 (更换日)", + "type": "public", + "substitute": true, + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2015-10-10 00:00:00", "start": "2015-10-09T16:00:00.000Z", "end": "2015-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { diff --git a/test/fixtures/TW-2016.json b/test/fixtures/TW-2016.json index 224f1e67a..3dfea00c2 100644 --- a/test/fixtures/TW-2016.json +++ b/test/fixtures/TW-2016.json @@ -57,20 +57,12 @@ "date": "2016-02-11 00:00:00", "start": "2016-02-10T16:00:00.000Z", "end": "2016-02-11T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Thu" }, - { - "date": "2016-02-12 00:00:00", - "start": "2016-02-11T16:00:00.000Z", - "end": "2016-02-12T16:00:00.000Z", - "name": "农历新年假期", - "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Fri" - }, { "date": "2016-02-22 00:00:00", "start": "2016-02-21T16:00:00.000Z", @@ -95,7 +87,7 @@ "end": "2016-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -105,7 +97,7 @@ "name": "228和平紀念日 (更换日)", "type": "public", "substitute": true, - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -154,23 +146,33 @@ "_weekday": "Tue" }, { - "date": "2016-04-04 00:00:00", - "start": "2016-04-03T16:00:00.000Z", - "end": "2016-04-04T16:00:00.000Z", + "date": "2016-04-03 00:00:00", + "start": "2016-04-02T16:00:00.000Z", + "end": "2016-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Mon" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Sun" }, { "date": "2016-04-04 00:00:00", "start": "2016-04-03T16:00:00.000Z", "end": "2016-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Mon" }, + { + "date": "2016-04-05 00:00:00", + "start": "2016-04-04T16:00:00.000Z", + "end": "2016-04-05T16:00:00.000Z", + "name": "兒童節 (更换日)", + "type": "public", + "substitute": true, + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Tue" + }, { "date": "2016-04-21 00:00:00", "start": "2016-04-20T16:00:00.000Z", @@ -252,7 +254,7 @@ "end": "2016-06-09T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -324,7 +326,7 @@ "end": "2016-09-15T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -351,7 +353,7 @@ "end": "2016-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { diff --git a/test/fixtures/TW-2017.json b/test/fixtures/TW-2017.json index 5818d7dbd..d48e8a981 100644 --- a/test/fixtures/TW-2017.json +++ b/test/fixtures/TW-2017.json @@ -58,18 +58,20 @@ "date": "2017-01-31 00:00:00", "start": "2017-01-30T16:00:00.000Z", "end": "2017-01-31T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Tue" }, { "date": "2017-02-01 00:00:00", "start": "2017-01-31T16:00:00.000Z", "end": "2017-02-01T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday", "_weekday": "Wed" }, { @@ -114,7 +116,7 @@ "end": "2017-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -154,21 +156,21 @@ "_weekday": "Wed" }, { - "date": "2017-04-04 00:00:00", - "start": "2017-04-03T16:00:00.000Z", - "end": "2017-04-04T16:00:00.000Z", + "date": "2017-04-03 00:00:00", + "start": "2017-04-02T16:00:00.000Z", + "end": "2017-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Tue" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Mon" }, { "date": "2017-04-04 00:00:00", "start": "2017-04-03T16:00:00.000Z", "end": "2017-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -232,7 +234,7 @@ "end": "2017-05-30T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -322,7 +324,7 @@ "end": "2017-10-04T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -331,7 +333,7 @@ "end": "2017-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { diff --git a/test/fixtures/TW-2018.json b/test/fixtures/TW-2018.json index a37de433a..771df2483 100644 --- a/test/fixtures/TW-2018.json +++ b/test/fixtures/TW-2018.json @@ -57,18 +57,20 @@ "date": "2018-02-19 00:00:00", "start": "2018-02-18T16:00:00.000Z", "end": "2018-02-19T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Mon" }, { "date": "2018-02-20 00:00:00", "start": "2018-02-19T16:00:00.000Z", "end": "2018-02-20T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday", "_weekday": "Tue" }, { @@ -77,7 +79,7 @@ "end": "2018-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -140,7 +142,7 @@ "end": "2018-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Wed" }, { @@ -156,9 +158,9 @@ "date": "2018-04-05 00:00:00", "start": "2018-04-04T16:00:00.000Z", "end": "2018-04-05T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -231,7 +233,7 @@ "end": "2018-06-18T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -303,7 +305,7 @@ "end": "2018-09-24T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -321,7 +323,7 @@ "end": "2018-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { diff --git a/test/fixtures/TW-2019.json b/test/fixtures/TW-2019.json index 3c94a1a5c..77f8591d9 100644 --- a/test/fixtures/TW-2019.json +++ b/test/fixtures/TW-2019.json @@ -53,24 +53,6 @@ "rule": "chinese 01-0-03", "_weekday": "Thu" }, - { - "date": "2019-02-08 00:00:00", - "start": "2019-02-07T16:00:00.000Z", - "end": "2019-02-08T16:00:00.000Z", - "name": "農曆年初四", - "type": "public", - "rule": "chinese 01-0-04", - "_weekday": "Fri" - }, - { - "date": "2019-02-09 00:00:00", - "start": "2019-02-08T16:00:00.000Z", - "end": "2019-02-09T16:00:00.000Z", - "name": "农历新年假期", - "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Sat" - }, { "date": "2019-02-19 00:00:00", "start": "2019-02-18T16:00:00.000Z", @@ -95,7 +77,7 @@ "end": "2019-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -149,16 +131,16 @@ "end": "2019-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Thu" }, { "date": "2019-04-05 00:00:00", "start": "2019-04-04T16:00:00.000Z", "end": "2019-04-05T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -231,7 +213,7 @@ "end": "2019-06-07T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -303,7 +285,7 @@ "end": "2019-09-13T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -330,7 +312,7 @@ "end": "2019-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { diff --git a/test/fixtures/TW-2020.json b/test/fixtures/TW-2020.json index 117e030cf..89a7be191 100644 --- a/test/fixtures/TW-2020.json +++ b/test/fixtures/TW-2020.json @@ -48,18 +48,20 @@ "date": "2020-01-28 00:00:00", "start": "2020-01-27T16:00:00.000Z", "end": "2020-01-28T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Tue" }, { "date": "2020-01-29 00:00:00", "start": "2020-01-28T16:00:00.000Z", "end": "2020-01-29T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday", "_weekday": "Wed" }, { @@ -104,7 +106,7 @@ "end": "2020-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -144,21 +146,31 @@ "_weekday": "Sun" }, { - "date": "2020-04-04 00:00:00", - "start": "2020-04-03T16:00:00.000Z", - "end": "2020-04-04T16:00:00.000Z", + "date": "2020-04-02 00:00:00", + "start": "2020-04-01T16:00:00.000Z", + "end": "2020-04-02T16:00:00.000Z", + "name": "民族掃墓節 / 清明節 (更换日)", + "type": "public", + "substitute": true, + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", + "_weekday": "Thu" + }, + { + "date": "2020-04-03 00:00:00", + "start": "2020-04-02T16:00:00.000Z", + "end": "2020-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Sat" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Fri" }, { "date": "2020-04-04 00:00:00", "start": "2020-04-03T16:00:00.000Z", "end": "2020-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -231,7 +243,7 @@ "end": "2020-06-25T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -312,16 +324,26 @@ "end": "2020-10-01T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, + { + "date": "2020-10-09 00:00:00", + "start": "2020-10-08T16:00:00.000Z", + "end": "2020-10-09T16:00:00.000Z", + "name": "國慶日 / 雙十節 (更换日)", + "type": "public", + "substitute": true, + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2020-10-10 00:00:00", "start": "2020-10-09T16:00:00.000Z", "end": "2020-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { diff --git a/test/fixtures/TW-2021.json b/test/fixtures/TW-2021.json index cb587f9e2..524deee73 100644 --- a/test/fixtures/TW-2021.json +++ b/test/fixtures/TW-2021.json @@ -57,18 +57,20 @@ "date": "2021-02-15 00:00:00", "start": "2021-02-14T16:00:00.000Z", "end": "2021-02-15T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Mon" }, { "date": "2021-02-16 00:00:00", "start": "2021-02-15T16:00:00.000Z", "end": "2021-02-16T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday", "_weekday": "Tue" }, { @@ -95,7 +97,7 @@ "end": "2021-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -105,7 +107,7 @@ "name": "228和平紀念日 (更换日)", "type": "public", "substitute": true, - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -154,41 +156,41 @@ "_weekday": "Wed" }, { - "date": "2021-04-04 00:00:00", - "start": "2021-04-03T16:00:00.000Z", - "end": "2021-04-04T16:00:00.000Z", + "date": "2021-04-02 00:00:00", + "start": "2021-04-01T16:00:00.000Z", + "end": "2021-04-02T16:00:00.000Z", + "name": "兒童節 (更换日)", + "type": "public", + "substitute": true, + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Fri" + }, + { + "date": "2021-04-03 00:00:00", + "start": "2021-04-02T16:00:00.000Z", + "end": "2021-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Sun" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Sat" }, { "date": "2021-04-04 00:00:00", "start": "2021-04-03T16:00:00.000Z", "end": "2021-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Sun" }, { "date": "2021-04-05 00:00:00", "start": "2021-04-04T16:00:00.000Z", "end": "2021-04-05T16:00:00.000Z", - "name": "兒童節 (更换日)", - "type": "public", - "substitute": true, - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Mon" - }, - { - "date": "2021-04-05 00:00:00", - "start": "2021-04-04T16:00:00.000Z", - "end": "2021-04-05T16:00:00.000Z", - "name": "淸明節 (更换日)", + "name": "民族掃墓節 / 清明節 (更换日)", "type": "public", "substitute": true, - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -272,7 +274,7 @@ "end": "2021-06-14T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -344,7 +346,7 @@ "end": "2021-09-21T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -362,7 +364,7 @@ "end": "2021-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -372,7 +374,7 @@ "name": "國慶日 / 雙十節 (更换日)", "type": "public", "substitute": true, - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { diff --git a/test/fixtures/TW-2022.json b/test/fixtures/TW-2022.json index 4c120b656..55643ab9e 100644 --- a/test/fixtures/TW-2022.json +++ b/test/fixtures/TW-2022.json @@ -44,15 +44,6 @@ "rule": "chinese 01-0-03", "_weekday": "Thu" }, - { - "date": "2022-02-04 00:00:00", - "start": "2022-02-03T16:00:00.000Z", - "end": "2022-02-04T16:00:00.000Z", - "name": "農曆年初四", - "type": "public", - "rule": "chinese 01-0-04", - "_weekday": "Fri" - }, { "date": "2022-02-04 00:00:00", "start": "2022-02-03T16:00:00.000Z", @@ -62,15 +53,6 @@ "rule": "02-04", "_weekday": "Fri" }, - { - "date": "2022-02-05 00:00:00", - "start": "2022-02-04T16:00:00.000Z", - "end": "2022-02-05T16:00:00.000Z", - "name": "农历新年假期", - "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Sat" - }, { "date": "2022-02-15 00:00:00", "start": "2022-02-14T16:00:00.000Z", @@ -95,7 +77,7 @@ "end": "2022-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -149,16 +131,16 @@ "end": "2022-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Mon" }, { "date": "2022-04-05 00:00:00", "start": "2022-04-04T16:00:00.000Z", "end": "2022-04-05T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -242,7 +224,7 @@ "end": "2022-06-03T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -308,13 +290,23 @@ "rule": "09-03", "_weekday": "Sat" }, + { + "date": "2022-09-09 00:00:00", + "start": "2022-09-08T16:00:00.000Z", + "end": "2022-09-09T16:00:00.000Z", + "name": "中秋節 (更换日)", + "type": "public", + "substitute": true, + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2022-09-10 00:00:00", "start": "2022-09-09T16:00:00.000Z", "end": "2022-09-10T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -341,7 +333,7 @@ "end": "2022-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { diff --git a/test/fixtures/TW-2023.json b/test/fixtures/TW-2023.json index 81381c803..0b3662fb8 100644 --- a/test/fixtures/TW-2023.json +++ b/test/fixtures/TW-2023.json @@ -58,18 +58,20 @@ "date": "2023-01-25 00:00:00", "start": "2023-01-24T16:00:00.000Z", "end": "2023-01-25T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Wed" }, { "date": "2023-01-26 00:00:00", "start": "2023-01-25T16:00:00.000Z", "end": "2023-01-26T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday", "_weekday": "Thu" }, { @@ -114,7 +116,7 @@ "end": "2023-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -159,16 +161,16 @@ "end": "2023-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Tue" }, { "date": "2023-04-05 00:00:00", "start": "2023-04-04T16:00:00.000Z", "end": "2023-04-05T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -241,7 +243,7 @@ "end": "2023-06-22T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -322,7 +324,7 @@ "end": "2023-09-29T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -331,7 +333,7 @@ "end": "2023-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { diff --git a/test/fixtures/TW-2024.json b/test/fixtures/TW-2024.json index 3e166d418..e62a00156 100644 --- a/test/fixtures/TW-2024.json +++ b/test/fixtures/TW-2024.json @@ -57,18 +57,20 @@ "date": "2024-02-13 00:00:00", "start": "2024-02-12T16:00:00.000Z", "end": "2024-02-13T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Tue" }, { "date": "2024-02-14 00:00:00", "start": "2024-02-13T16:00:00.000Z", "end": "2024-02-14T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Sunday then next Tuesday", "_weekday": "Wed" }, { @@ -95,7 +97,7 @@ "end": "2024-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -147,19 +149,19 @@ "date": "2024-04-04 00:00:00", "start": "2024-04-03T16:00:00.000Z", "end": "2024-04-04T16:00:00.000Z", - "name": "兒童節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Thu" }, { - "date": "2024-04-04 00:00:00", - "start": "2024-04-03T16:00:00.000Z", - "end": "2024-04-04T16:00:00.000Z", - "name": "淸明節", + "date": "2024-04-05 00:00:00", + "start": "2024-04-04T16:00:00.000Z", + "end": "2024-04-05T16:00:00.000Z", + "name": "兒童節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", - "_weekday": "Thu" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Fri" }, { "date": "2024-04-23 00:00:00", @@ -231,7 +233,7 @@ "end": "2024-06-10T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -303,7 +305,7 @@ "end": "2024-09-17T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -321,7 +323,7 @@ "end": "2024-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { diff --git a/test/fixtures/TW-2025.json b/test/fixtures/TW-2025.json index fab4c9332..f09923435 100644 --- a/test/fixtures/TW-2025.json +++ b/test/fixtures/TW-2025.json @@ -44,24 +44,6 @@ "rule": "chinese 01-0-03", "_weekday": "Fri" }, - { - "date": "2025-02-01 00:00:00", - "start": "2025-01-31T16:00:00.000Z", - "end": "2025-02-01T16:00:00.000Z", - "name": "農曆年初四", - "type": "public", - "rule": "chinese 01-0-04", - "_weekday": "Sat" - }, - { - "date": "2025-02-02 00:00:00", - "start": "2025-02-01T16:00:00.000Z", - "end": "2025-02-02T16:00:00.000Z", - "name": "农历新年假期", - "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Sun" - }, { "date": "2025-02-04 00:00:00", "start": "2025-02-03T16:00:00.000Z", @@ -95,7 +77,7 @@ "end": "2025-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -144,21 +126,21 @@ "_weekday": "Sat" }, { - "date": "2025-04-04 00:00:00", - "start": "2025-04-03T16:00:00.000Z", - "end": "2025-04-04T16:00:00.000Z", + "date": "2025-04-03 00:00:00", + "start": "2025-04-02T16:00:00.000Z", + "end": "2025-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Fri" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Thu" }, { "date": "2025-04-04 00:00:00", "start": "2025-04-03T16:00:00.000Z", "end": "2025-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -216,13 +198,23 @@ "rule": "2nd Sunday in May", "_weekday": "Sun" }, + { + "date": "2025-05-30 00:00:00", + "start": "2025-05-29T16:00:00.000Z", + "end": "2025-05-30T16:00:00.000Z", + "name": "端午節 (更换日)", + "type": "public", + "substitute": true, + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2025-05-31 00:00:00", "start": "2025-05-30T16:00:00.000Z", "end": "2025-05-31T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -301,18 +293,28 @@ "date": "2025-09-28 00:00:00", "start": "2025-09-27T16:00:00.000Z", "end": "2025-09-28T16:00:00.000Z", - "name": "孔子誕辰紀念日", - "type": "observance", - "rule": "09-28", + "name": "孔子誕辰紀念日 / 教師節", + "type": "public", + "rule": "09-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, + { + "date": "2025-09-29 00:00:00", + "start": "2025-09-28T16:00:00.000Z", + "end": "2025-09-29T16:00:00.000Z", + "name": "孔子誕辰紀念日 / 教師節 (更换日)", + "type": "public", + "substitute": true, + "rule": "09-28 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Mon" + }, { "date": "2025-10-06 00:00:00", "start": "2025-10-05T16:00:00.000Z", "end": "2025-10-06T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -321,7 +323,7 @@ "end": "2025-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -333,13 +335,23 @@ "rule": "10-21", "_weekday": "Tue" }, + { + "date": "2025-10-24 00:00:00", + "start": "2025-10-23T16:00:00.000Z", + "end": "2025-10-24T16:00:00.000Z", + "name": "臺灣光復暨金門古寧頭大捷紀念日 (更换日)", + "type": "public", + "substitute": true, + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2025-10-25 00:00:00", "start": "2025-10-24T16:00:00.000Z", "end": "2025-10-25T16:00:00.000Z", - "name": "臺灣光復節", - "type": "observance", - "rule": "10-25", + "name": "臺灣光復暨金門古寧頭大捷紀念日", + "type": "public", + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -384,8 +396,8 @@ "start": "2025-12-24T16:00:00.000Z", "end": "2025-12-25T16:00:00.000Z", "name": "行憲紀念日", - "type": "observance", - "rule": "12-25", + "type": "public", + "rule": "12-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" } ] \ No newline at end of file diff --git a/test/fixtures/TW-2026.json b/test/fixtures/TW-2026.json index 0b6a10cfc..10fcca086 100644 --- a/test/fixtures/TW-2026.json +++ b/test/fixtures/TW-2026.json @@ -17,6 +17,15 @@ "rule": "02-04", "_weekday": "Wed" }, + { + "date": "2026-02-15 00:00:00", + "start": "2026-02-14T16:00:00.000Z", + "end": "2026-02-15T16:00:00.000Z", + "name": "小年夜", + "type": "public", + "rule": "1 day before chinese 01-0-00", + "_weekday": "Sun" + }, { "date": "2026-02-16 00:00:00", "start": "2026-02-15T16:00:00.000Z", @@ -57,19 +66,21 @@ "date": "2026-02-20 00:00:00", "start": "2026-02-19T16:00:00.000Z", "end": "2026-02-20T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Thursday then next Friday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Fri" }, { - "date": "2026-02-21 00:00:00", - "start": "2026-02-20T16:00:00.000Z", - "end": "2026-02-21T16:00:00.000Z", - "name": "农历新年假期", + "date": "2026-02-27 00:00:00", + "start": "2026-02-26T16:00:00.000Z", + "end": "2026-02-27T16:00:00.000Z", + "name": "228和平紀念日 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Sat" + "substitute": true, + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" }, { "date": "2026-02-28 00:00:00", @@ -77,7 +88,7 @@ "end": "2026-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -134,32 +145,42 @@ "rule": "03-29", "_weekday": "Sun" }, + { + "date": "2026-04-03 00:00:00", + "start": "2026-04-02T16:00:00.000Z", + "end": "2026-04-03T16:00:00.000Z", + "name": "兒童節 (更换日)", + "type": "public", + "substitute": true, + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Fri" + }, { "date": "2026-04-04 00:00:00", "start": "2026-04-03T16:00:00.000Z", "end": "2026-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Sat" }, { "date": "2026-04-05 00:00:00", "start": "2026-04-04T16:00:00.000Z", "end": "2026-04-05T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Sun" }, { "date": "2026-04-06 00:00:00", "start": "2026-04-05T16:00:00.000Z", "end": "2026-04-06T16:00:00.000Z", - "name": "淸明節 (更换日)", + "name": "民族掃墓節 / 清明節 (更换日)", "type": "public", "substitute": true, - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -185,9 +206,8 @@ "start": "2026-04-30T16:00:00.000Z", "end": "2026-05-01T16:00:00.000Z", "name": "勞動節", - "type": "observance", - "note": "private sector", - "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday", + "type": "public", + "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday #1", "_weekday": "Fri" }, { @@ -241,7 +261,7 @@ "end": "2026-06-19T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -313,25 +333,35 @@ "end": "2026-09-25T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { "date": "2026-09-28 00:00:00", "start": "2026-09-27T16:00:00.000Z", "end": "2026-09-28T16:00:00.000Z", - "name": "孔子誕辰紀念日", - "type": "observance", - "rule": "09-28", + "name": "孔子誕辰紀念日 / 教師節", + "type": "public", + "rule": "09-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, + { + "date": "2026-10-09 00:00:00", + "start": "2026-10-08T16:00:00.000Z", + "end": "2026-10-09T16:00:00.000Z", + "name": "國慶日 / 雙十節 (更换日)", + "type": "public", + "substitute": true, + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2026-10-10 00:00:00", "start": "2026-10-09T16:00:00.000Z", "end": "2026-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -356,11 +386,21 @@ "date": "2026-10-25 00:00:00", "start": "2026-10-24T16:00:00.000Z", "end": "2026-10-25T16:00:00.000Z", - "name": "臺灣光復節", - "type": "observance", - "rule": "10-25", + "name": "臺灣光復暨金門古寧頭大捷紀念日", + "type": "public", + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, + { + "date": "2026-10-26 00:00:00", + "start": "2026-10-25T16:00:00.000Z", + "end": "2026-10-26T16:00:00.000Z", + "name": "臺灣光復暨金門古寧頭大捷紀念日 (更换日)", + "type": "public", + "substitute": true, + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Mon" + }, { "date": "2026-11-12 00:00:00", "start": "2026-11-11T16:00:00.000Z", @@ -394,8 +434,8 @@ "start": "2026-12-24T16:00:00.000Z", "end": "2026-12-25T16:00:00.000Z", "name": "行憲紀念日", - "type": "observance", - "rule": "12-25", + "type": "public", + "rule": "12-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" } ] \ No newline at end of file diff --git a/test/fixtures/TW-2027.json b/test/fixtures/TW-2027.json index c4198a6b7..3e38de79b 100644 --- a/test/fixtures/TW-2027.json +++ b/test/fixtures/TW-2027.json @@ -8,6 +8,15 @@ "rule": "01-01 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, + { + "date": "2027-02-04 00:00:00", + "start": "2027-02-03T16:00:00.000Z", + "end": "2027-02-04T16:00:00.000Z", + "name": "小年夜", + "type": "public", + "rule": "1 day before chinese 01-0-00", + "_weekday": "Thu" + }, { "date": "2027-02-04 00:00:00", "start": "2027-02-03T16:00:00.000Z", @@ -57,18 +66,20 @@ "date": "2027-02-09 00:00:00", "start": "2027-02-08T16:00:00.000Z", "end": "2027-02-09T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Thursday then next Friday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Tue" }, { "date": "2027-02-10 00:00:00", "start": "2027-02-09T16:00:00.000Z", "end": "2027-02-10T16:00:00.000Z", - "name": "农历新年假期", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Wednesday if Tuesday then next Thursday if Wednesday then next Friday if Sunday then next Tuesday", "_weekday": "Wed" }, { @@ -95,7 +106,7 @@ "end": "2027-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -105,7 +116,7 @@ "name": "228和平紀念日 (更换日)", "type": "public", "substitute": true, - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -159,27 +170,27 @@ "end": "2027-04-04T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", "_weekday": "Sun" }, { "date": "2027-04-05 00:00:00", "start": "2027-04-04T16:00:00.000Z", "end": "2027-04-05T16:00:00.000Z", - "name": "兒童節 (更换日)", + "name": "民族掃墓節 / 清明節", "type": "public", - "substitute": true, - "rule": "04-04 and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Mon" }, { - "date": "2027-04-05 00:00:00", - "start": "2027-04-04T16:00:00.000Z", - "end": "2027-04-05T16:00:00.000Z", - "name": "淸明節", + "date": "2027-04-06 00:00:00", + "start": "2027-04-05T16:00:00.000Z", + "end": "2027-04-06T16:00:00.000Z", + "name": "兒童節 (更换日)", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", - "_weekday": "Mon" + "substitute": true, + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Tue" }, { "date": "2027-04-21 00:00:00", @@ -204,10 +215,9 @@ "start": "2027-04-29T16:00:00.000Z", "end": "2027-04-30T16:00:00.000Z", "name": "勞動節 (更换日)", - "type": "observance", - "note": "private sector", + "type": "public", "substitute": true, - "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday", + "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday #1", "_weekday": "Fri" }, { @@ -215,9 +225,8 @@ "start": "2027-04-30T16:00:00.000Z", "end": "2027-05-01T16:00:00.000Z", "name": "勞動節", - "type": "observance", - "note": "private sector", - "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday", + "type": "public", + "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday #1", "_weekday": "Sat" }, { @@ -262,7 +271,7 @@ "end": "2027-06-09T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -334,16 +343,16 @@ "end": "2027-09-15T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { "date": "2027-09-28 00:00:00", "start": "2027-09-27T16:00:00.000Z", "end": "2027-09-28T16:00:00.000Z", - "name": "孔子誕辰紀念日", - "type": "observance", - "rule": "09-28", + "name": "孔子誕辰紀念日 / 教師節", + "type": "public", + "rule": "09-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -361,7 +370,7 @@ "end": "2027-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -371,7 +380,7 @@ "name": "國慶日 / 雙十節 (更换日)", "type": "public", "substitute": true, - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -387,9 +396,9 @@ "date": "2027-10-25 00:00:00", "start": "2027-10-24T16:00:00.000Z", "end": "2027-10-25T16:00:00.000Z", - "name": "臺灣光復節", - "type": "observance", - "rule": "10-25", + "name": "臺灣光復暨金門古寧頭大捷紀念日", + "type": "public", + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -420,13 +429,23 @@ "rule": "december solstice", "_weekday": "Wed" }, + { + "date": "2027-12-24 00:00:00", + "start": "2027-12-23T16:00:00.000Z", + "end": "2027-12-24T16:00:00.000Z", + "name": "行憲紀念日 (更换日)", + "type": "public", + "substitute": true, + "rule": "12-25 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2027-12-25 00:00:00", "start": "2027-12-24T16:00:00.000Z", "end": "2027-12-25T16:00:00.000Z", "name": "行憲紀念日", - "type": "observance", - "rule": "12-25", + "type": "public", + "rule": "12-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { diff --git a/test/fixtures/TW-2028.json b/test/fixtures/TW-2028.json index d22555849..390eada3e 100644 --- a/test/fixtures/TW-2028.json +++ b/test/fixtures/TW-2028.json @@ -8,6 +8,15 @@ "rule": "01-01 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, + { + "date": "2028-01-24 00:00:00", + "start": "2028-01-23T16:00:00.000Z", + "end": "2028-01-24T16:00:00.000Z", + "name": "小年夜", + "type": "public", + "rule": "1 day before chinese 01-0-00", + "_weekday": "Mon" + }, { "date": "2028-01-25 00:00:00", "start": "2028-01-24T16:00:00.000Z", @@ -44,24 +53,6 @@ "rule": "chinese 01-0-03", "_weekday": "Fri" }, - { - "date": "2028-01-29 00:00:00", - "start": "2028-01-28T16:00:00.000Z", - "end": "2028-01-29T16:00:00.000Z", - "name": "農曆年初四", - "type": "public", - "rule": "chinese 01-0-04", - "_weekday": "Sat" - }, - { - "date": "2028-01-30 00:00:00", - "start": "2028-01-29T16:00:00.000Z", - "end": "2028-01-30T16:00:00.000Z", - "name": "农历新年假期", - "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Sun" - }, { "date": "2028-02-04 00:00:00", "start": "2028-02-03T16:00:00.000Z", @@ -104,7 +95,7 @@ "end": "2028-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -144,21 +135,21 @@ "_weekday": "Wed" }, { - "date": "2028-04-04 00:00:00", - "start": "2028-04-03T16:00:00.000Z", - "end": "2028-04-04T16:00:00.000Z", + "date": "2028-04-03 00:00:00", + "start": "2028-04-02T16:00:00.000Z", + "end": "2028-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Tue" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Mon" }, { "date": "2028-04-04 00:00:00", "start": "2028-04-03T16:00:00.000Z", "end": "2028-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -184,9 +175,8 @@ "start": "2028-04-30T16:00:00.000Z", "end": "2028-05-01T16:00:00.000Z", "name": "勞動節", - "type": "observance", - "note": "private sector", - "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday", + "type": "public", + "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday #1", "_weekday": "Mon" }, { @@ -222,7 +212,7 @@ "end": "2028-05-28T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sun" }, { @@ -232,7 +222,7 @@ "name": "端午節 (更换日)", "type": "public", "substitute": true, - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" }, { @@ -311,9 +301,9 @@ "date": "2028-09-28 00:00:00", "start": "2028-09-27T16:00:00.000Z", "end": "2028-09-28T16:00:00.000Z", - "name": "孔子誕辰紀念日", - "type": "observance", - "rule": "09-28", + "name": "孔子誕辰紀念日 / 教師節", + "type": "public", + "rule": "09-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -322,7 +312,7 @@ "end": "2028-10-03T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -331,7 +321,7 @@ "end": "2028-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" }, { @@ -347,9 +337,9 @@ "date": "2028-10-25 00:00:00", "start": "2028-10-24T16:00:00.000Z", "end": "2028-10-25T16:00:00.000Z", - "name": "臺灣光復節", - "type": "observance", - "rule": "10-25", + "name": "臺灣光復暨金門古寧頭大捷紀念日", + "type": "public", + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -394,8 +384,8 @@ "start": "2028-12-24T16:00:00.000Z", "end": "2028-12-25T16:00:00.000Z", "name": "行憲紀念日", - "type": "observance", - "rule": "12-25", + "type": "public", + "rule": "12-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Mon" } ] \ No newline at end of file diff --git a/test/fixtures/TW-2029.json b/test/fixtures/TW-2029.json index 968433c73..27fc5e276 100644 --- a/test/fixtures/TW-2029.json +++ b/test/fixtures/TW-2029.json @@ -17,6 +17,15 @@ "rule": "02-04", "_weekday": "Sun" }, + { + "date": "2029-02-11 00:00:00", + "start": "2029-02-10T16:00:00.000Z", + "end": "2029-02-11T16:00:00.000Z", + "name": "小年夜", + "type": "public", + "rule": "1 day before chinese 01-0-00", + "_weekday": "Sun" + }, { "date": "2029-02-12 00:00:00", "start": "2029-02-11T16:00:00.000Z", @@ -57,20 +66,12 @@ "date": "2029-02-16 00:00:00", "start": "2029-02-15T16:00:00.000Z", "end": "2029-02-16T16:00:00.000Z", - "name": "農曆年初四", + "name": "春節 (更换日)", "type": "public", - "rule": "chinese 01-0-04", + "substitute": true, + "rule": "substitutes chinese 01-0-03 if Monday then next Tuesday if Tuesday then next Wednesday if Wednesday then next Thursday if Thursday then next Friday if Saturday then next Monday if Sunday then next Monday", "_weekday": "Fri" }, - { - "date": "2029-02-17 00:00:00", - "start": "2029-02-16T16:00:00.000Z", - "end": "2029-02-17T16:00:00.000Z", - "name": "农历新年假期", - "type": "public", - "rule": "chinese 01-0-01 if Monday then next Friday if Tuesday then next Saturdayif Wednesday then next Sunday if Thursday then next Monday if Friday then next Tuesday if Saturday then next Wednesday if Sunday then next Thursday", - "_weekday": "Sat" - }, { "date": "2029-02-27 00:00:00", "start": "2029-02-26T16:00:00.000Z", @@ -95,7 +96,7 @@ "end": "2029-02-28T16:00:00.000Z", "name": "228和平紀念日", "type": "public", - "rule": "02-28 and if Sunday then next Monday", + "rule": "02-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -144,21 +145,21 @@ "_weekday": "Mon" }, { - "date": "2029-04-04 00:00:00", - "start": "2029-04-03T16:00:00.000Z", - "end": "2029-04-04T16:00:00.000Z", + "date": "2029-04-03 00:00:00", + "start": "2029-04-02T16:00:00.000Z", + "end": "2029-04-03T16:00:00.000Z", "name": "兒童節", "type": "public", - "rule": "04-04 and if Sunday then next Monday", - "_weekday": "Wed" + "rule": "1 day before chinese 5-01 solarterm and if Saturday then previous Friday if Sunday then next Tuesday", + "_weekday": "Tue" }, { "date": "2029-04-04 00:00:00", "start": "2029-04-03T16:00:00.000Z", "end": "2029-04-04T16:00:00.000Z", - "name": "淸明節", + "name": "民族掃墓節 / 清明節", "type": "public", - "rule": "chinese 5-01 solarterm and if Sunday then next Monday", + "rule": "chinese 5-01 solarterm and if Saturday then previous Thursday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -175,9 +176,8 @@ "start": "2029-04-30T16:00:00.000Z", "end": "2029-05-01T16:00:00.000Z", "name": "勞動節", - "type": "observance", - "note": "private sector", - "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday", + "type": "public", + "rule": "05-01 and if Saturday then previous Friday if Sunday then next Monday #1", "_weekday": "Tue" }, { @@ -225,13 +225,23 @@ "rule": "06-03", "_weekday": "Sun" }, + { + "date": "2029-06-15 00:00:00", + "start": "2029-06-14T16:00:00.000Z", + "end": "2029-06-15T16:00:00.000Z", + "name": "端午節 (更换日)", + "type": "public", + "substitute": true, + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2029-06-16 00:00:00", "start": "2029-06-15T16:00:00.000Z", "end": "2029-06-16T16:00:00.000Z", "name": "端午節", "type": "public", - "rule": "chinese 05-0-05 and if Sunday then next Monday", + "rule": "chinese 05-0-05 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { @@ -297,22 +307,32 @@ "rule": "09-03", "_weekday": "Mon" }, + { + "date": "2029-09-21 00:00:00", + "start": "2029-09-20T16:00:00.000Z", + "end": "2029-09-21T16:00:00.000Z", + "name": "中秋節 (更换日)", + "type": "public", + "substitute": true, + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", + "_weekday": "Fri" + }, { "date": "2029-09-22 00:00:00", "start": "2029-09-21T16:00:00.000Z", "end": "2029-09-22T16:00:00.000Z", "name": "中秋節", "type": "public", - "rule": "chinese 08-0-15 and if Sunday then next Monday", + "rule": "chinese 08-0-15 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Sat" }, { "date": "2029-09-28 00:00:00", "start": "2029-09-27T16:00:00.000Z", "end": "2029-09-28T16:00:00.000Z", - "name": "孔子誕辰紀念日", - "type": "observance", - "rule": "09-28", + "name": "孔子誕辰紀念日 / 教師節", + "type": "public", + "rule": "09-28 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Fri" }, { @@ -321,7 +341,7 @@ "end": "2029-10-10T16:00:00.000Z", "name": "國慶日 / 雙十節", "type": "public", - "rule": "10-10 and if Sunday then next Monday", + "rule": "10-10 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Wed" }, { @@ -346,9 +366,9 @@ "date": "2029-10-25 00:00:00", "start": "2029-10-24T16:00:00.000Z", "end": "2029-10-25T16:00:00.000Z", - "name": "臺灣光復節", - "type": "observance", - "rule": "10-25", + "name": "臺灣光復暨金門古寧頭大捷紀念日", + "type": "public", + "rule": "10-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Thu" }, { @@ -384,8 +404,8 @@ "start": "2029-12-24T16:00:00.000Z", "end": "2029-12-25T16:00:00.000Z", "name": "行憲紀念日", - "type": "observance", - "rule": "12-25", + "type": "public", + "rule": "12-25 and if Saturday then previous Friday if Sunday then next Monday", "_weekday": "Tue" } ] \ No newline at end of file