From 1d6fdabb246d1190809fc7cea1c5de12ec25e4d2 Mon Sep 17 00:00:00 2001 From: Raiquen Guidotti Date: Mon, 29 Jan 2024 10:08:27 +0100 Subject: [PATCH] Switzerland: add missing holidays to "ch-ur" region (#191) * 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 --- lang/switzerland/de/holidays.json | 1 + lang/switzerland/fr/holidays.json | 1 + lang/switzerland/it/holidays.json | 1 + src/Countries/Switzerland.php | 91 ++++++++++--------- ..._holidays_for_a_specified_region__zh_.snap | 4 + 5 files changed, 57 insertions(+), 41 deletions(-) diff --git a/lang/switzerland/de/holidays.json b/lang/switzerland/de/holidays.json index c294fd7b8..f59358468 100644 --- a/lang/switzerland/de/holidays.json +++ b/lang/switzerland/de/holidays.json @@ -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", diff --git a/lang/switzerland/fr/holidays.json b/lang/switzerland/fr/holidays.json index 0fe65215c..28a04b822 100644 --- a/lang/switzerland/fr/holidays.json +++ b/lang/switzerland/fr/holidays.json @@ -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", diff --git a/lang/switzerland/it/holidays.json b/lang/switzerland/it/holidays.json index e7a30514c..e62ec667e 100644 --- a/lang/switzerland/it/holidays.json +++ b/lang/switzerland/it/holidays.json @@ -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", diff --git a/src/Countries/Switzerland.php b/src/Countries/Switzerland.php index 94d52f8c9..662860019 100644 --- a/src/Countries/Switzerland.php +++ b/src/Countries/Switzerland.php @@ -36,19 +36,19 @@ 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'; @@ -56,17 +56,19 @@ class Switzerland extends Country 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) { @@ -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) { @@ -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, @@ -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, ], @@ -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, @@ -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, @@ -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, @@ -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 => [], }; @@ -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)); } diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap index f4b753733..f594ea470 100644 --- a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap @@ -27,6 +27,10 @@ "name": "Bundesfeier", "date": "2024-08-01" }, + { + "name": "Buss- und Bettag", + "date": "2024-09-15" + }, { "name": "Weihnachtstag", "date": "2024-12-25"