Skip to content

Commit

Permalink
Switzerland: add missing holidays to "ch-ur" region (#191)
Browse files Browse the repository at this point in the history
* style: rename holidays variable names of Switzerland for consistency and correctness

* feat: add missing holiday to ch-zh

* feat: add missing holidays to ch-ur
  • Loading branch information
Kenny1291 authored Jan 29, 2024
1 parent 6e152ff commit 1d6fdab
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 41 deletions.
1 change: 1 addition & 0 deletions lang/switzerland/de/holidays.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Fronleichnam": "Fronleichnam",
"Bundesfeier": "Bundesfeier",
"Maria Himmelfahrt": "Maria Himmelfahrt",
"Buss- und Bettag" : "Buss- und Bettag",
"Allerheiligen": "Allerheiligen",
"Maria Empfängnis": "Maria Empfängnis",
"Weihnachtstag": "Weihnachtstag",
Expand Down
1 change: 1 addition & 0 deletions lang/switzerland/fr/holidays.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Fronleichnam": "Fête-Dieu",
"Bundesfeier": "Fête nationale",
"Maria Himmelfahrt": "Assomption",
"Buss- und Bettag": "Jeûne fédéral",
"Allerheiligen": "Toussaint",
"Maria Empfängnis": "Immaculée Conception",
"Weihnachtstag": "Noël",
Expand Down
1 change: 1 addition & 0 deletions lang/switzerland/it/holidays.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Fronleichnam": "Corpus Domini",
"Bundesfeier": "Festa nazionale",
"Maria Himmelfahrt": "Assunzione",
"Buss- und Bettag": "Digiuno federale",
"Allerheiligen": "Ognissanti",
"Maria Empfängnis": "Immacolata Concezione",
"Weihnachtstag": "Natale",
Expand Down
91 changes: 50 additions & 41 deletions src/Countries/Switzerland.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,39 @@ class Switzerland extends Country
'ch-zh',
];

private const NEW_YEAR = 'Neujahr';
private const NEW_YEARS_DAY = 'Neujahr';

private const SECOND_JANUARY = 'Berchtoldstag';
private const BERCHTOLDS_DAY = 'Berchtoldstag';

private const THREE_KINGS = 'Heilige Drei Könige';
private const THREE_KINGS_DAY = 'Heilige Drei Könige';

private const DAY_OF_JOSEPH = 'Josefstag';
private const SAINT_JOSEPHS_DAY = 'Josefstag';

private const GOOD_FRIDAY = 'Karfreitag';

private const EASTER_MONDAY = 'Ostermontag';

private const LABOR_DAY = 'Tag der Arbeit';
private const LABOUR_DAY = 'Tag der Arbeit';

private const ASCENSION_DAY = 'Auffahrt';

private const WHIT_MONDAY = 'Pfingstmontag';

private const CORPUS_CHRISTI = 'Fronleichnam';

private const FEDERAL_CELEBRATION = 'Bundesfeier';
private const SWISS_NATIONAL_HOLIDAY = 'Bundesfeier';

private const ASSUMPTION_DAY = 'Maria Himmelfahrt';

private const FEDERAL_DAY_OF_THANKSGIVING_REPENTANCE_AND_PRAYER = "Buss- und Bettag";

private const ALL_SAINTS_DAY = 'Allerheiligen';

private const IMMACULATE_CONCEPTION = 'Maria Empfängnis';

private const CHRISTMAS_DAY = 'Weihnachtstag';

private const ST_STEPHENS_DAY = 'Stephanstag';
private const SAINT_STEPHENS_DAY = 'Stephanstag';

