Skip to content

Commit 6087aaf

Browse files
committed
Merge branch 'feat-if-holiday-rule' into norfolk-island
2 parents 4b93f9c + 05b9718 commit 6087aaf

File tree

323 files changed

+2737
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+2737
-63
lines changed

data/countries/CH.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ holidays:
2222
days:
2323
01-01:
2424
_name: 01-01
25+
easter -3:
26+
_name: easter -3
27+
type: observance
2528
easter -2:
2629
_name: easter -2
2730
easter:
@@ -247,15 +250,11 @@ holidays:
247250
de: Berchtoldstag
248251
fr: Saint-Berthold
249252
type: optional
250-
# TODO: needs new rule: "Thursday after 04-02 if easter -3 then next Thursday"
251-
thursday after 04-02:
253+
# if falls on easter -3 (Maundy Thursday) then move to next Thursday
254+
Thursday after 04-02 if is observance holiday then next Thursday:
252255
name:
253256
de: Näfelser Fahrt
254257
fr: Bataille de Näfels
255-
disable:
256-
- "2023-04-06"
257-
enable:
258-
- "2023-04-13"
259258
3rd sunday after 09-01: false
260259
11-01:
261260
_name: 11-01

data/countries/HK.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,11 @@ holidays:
6767
name:
6868
en: Hong Kong Special Administrative Region Establishment Day
6969
zh: 香港特別行政區成立紀念日
70-
# TODO: add rule: "chinese 08-0-15 if 07-01 then next weekday"
71-
chinese 08-0-16 and if Sunday then next Monday:
70+
chinese 08-0-16 and if Sunday then next Monday if is public holiday then next day omit Saturday, Sunday:
7271
substitute: true
7372
name:
7473
en: The day following the Chinese Mid-Autumn Festival
7574
zh: 中秋節翌日
76-
disable:
77-
- "2020-10-01"
78-
enable:
79-
- "2020-10-02"
8075
10-01 and if Sunday then next Monday:
8176
substitute: true
8277
name:

data/countries/NZ.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,10 @@ holidays:
238238
en: Otago Province
239239
mi: Ōtākou
240240
days:
241-
# TODO: needs new rule "03-23 if ... then next monday if easter 1 then next Monday"
242-
03-23 if tuesday,wednesday,thursday then previous monday if friday,saturday,sunday then next monday:
241+
# 03-23 if ... then next monday if easter 1 then next Monday"; This will happen in 2285 the next time ;)
242+
03-23 if Tuesday,Wednesday,Thursday then previous Monday if Friday,Saturday,Sunday then next Monday if is public holiday then next Monday:
243243
name:
244244
en: Provincial anniversary day
245-
note: varies if coincides with easter monday
246245
STL:
247246
names:
248247
en: Southland

docs/specification.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Specification for `holidays.yaml`
22

3-
Version: 2.0.0
3+
Version: 2.1.0
44

55
This document describes the data contained within the files `holidays.yaml` and
66
`names.yaml`.
@@ -523,6 +523,25 @@ Where:
523523
- `09-22 if 09-21 is holiday` is September 22nd is public holiday only if September 21st is also a holiday
524524
- `09-22 if 09-21 and 09-23 is public holiday` is September 22nd is public holiday only if September 21st and September 23rd are public holidays
525525

526+
### Change to different weekday if date already falls on a holiday
527+
528+
Rule: `<rule> if is (<type>)? holiday then (<count>)? (next|previous) <weekday>`
529+
530+
Rule: `<rule> if is (<type>)? holiday then (<count>)? (next|previous) day (omit <weekdays>)?`
531+
532+
Where:
533+
- `<rule>` any rule
534+
- `<type>` public, bank, school, observance, optional (defaults to public if omitted)
535+
- `<count>` 1...31, 1st, 2nd, 3rd
536+
- `<weekday>` Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
537+
- `<weekdays>` Comma separated list of `<weekday>`
538+
539+
**Examples**:
540+
541+
- `Thursday after 04-02 if is observance holiday then next Thursday`
542+
- `03-01 and if Saturday, Sunday then next Monday if is holiday then 2nd next Tuesday since 2022`
543+
- `05-01 if is public holiday then 2nd next day omit Saturday, Sunday`
544+
526545
### Enabling a rule since or in certain years
527546