public function __construct(protected ?string $region = null)
{
Expand All @@ -92,25 +94,26 @@ public function regionalHolidays(int $year): array
$easter = $this->easter($year);

$sharedHolidays = [
self::NEW_YEAR => '01-01',
self::NEW_YEARS_DAY => '01-01',
self::ASCENSION_DAY => $easter->addDays(39),
self::FEDERAL_CELEBRATION => '08-01',
self::SWISS_NATIONAL_HOLIDAY => '08-01',
self::CHRISTMAS_DAY => '12-25',
];

$regionallyDifferentHolidays = [
self::SECOND_JANUARY => '01-02',
self::THREE_KINGS => '01-06',
self::DAY_OF_JOSEPH => '03-19',
self::BERCHTOLDS_DAY => '01-02',
self::THREE_KINGS_DAY => '01-06',
self::SAINT_JOSEPHS_DAY => '03-19',
self::GOOD_FRIDAY => $easter->subDays(2),
self::EASTER_MONDAY => $easter->addDay(),
self::LABOR_DAY => '05-01',
self::LABOUR_DAY => '05-01',
self::WHIT_MONDAY => $easter->addDays(50),
self::CORPUS_CHRISTI => $easter->addDays(60),
self::ASSUMPTION_DAY => '08-15',
self::FEDERAL_DAY_OF_THANKSGIVING_REPENTANCE_AND_PRAYER => new CarbonImmutable('third sunday of September '.$year, 'Europe/Zurich'),
self::ALL_SAINTS_DAY => '11-01',
self::IMMACULATE_CONCEPTION => '12-08',
self::ST_STEPHENS_DAY => '12-26',
self::SAINT_STEPHENS_DAY => '12-26',
];

$currentRegion = match ($this->region) {
Expand All @@ -121,35 +124,35 @@ public function regionalHolidays(int $year): array
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-ai' => [
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::CORPUS_CHRISTI,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-bl' => [
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::LABOR_DAY,
self::LABOUR_DAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-bs' => [
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::LABOR_DAY,
self::LABOUR_DAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-be' => [
self::SECOND_JANUARY,
self::BERCHTOLDS_DAY,
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-fr' => [
self::GOOD_FRIDAY,
Expand All @@ -169,12 +172,12 @@ public function regionalHolidays(int $year): array
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-ju' => [
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::LABOR_DAY,
self::LABOUR_DAY,
self::WHIT_MONDAY,
self::CORPUS_CHRISTI,
],
Expand All @@ -183,11 +186,11 @@ public function regionalHolidays(int $year): array
self::CORPUS_CHRISTI,
self::ASSUMPTION_DAY,
self::ALL_SAINTS_DAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-ne' => [
self::GOOD_FRIDAY,
self::LABOR_DAY,
self::LABOUR_DAY,
],
'ch-nw' => [
self::GOOD_FRIDAY,
Expand All @@ -207,10 +210,10 @@ public function regionalHolidays(int $year): array
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-sz' => [
self::DAY_OF_JOSEPH,
self::SAINT_JOSEPHS_DAY,
self::GOOD_FRIDAY,
self::CORPUS_CHRISTI,
self::ASSUMPTION_DAY,
Expand All @@ -224,37 +227,42 @@ public function regionalHolidays(int $year): array
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::ALL_SAINTS_DAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-ti' => [
self::THREE_KINGS,
self::THREE_KINGS_DAY,
self::EASTER_MONDAY,
self::ASSUMPTION_DAY,
self::ALL_SAINTS_DAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-tg' => [
self::SECOND_JANUARY,
self::BERCHTOLDS_DAY,
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::SAINT_STEPHENS_DAY,
],
'ch-ur' => [
self::THREE_KINGS_DAY,
self::SAINT_JOSEPHS_DAY,
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
self::CORPUS_CHRISTI,
self::ASSUMPTION_DAY,
self::ALL_SAINTS_DAY,
self::IMMACULATE_CONCEPTION,
self::SAINT_STEPHENS_DAY
],
'ch-vd' => [
self::SECOND_JANUARY,
self::BERCHTOLDS_DAY,
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::WHIT_MONDAY,
],
'ch-vs' => [
self::DAY_OF_JOSEPH,
self::SAINT_JOSEPHS_DAY,
self::CORPUS_CHRISTI,
self::ASSUMPTION_DAY,
self::ALL_SAINTS_DAY,
Expand All @@ -270,9 +278,10 @@ public function regionalHolidays(int $year): array
'ch-zh' => [
self::GOOD_FRIDAY,
self::EASTER_MONDAY,
self::LABOR_DAY,
self::LABOUR_DAY,
self::WHIT_MONDAY,
self::ST_STEPHENS_DAY,
self::FEDERAL_DAY_OF_THANKSGIVING_REPENTANCE_AND_PRAYER,
self::SAINT_STEPHENS_DAY,
],
default => [],
};
Expand All @@ -293,11 +302,11 @@ protected function allHolidays(int $year): array
}

return array_merge([
self::NEW_YEAR => '01-01',
self::SECOND_JANUARY => '01-02',
self::FEDERAL_CELEBRATION => '08-01',
self::NEW_YEARS_DAY => '01-01',
self::BERCHTOLDS_DAY => '01-02',
self::SWISS_NATIONAL_HOLIDAY => '08-01',
self::CHRISTMAS_DAY => '12-25',
self::ST_STEPHENS_DAY => '12-26',
self::SAINT_STEPHENS_DAY => '12-26',
], $this->variableHolidays($year));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"name": "Bundesfeier",
"date": "2024-08-01"
},
{
"name": "Buss- und Bettag",
"date": "2024-09-15"
},
{
"name": "Weihnachtstag",
"date": "2024-12-25"
Expand Down

0 comments on commit 1d6fdab

Please sign in to comment.