528547
> __Note:__ Use quotes around dates!

test/fixtures/CH-2015.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"rule": "01-01",
99
"_weekday": "Thu"
1010
},
11+
{
12+
"date": "2015-04-02 00:00:00",
13+
"start": "2015-04-01T22:00:00.000Z",
14+
"end": "2015-04-02T22:00:00.000Z",
15+
"name": "Gründonnerstag",
16+
"type": "observance",
17+
"rule": "easter -3",
18+
"_weekday": "Thu"
19+
},
1120
{
1221
"date": "2015-04-03 00:00:00",
1322
"start": "2015-04-02T22:00:00.000Z",

test/fixtures/CH-2016.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"rule": "01-01",
99
"_weekday": "Fri"
1010
},
11+
{
12+
"date": "2016-03-24 00:00:00",
13+
"start": "2016-03-23T23:00:00.000Z",
14+
"end": "2016-03-24T23:00:00.000Z",
15+
"name": "Gründonnerstag",
16+
"type": "observance",
17+
"rule": "easter -3",
18+
"_weekday": "Thu"
19+
},
1120
{
1221
"date": "2016-03-25 00:00:00",
1322
"start": "2016-03-24T23:00:00.000Z",

test/fixtures/CH-2017.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"rule": "01-01",
99
"_weekday": "Sun"
1010
},
11+
{
12+
"date": "2017-04-13 00:00:00",
13+
"start": "2017-04-12T22:00:00.000Z",
14+
"end": "2017-04-13T22:00:00.000Z",
15+
"name": "Gründonnerstag",
16+
"type": "observance",
17+
"rule": "easter -3",
18+
"_weekday": "Thu"
19+
},
1120
{
1221
"date": "2017-04-14 00:00:00",
1322
"start": "2017-04-13T22:00:00.000Z",

test/fixtures/CH-2018.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"rule": "01-01",
99
"_weekday": "Mon"
1010
},
11+
{
12+
"date": "2018-03-29 00:00:00",
13+
"start": "2018-03-28T22:00:00.000Z",
14+
"end": "2018-03-29T22:00:00.000Z",
15+
"name": "Gründonnerstag",
16+
"type": "observance",
17+
"rule": "easter -3",
18+
"_weekday": "Thu"
19+
},
1120
{
1221
"date": "2018-03-30 00:00:00",
1322
"start": "2018-03-29T22:00:00.000Z",

test/fixtures/CH-2019.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"rule": "01-01",
99
"_weekday": "Tue"
1010
},
11+
{
12+
"date": "2019-04-18 00:00:00",
13+
"start": "2019-04-17T22:00:00.000Z",
14+
"end": "2019-04-18T22:00:00.000Z",
15+
"name": "Gründonnerstag",
16+
"type": "observance",
17+
"rule": "easter -3",
18+
"_weekday": "Thu"
19+
},
1120
{
1221
"date": "2019-04-19 00:00:00",
1322
"start": "2019-04-18T22:00:00.000Z",

test/fixtures/CH-2020.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"rule": "01-01",
99
"_weekday": "Wed"
1010
},
11+
{
12+
"date": "2020-04-09 00:00:00",
13+
"start": "2020-04-08T22:00:00.000Z",
14+
"end": "2020-04-09T22:00:00.000Z",
15+
"name": "Gründonnerstag",
16+
"type": "observance",
17+
"rule": "easter -3",
18+
"_weekday": "Thu"
19+
},
1120
{
1221
"date": "2020-04-10 00:00:00",
1322
"start": "2020-04-09T22:00:00.000Z",

0 commit comments

Comments
 (0)