From 12faaaceae25b16c8b40de39ea0d13490cc57581 Mon Sep 17 00:00:00 2001 From: Theron Smith Date: Wed, 17 Jan 2024 13:28:27 -0700 Subject: [PATCH 001/127] Add tests and implementation for calculating Canadian holidays in the Spatie\Holidays package. --- src/Countries/Canada.php | 83 +++++++++++++++++++ .../it_can_calculate_canadian_holidays.snap | 34 ++++++++ tests/Countries/CanadaTest.php | 18 ++++ 3 files changed, 135 insertions(+) create mode 100644 src/Countries/Canada.php create mode 100644 tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap create mode 100644 tests/Countries/CanadaTest.php diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php new file mode 100644 index 000000000..edbf879c2 --- /dev/null +++ b/src/Countries/Canada.php @@ -0,0 +1,83 @@ + */ + protected function allHolidays(int $year): array + { + $easterSunday = $this->calculateEasterSunday($year); + $goodFriday = $easterSunday->subDays(2); + + return array_merge( + [ + 'New Year\'s Day' => new CarbonImmutable("$year-01-01", 'America/Toronto'), + 'Good Friday' => $goodFriday, + 'Victoria Day' => new CarbonImmutable("last monday of May $year", 'America/Toronto'), + 'Canada Day' => new CarbonImmutable("$year-07-01", 'America/Toronto'), + 'Civic Holiday' => new CarbonImmutable( + "first monday of August $year", 'America/Toronto' + ), + 'Labour Day' => new CarbonImmutable( + "first monday of September $year", 'America/Toronto' + ), + 'National Day for Truth and Reconciliation' => new CarbonImmutable( + "$year-10-30", + 'America/Toronto' + ), + 'Thanksgiving' => new CarbonImmutable( + "second monday of October $year", 'America/Toronto' + ), + 'Remembrance Day' => new CarbonImmutable("$year-11-11", 'America/Toronto'), + 'Christmas Day' => new CarbonImmutable("$year-12-25", 'America/Toronto'), + ], + $this->variableHolidays($year) + ); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $victoriaDay = new CarbonImmutable("last monday of May $year", 'America/Toronto'); + if ($victoriaDay->day < 25) { + $victoriaDay = $victoriaDay->addWeek(); + } + + $thanksgiving = new CarbonImmutable("second monday of October $year", 'America/Toronto'); + $boxingDay = new CarbonImmutable($year . '-12-26', 'America/Toronto'); + + return [ + 'Victoria Day' => $victoriaDay, + 'Thanksgiving' => $thanksgiving, + 'Boxing Day' => $boxingDay, + ]; + } + + private function calculateEasterSunday(int $year): CarbonImmutable + { + $a = $year % 19; + $b = intdiv($year, 100); + $c = $year % 100; + $d = intdiv($b, 4); + $e = $b % 4; + $f = intdiv($b + 8, 25); + $g = intdiv($b - $f + 1, 3); + $h = (19 * $a + $b - $d - $g + 15) % 30; + $i = intdiv($c, 4); + $k = $c % 4; + $l = (32 + 2 * $e + 2 * $i - $h - $k) % 7; + $m = intdiv($a + 11 * $h + 22 * $l, 451); + $month = intdiv($h + $l - 7 * $m + 114, 31); + $day = (($h + $l - 7 * $m + 114) % 31) + 1; + + return new CarbonImmutable("$year-$month-$day", 'America/Toronto'); + } +} diff --git a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap new file mode 100644 index 000000000..7cecf1cc3 --- /dev/null +++ b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap @@ -0,0 +1,34 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Victoria Day", + "date": "2024-05-27" + }, + { + "name": "Canada Day", + "date": "2024-07-01" + }, + { + "name": "Labour Day", + "date": "2024-09-02" + }, + { + "name": "Thanksgiving", + "date": "2024-10-14" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Boxing Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/CanadaTest.php b/tests/Countries/CanadaTest.php new file mode 100644 index 000000000..0619c4ecc --- /dev/null +++ b/tests/Countries/CanadaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From a11a4db90653d1714a108ece659f56bea152e4db Mon Sep 17 00:00:00 2001 From: Theron Smith Date: Wed, 17 Jan 2024 13:30:43 -0700 Subject: [PATCH 002/127] Add Canadian holidays to the test snapshot for accurate calculations. --- .../it_can_calculate_canadian_holidays.snap | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap index 7cecf1cc3..fbc41a1a9 100644 --- a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap +++ b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap @@ -15,6 +15,10 @@ "name": "Canada Day", "date": "2024-07-01" }, + { + "name": "Civic Holiday", + "date": "2024-08-05" + }, { "name": "Labour Day", "date": "2024-09-02" @@ -23,6 +27,14 @@ "name": "Thanksgiving", "date": "2024-10-14" }, + { + "name": "National Day for Truth and Reconciliation", + "date": "2024-10-30" + }, + { + "name": "Remembrance Day", + "date": "2024-11-11" + }, { "name": "Christmas Day", "date": "2024-12-25" From 695713f3d6d4f656e5b8795c100988957d7ba881 Mon Sep 17 00:00:00 2001 From: Theron Smith Date: Wed, 17 Jan 2024 15:28:18 -0700 Subject: [PATCH 003/127] Refactor Canada.php to simplify and improve the implementation of holiday dates. --- src/Countries/Canada.php | 52 +++++++++++----------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index edbf879c2..0805f59d8 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -14,30 +14,23 @@ public function countryCode(): string /** @return array */ protected function allHolidays(int $year): array { - $easterSunday = $this->calculateEasterSunday($year); - $goodFriday = $easterSunday->subDays(2); - return array_merge( [ - 'New Year\'s Day' => new CarbonImmutable("$year-01-01", 'America/Toronto'), - 'Good Friday' => $goodFriday, - 'Victoria Day' => new CarbonImmutable("last monday of May $year", 'America/Toronto'), - 'Canada Day' => new CarbonImmutable("$year-07-01", 'America/Toronto'), + 'New Year\'s Day' => new CarbonImmutable($year . "-01-01", 'America/Toronto'), + 'Canada Day' => new CarbonImmutable($year . "-07-01", 'America/Toronto'), 'Civic Holiday' => new CarbonImmutable( - "first monday of August $year", 'America/Toronto' + "first monday of August " . $year, 'America/Toronto' ), 'Labour Day' => new CarbonImmutable( - "first monday of September $year", 'America/Toronto' + "first monday of September " . $year, 'America/Toronto' ), 'National Day for Truth and Reconciliation' => new CarbonImmutable( - "$year-10-30", + $year . "-10-30", 'America/Toronto' ), - 'Thanksgiving' => new CarbonImmutable( - "second monday of October $year", 'America/Toronto' - ), - 'Remembrance Day' => new CarbonImmutable("$year-11-11", 'America/Toronto'), - 'Christmas Day' => new CarbonImmutable("$year-12-25", 'America/Toronto'), + 'Remembrance Day' => new CarbonImmutable($year . "-11-11", 'America/Toronto'), + 'Christmas Day' => new CarbonImmutable($year . "-12-25", 'America/Toronto'), + 'Boxing Day' => new CarbonImmutable($year . '-12-26', 'America/Toronto'), ], $this->variableHolidays($year) ); @@ -46,38 +39,21 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { + $easterSunday = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('America/Toronto'); + + $goodFriday = $easterSunday->subDays(2); + $victoriaDay = new CarbonImmutable("last monday of May $year", 'America/Toronto'); if ($victoriaDay->day < 25) { $victoriaDay = $victoriaDay->addWeek(); } $thanksgiving = new CarbonImmutable("second monday of October $year", 'America/Toronto'); - $boxingDay = new CarbonImmutable($year . '-12-26', 'America/Toronto'); - return [ 'Victoria Day' => $victoriaDay, + 'Good Friday' => $goodFriday, 'Thanksgiving' => $thanksgiving, - 'Boxing Day' => $boxingDay, ]; } - - private function calculateEasterSunday(int $year): CarbonImmutable - { - $a = $year % 19; - $b = intdiv($year, 100); - $c = $year % 100; - $d = intdiv($b, 4); - $e = $b % 4; - $f = intdiv($b + 8, 25); - $g = intdiv($b - $f + 1, 3); - $h = (19 * $a + $b - $d - $g + 15) % 30; - $i = intdiv($c, 4); - $k = $c % 4; - $l = (32 + 2 * $e + 2 * $i - $h - $k) % 7; - $m = intdiv($a + 11 * $h + 22 * $l, 451); - $month = intdiv($h + $l - 7 * $m + 114, 31); - $day = (($h + $l - 7 * $m + 114) % 31) + 1; - - return new CarbonImmutable("$year-$month-$day", 'America/Toronto'); - } } From 25164ea4753038f222806d0bc52d9ed29fed6c94 Mon Sep 17 00:00:00 2001 From: Theron Smith Date: Wed, 17 Jan 2024 15:34:05 -0700 Subject: [PATCH 004/127] Add Easter Sunday as a Canadian holiday in order to accurately calculate Canadian holidays. --- src/Countries/Canada.php | 1 + .../CanadaTest/it_can_calculate_canadian_holidays.snap | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index 0805f59d8..04dfba897 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -53,6 +53,7 @@ protected function variableHolidays(int $year): array return [ 'Victoria Day' => $victoriaDay, 'Good Friday' => $goodFriday, + 'Easter Sunday' => $easterSunday, 'Thanksgiving' => $thanksgiving, ]; } diff --git a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap index fbc41a1a9..f02c28c75 100644 --- a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap +++ b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap @@ -7,6 +7,10 @@ "name": "Good Friday", "date": "2024-03-29" }, + { + "name": "Easter Sunday", + "date": "2024-03-31" + }, { "name": "Victoria Day", "date": "2024-05-27" From a464c3ea3fffabce46d7ba461ef9cfe22e37b3d7 Mon Sep 17 00:00:00 2001 From: Theron Smith Date: Wed, 17 Jan 2024 15:36:30 -0700 Subject: [PATCH 005/127] Update National Day for Truth and Reconciliation to September 30th. --- src/Countries/Canada.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index 04dfba897..034f2eefa 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -25,7 +25,7 @@ protected function allHolidays(int $year): array "first monday of September " . $year, 'America/Toronto' ), 'National Day for Truth and Reconciliation' => new CarbonImmutable( - $year . "-10-30", + $year . "-09-30", 'America/Toronto' ), 'Remembrance Day' => new CarbonImmutable($year . "-11-11", 'America/Toronto'), From 4e8fa475801187370134128c7d7ea69ca72498ad Mon Sep 17 00:00:00 2001 From: Theron Smith Date: Wed, 17 Jan 2024 15:55:19 -0700 Subject: [PATCH 006/127] Refactor Easter Sunday to Easter Monday. --- src/Countries/Canada.php | 3 ++- .../it_can_calculate_canadian_holidays.snap | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index 034f2eefa..c7efc9e22 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -43,6 +43,7 @@ protected function variableHolidays(int $year): array ->setTimezone('America/Toronto'); $goodFriday = $easterSunday->subDays(2); + $easterMonday = $easterSunday->addDays(1); $victoriaDay = new CarbonImmutable("last monday of May $year", 'America/Toronto'); if ($victoriaDay->day < 25) { @@ -53,7 +54,7 @@ protected function variableHolidays(int $year): array return [ 'Victoria Day' => $victoriaDay, 'Good Friday' => $goodFriday, - 'Easter Sunday' => $easterSunday, + 'Easter Monday' => $easterMonday, 'Thanksgiving' => $thanksgiving, ]; } diff --git a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap index f02c28c75..3168b8ea2 100644 --- a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap +++ b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap @@ -8,8 +8,8 @@ "date": "2024-03-29" }, { - "name": "Easter Sunday", - "date": "2024-03-31" + "name": "Easter Monday", + "date": "2024-04-01" }, { "name": "Victoria Day", @@ -28,12 +28,12 @@ "date": "2024-09-02" }, { - "name": "Thanksgiving", - "date": "2024-10-14" + "name": "National Day for Truth and Reconciliation", + "date": "2024-09-30" }, { - "name": "National Day for Truth and Reconciliation", - "date": "2024-10-30" + "name": "Thanksgiving", + "date": "2024-10-14" }, { "name": "Remembrance Day", From 609e39118f3f2c76eb8cadbbad501c04314d565a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emre=20=C3=87al=C4=B1=C5=9Fkan?= Date: Thu, 18 Jan 2024 12:09:03 +0300 Subject: [PATCH 007/127] Added Turkey holidays --- src/Countries/Turkey.php | 35 +++++++++++++++++++ .../it_can_calculate_turkey_holidays.snap | 30 ++++++++++++++++ tests/Countries/TurkeyTest.php | 18 ++++++++++ 3 files changed, 83 insertions(+) create mode 100644 src/Countries/Turkey.php create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap create mode 100644 tests/Countries/TurkeyTest.php diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php new file mode 100644 index 000000000..986bb550a --- /dev/null +++ b/src/Countries/Turkey.php @@ -0,0 +1,35 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Yılbaşı' => '01-01', + 'Ulusal Egemenlik ve Çocuk Bayramı' => '04-23', + 'Emek ve Dayanışma Günü' => '05-01', + 'Atatürk\'ü Anma, Gençlik ve Spor Bayramı' => '05-19', + 'Demokrasi ve Millî Birlik Günü' => '07-15', + 'Zafer Bayramı' => '08-30', + 'Cumhuriyet Bayramı' => '10-29', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + return [ + //It will be implemented after Islamic holidays + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap new file mode 100644 index 000000000..b46bd02f1 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap @@ -0,0 +1,30 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/Countries/TurkeyTest.php b/tests/Countries/TurkeyTest.php new file mode 100644 index 000000000..7265a31fc --- /dev/null +++ b/tests/Countries/TurkeyTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 32087ea1e7a68e4ff4aed7011d66a9fa3417dc0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emre=20=C3=87al=C4=B1=C5=9Fkan?= Date: Thu, 18 Jan 2024 19:19:38 +0300 Subject: [PATCH 008/127] removed comment line --- src/Countries/Turkey.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index 986bb550a..0095bbde6 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'tr'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ From 43900643ab823e93d6a7da124b9b32d0b41f2839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emre=20=C3=87al=C4=B1=C5=9Fkan?= Date: Thu, 18 Jan 2024 19:24:26 +0300 Subject: [PATCH 009/127] Added comment line for variable holidays --- src/Countries/Turkey.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index 0095bbde6..509900372 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -28,7 +28,8 @@ protected function allHolidays(int $year): array protected function variableHolidays(int $year): array { return [ - //It will be implemented after Islamic holidays + //It will be implemented after Islamic holidays. Because Islamic holidays are lunar based. + //https://github.com/spatie/holidays/discussions/79 ]; } } From aeb6c129b8abfe01368269e46455d5eba1b0d3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emre=20=C3=87al=C4=B1=C5=9Fkan?= Date: Thu, 18 Jan 2024 19:29:10 +0300 Subject: [PATCH 010/127] =?UTF-8?q?"Cumhuriyet=20Bayram=C4=B1=20Arifesi"?= =?UTF-8?q?=20holiday=20day=20added.=20Because=20the=20eve=20is=20a=20half?= =?UTF-8?q?=20day=20holiday.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Source: https://tr.wikipedia.org/wiki/T%C3%BCrkiye%27deki_resm%C3%AE_tatiller --- src/Countries/Turkey.php | 1 + .../TurkeyTest/it_can_calculate_turkey_holidays.snap | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index 509900372..58b6c13a8 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -20,6 +20,7 @@ protected function allHolidays(int $year): array 'Atatürk\'ü Anma, Gençlik ve Spor Bayramı' => '05-19', 'Demokrasi ve Millî Birlik Günü' => '07-15', 'Zafer Bayramı' => '08-30', + 'Cumhuriyet Bayramı Arifesi' => '10-28', 'Cumhuriyet Bayramı' => '10-29', ], $this->variableHolidays($year)); } diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap index b46bd02f1..e78266927 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap @@ -23,6 +23,10 @@ "name": "Zafer Bayram\u0131", "date": "2024-08-30" }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, { "name": "Cumhuriyet Bayram\u0131", "date": "2024-10-29" From 67b985e00ea636afc28255558f349da1a63ab3b5 Mon Sep 17 00:00:00 2001 From: kakajansh Date: Fri, 19 Jan 2024 00:16:51 +0500 Subject: [PATCH 011/127] Add Turkmenistan Holidays --- src/Countries/Turkmenistan.php | 75 +++++++++++++++++++ .../it_can_calculate_turkmen_holidays.snap | 50 +++++++++++++ tests/Countries/TurkmenistanTest.php | 18 +++++ 3 files changed, 143 insertions(+) create mode 100644 src/Countries/Turkmenistan.php create mode 100644 tests/.pest/snapshots/Countries/TurkmenistanTest/it_can_calculate_turkmen_holidays.snap create mode 100644 tests/Countries/TurkmenistanTest.php diff --git a/src/Countries/Turkmenistan.php b/src/Countries/Turkmenistan.php new file mode 100644 index 000000000..11004160a --- /dev/null +++ b/src/Countries/Turkmenistan.php @@ -0,0 +1,75 @@ + '01-01', + 'Halkara zenanlar güni' => '03-08', + 'Milli bahar baýramy 1-nji güni' => '03-21', + 'Milli bahar baýramy 2-nji güni' => '03-22', + 'Türkmenistanyň Konstitusiýasynyň we Türkmenistanyň Döwlet baýdagynyň güni' => '05-18', + 'Türkmenistanyň Garaşsyzlyk güni' => '09-27', + 'Hatyra güni' => '10-06', + 'Halkara Bitaraplyk güni' => '12-12', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + return [ + 'Oraza baýramy' => $this->islamicCalendar('01-10', $year), + 'Gurban baýramy 1-nji güni' => $this->islamicCalendar('10-12', $year), + 'Gurban baýramy 2-nji güni' => $this->islamicCalendar('11-12', $year), + 'Gurban baýramy 3-nji güni' => $this->islamicCalendar('12-12', $year), + ]; + } + + protected function islamicCalendar(string $input, int $year, $nextYear = false): string + { + $hijriYear = $this->getHijriYear(year: $year, nextYear: $nextYear); + $formatter = $this->getIslamicFormatter(); + + $timeStamp = $formatter->parse($input . '/' . $hijriYear . ' AH'); + $dateTime = date_create()->setTimeStamp($timeStamp)->setTimezone(new DateTimeZone($this->timezone)); + + return $dateTime->format('m-d'); + } + + protected function getIslamicFormatter(): IntlDateFormatter + { + return new IntlDateFormatter( + locale: 'en-SG@calendar=islamic-civil', + dateType: IntlDateFormatter::MEDIUM, + timeType: IntlDateFormatter::NONE, + timezone: $this->timezone, + calendar: IntlDateFormatter::TRADITIONAL + ); + } + + protected function getHijriYear(int $year, $nextYear = false): int + { + $formatter = $this->getIslamicFormatter(); + $formatter->setPattern('yyyy'); + $dateTime = DateTime::createFromFormat('d/m/Y', '01/01/' . ($nextYear ? $year + 1 : $year)); + + return (int) $formatter->format($dateTime); + } +} diff --git a/tests/.pest/snapshots/Countries/TurkmenistanTest/it_can_calculate_turkmen_holidays.snap b/tests/.pest/snapshots/Countries/TurkmenistanTest/it_can_calculate_turkmen_holidays.snap new file mode 100644 index 000000000..3f4a419d5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkmenistanTest/it_can_calculate_turkmen_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "T\u00e4ze \u00fdyl", + "date": "2024-01-01" + }, + { + "name": "Halkara zenanlar g\u00fcni", + "date": "2024-03-08" + }, + { + "name": "Milli bahar ba\u00fdramy 1-nji g\u00fcni", + "date": "2024-03-21" + }, + { + "name": "Milli bahar ba\u00fdramy 2-nji g\u00fcni", + "date": "2024-03-22" + }, + { + "name": "Oraza ba\u00fdramy", + "date": "2024-04-10" + }, + { + "name": "T\u00fcrkmenistany\u0148 Konstitusi\u00fdasyny\u0148 we T\u00fcrkmenistany\u0148 D\u00f6wlet ba\u00fddagyny\u0148 g\u00fcni", + "date": "2024-05-18" + }, + { + "name": "Gurban ba\u00fdramy 1-nji g\u00fcni", + "date": "2024-06-17" + }, + { + "name": "Gurban ba\u00fdramy 2-nji g\u00fcni", + "date": "2024-06-18" + }, + { + "name": "Gurban ba\u00fdramy 3-nji g\u00fcni", + "date": "2024-06-19" + }, + { + "name": "T\u00fcrkmenistany\u0148 Gara\u015fsyzlyk g\u00fcni", + "date": "2024-09-27" + }, + { + "name": "Hatyra g\u00fcni", + "date": "2024-10-06" + }, + { + "name": "Halkara Bitaraplyk g\u00fcni", + "date": "2024-12-12" + } +] \ No newline at end of file diff --git a/tests/Countries/TurkmenistanTest.php b/tests/Countries/TurkmenistanTest.php new file mode 100644 index 000000000..7f29d6635 --- /dev/null +++ b/tests/Countries/TurkmenistanTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From eb53eab8b5cbfd0dc9f51cc6754bc2cf4d0e8aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Thu, 18 Jan 2024 21:19:42 +0100 Subject: [PATCH 012/127] Add Slovakia holidays --- src/Countries/Slovakia.php | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/Countries/Slovakia.php diff --git a/src/Countries/Slovakia.php b/src/Countries/Slovakia.php new file mode 100644 index 000000000..f400d349b --- /dev/null +++ b/src/Countries/Slovakia.php @@ -0,0 +1,44 @@ + '01-01', + 'Zjavenie Pána (Traja králi)' => '01-06', + 'Sviatok práce' => '05-01', + 'Deň víťazstva nad fašizmom' => '05-08', + 'Sviatok svätého Cyrila a Metoda' => '07-05', + 'Výročie Výročie Slovenského národného povstania' => '08-29', + 'Deň Ústavy Slovenskej republiky' => '09-01', + 'Sedembolestná Panna Mária' => '09-15', + 'Deň vzniku samostatného česko-slovenského štátu' => '10-28', + 'Sviatok všetkých svätých' => '11-01', + 'Deň boja za slobodu a demokraciu' => '11-17', + 'Štedrý deň' => '12-24', + 'Prvý sviatok vianočný' => '12-25', + 'Druhý sviatok vianočný' => '12-26', + ], $this->variableHolidays($year)); + } + + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Europe/Bratislava'); + + return [ + 'Veľkonočný pondelok' => $easter->addDay(), + 'Veľký piatok' => $easter->subDays(2), + ]; + } +} From bff08d203d1393100aa6ea236599c21868d2cbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Thu, 18 Jan 2024 21:20:05 +0100 Subject: [PATCH 013/127] Add Slovakia test --- .../it_can_calculate_slovak_holidays.snap | 66 +++++++++++++++++++ tests/Countries/SlovakiaTest.php | 18 +++++ 2 files changed, 84 insertions(+) create mode 100644 tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap create mode 100644 tests/Countries/SlovakiaTest.php diff --git a/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap b/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap new file mode 100644 index 000000000..2aa7ea1fd --- /dev/null +++ b/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap @@ -0,0 +1,66 @@ +[ + { + "name": "De\u0148 vzniku Slovenskej republiky", + "date": "2024-01-01" + }, + { + "name": "Zjavenie P\u00e1na (Traja kr\u00e1li)", + "date": "2024-01-06" + }, + { + "name": "Ve\u013ek\u00fd piatok", + "date": "2024-03-29" + }, + { + "name": "Ve\u013ekono\u010dn\u00fd pondelok", + "date": "2024-04-01" + }, + { + "name": "Sviatok pr\u00e1ce", + "date": "2024-05-01" + }, + { + "name": "De\u0148 v\u00ed\u0165azstva nad fa\u0161izmom", + "date": "2024-05-08" + }, + { + "name": "Sviatok sv\u00e4t\u00e9ho Cyrila a Metoda", + "date": "2024-07-05" + }, + { + "name": "V\u00fdro\u010die V\u00fdro\u010die Slovensk\u00e9ho n\u00e1rodn\u00e9ho povstania", + "date": "2024-08-29" + }, + { + "name": "De\u0148 \u00dastavy Slovenskej republiky", + "date": "2024-09-01" + }, + { + "name": "Sedembolestn\u00e1 Panna M\u00e1ria", + "date": "2024-09-15" + }, + { + "name": "De\u0148 vzniku samostatn\u00e9ho \u010desko-slovensk\u00e9ho \u0161t\u00e1tu", + "date": "2024-10-28" + }, + { + "name": "Sviatok v\u0161etk\u00fdch sv\u00e4t\u00fdch", + "date": "2024-11-01" + }, + { + "name": "De\u0148 boja za slobodu a demokraciu", + "date": "2024-11-17" + }, + { + "name": "\u0160tedr\u00fd de\u0148", + "date": "2024-12-24" + }, + { + "name": "Prv\u00fd sviatok viano\u010dn\u00fd", + "date": "2024-12-25" + }, + { + "name": "Druh\u00fd sviatok viano\u010dn\u00fd", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/SlovakiaTest.php b/tests/Countries/SlovakiaTest.php new file mode 100644 index 000000000..cb08ebd5a --- /dev/null +++ b/tests/Countries/SlovakiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From b0a84654a80c190776a4bf6cb6234b1bac00d468 Mon Sep 17 00:00:00 2001 From: Tor Lindgaard Date: Thu, 18 Jan 2024 22:24:58 +0100 Subject: [PATCH 014/127] Add Norway Holidays --- src/Countries/Norway.php | 43 ++++++++++++++++ .../it_can_calculate_norwegian_holidays.snap | 50 +++++++++++++++++++ tests/Countries/NorwayTest.php | 18 +++++++ 3 files changed, 111 insertions(+) create mode 100644 src/Countries/Norway.php create mode 100644 tests/.pest/snapshots/Countries/NorwayTest/it_can_calculate_norwegian_holidays.snap create mode 100644 tests/Countries/NorwayTest.php diff --git a/src/Countries/Norway.php b/src/Countries/Norway.php new file mode 100644 index 000000000..c4d09737b --- /dev/null +++ b/src/Countries/Norway.php @@ -0,0 +1,43 @@ + '01-01', + 'Arbeidernes dag' => '05-01', + 'Grunnlovsdag' => '05-17', + 'Første juledag' => '12-25', + 'Andre juledag' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Europe/Oslo'); + + $holidays = [ + 'Skjærtorsdag' => $easter->subDays(3), + 'Langfredag' => $easter->subDays(2), + 'Første påskedag' => $easter, + 'Andre påskedag,' => $easter->addDay(), + 'Kristi Himmelfartsdag' => $easter->addDays(39), + 'Første pinsedag' => $easter->addDays(49), + 'Andre pinsedag' => $easter->addDays(50), + ]; + + return $holidays; + } +} diff --git a/tests/.pest/snapshots/Countries/NorwayTest/it_can_calculate_norwegian_holidays.snap b/tests/.pest/snapshots/Countries/NorwayTest/it_can_calculate_norwegian_holidays.snap new file mode 100644 index 000000000..d9dd9570e --- /dev/null +++ b/tests/.pest/snapshots/Countries/NorwayTest/it_can_calculate_norwegian_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "F\u00f8rste nytt\u00e5rsdag", + "date": "2024-01-01" + }, + { + "name": "Skj\u00e6rtorsdag", + "date": "2024-03-28" + }, + { + "name": "Langfredag", + "date": "2024-03-29" + }, + { + "name": "F\u00f8rste p\u00e5skedag", + "date": "2024-03-31" + }, + { + "name": "Andre p\u00e5skedag,", + "date": "2024-04-01" + }, + { + "name": "Arbeidernes dag", + "date": "2024-05-01" + }, + { + "name": "Kristi Himmelfartsdag", + "date": "2024-05-09" + }, + { + "name": "Grunnlovsdag", + "date": "2024-05-17" + }, + { + "name": "F\u00f8rste pinsedag", + "date": "2024-05-19" + }, + { + "name": "Andre pinsedag", + "date": "2024-05-20" + }, + { + "name": "F\u00f8rste juledag", + "date": "2024-12-25" + }, + { + "name": "Andre juledag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/NorwayTest.php b/tests/Countries/NorwayTest.php new file mode 100644 index 000000000..b9a342763 --- /dev/null +++ b/tests/Countries/NorwayTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 97125e76e045b62d7db0bef446895aaf713e91bc Mon Sep 17 00:00:00 2001 From: Stavros Date: Fri, 19 Jan 2024 02:29:45 +0200 Subject: [PATCH 015/127] Add Greece holidays --- src/Countries/Greece.php | 80 +++++++++++++++++++ .../it_can_calculate_hellenic_holidays.snap | 54 +++++++++++++ tests/Countries/GreeceTest.php | 18 +++++ 3 files changed, 152 insertions(+) create mode 100644 src/Countries/Greece.php create mode 100644 tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap create mode 100644 tests/Countries/GreeceTest.php diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php new file mode 100644 index 000000000..14feef3b4 --- /dev/null +++ b/src/Countries/Greece.php @@ -0,0 +1,80 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Πρωτοχρονιά' => '01-01', + 'Θεοφάνια' => '01-06', + '25η Μαρτίου' => '03-25', + 'Πρωτομαγιά' => '05-01', + 'Δεκαπενταύγουστος' => '08-15', + '28η Οκτωβρίου' => '10-28', + 'Χριστούγεννα' => '12-25', + 'Σύναξη της Θεοτόκου' => '12-26', + + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + + $orthodox_easter = CarbonImmutable::createFromTimestamp( + $this->calculateOrthodoxEaster($year) + )->setTimezone("Europe/Athens"); + + + $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); + + if ( + $protomagia == $orthodox_easter->subDays(2) || + $protomagia == $orthodox_easter->subDays(1) || + $protomagia == $orthodox_easter || + $protomagia == $orthodox_easter->addDay() + ) { + $protomagia = $orthodox_easter->addDays(2); + } + if ($protomagia->isSunday()) { + $protomagia = $protomagia->addDay(); + } + + return [ + 'Καθαρά Δευτέρα' => $orthodox_easter->subDays(48), //always Monday + 'Πρωτομαγιά' => $protomagia, + 'Μεγάλη Παρασκευή' => $orthodox_easter->subDays(2), + 'Κυριακή του Πάσχα' => $orthodox_easter, + 'Δευτέρα του Πάσχα' => $orthodox_easter->addDay(), + 'Αγίου Πνεύματος' => $orthodox_easter->addDays(50), //always Monday + ]; + } + + /** @return string */ + protected function calculateOrthodoxEaster(int $year) + { + $a = $year % 4; + $b = $year % 7; + $c = $year % 19; + $d = (19 * $c + 15) % 30; + $e = (2 * $a + 4 * $b - $d + 34) % 7; + $month = (int) (($d + $e + 114) / 31); + $day = (($d + $e + 114) % 31) + 1; + // julian to gregorian + $jtg = (int) ($year / 100) - (int) ($year / 400) - 2; + + $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); + + return $easterDate; + } +} \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap b/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap new file mode 100644 index 000000000..14b2e6ab2 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Πρωτοχρονιά", + "date": "2024-01-01" + }, + { + "name": "Θεοφάνια", + "date": "2024-01-06" + }, + { + "name": "Καθαρά Δευτέρα", + "date": "2024-03-18" + }, + { + "name": "25η Μαρτίου", + "date": "2024-03-25" + }, + { + "name": "Πρωτομαγιά", + "date": "2024-05-01" + }, + { + "name": "Μεγάλη Παρασκευή", + "date": "2024-05-03" + }, + { + "name": "Κυριακή του Πάσχα", + "date": "2024-05-05" + }, + { + "name": "Δευτέρα του Πάσχα", + "date": "2024-05-06" + }, + { + "name": "Αγίου Πνεύματος", + "date": "2024-06-24" + }, + { + "name": "Δεκαπενταύγουστος", + "date": "2024-08-15" + }, + { + "name": "28η Οκτωβρίου", + "date": "2024-10-28" + }, + { + "name": "Χριστούγεννα", + "date": "2024-12-25" + }, + { + "name": "Σύναξη της Θεοτόκου", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/GreeceTest.php b/tests/Countries/GreeceTest.php new file mode 100644 index 000000000..26805abbe --- /dev/null +++ b/tests/Countries/GreeceTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 3dfb792a0846e463fa07e7879619595c3fae5685 Mon Sep 17 00:00:00 2001 From: Stavros Date: Fri, 19 Jan 2024 13:32:03 +0200 Subject: [PATCH 016/127] Add Greece holidays - phpstan-baseline --- phpstan-baseline.neon | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 51b9330fc..56b63c38f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20,6 +20,26 @@ parameters: count: 1 path: src/Countries/Country.php + - + message: "#^Cannot call method addDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" + count: 1 + path: src/Countries/Greece.php + + - + message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" + count: 1 + path: src/Countries/Greece.php + + - + message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:calculateOrthodoxEaster\\(\\) should return string but returns int\\|false\\.$#" + count: 1 + path: src/Countries/Greece.php + + - + message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:variableHolidays\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/Countries/Greece.php + - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" count: 1 From 81682ff5dfd8726171fca76b53a871d593bc075e Mon Sep 17 00:00:00 2001 From: Stavros Date: Fri, 19 Jan 2024 14:10:32 +0200 Subject: [PATCH 017/127] Add Greece holidays - phpstan-baseline - fix int --- phpstan-baseline.neon | 5 ----- src/Countries/Greece.php | 7 ++++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 56b63c38f..0f6d531fd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -30,11 +30,6 @@ parameters: count: 1 path: src/Countries/Greece.php - - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:calculateOrthodoxEaster\\(\\) should return string but returns int\\|false\\.$#" - count: 1 - path: src/Countries/Greece.php - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:variableHolidays\\(\\) should return array\\ but returns array\\\\.$#" count: 1 diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index 14feef3b4..17e2a29fd 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -60,8 +60,8 @@ protected function variableHolidays(int $year): array ]; } - /** @return string */ - protected function calculateOrthodoxEaster(int $year) + /** @return integer */ + protected function calculateOrthodoxEaster(int $year): int { $a = $year % 4; $b = $year % 7; @@ -75,6 +75,7 @@ protected function calculateOrthodoxEaster(int $year) $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); - return $easterDate; + return (int) $easterDate; + } } \ No newline at end of file From 43f1e72592ac0a0aa7a54c12d5c1a4d8ddb7772c Mon Sep 17 00:00:00 2001 From: Stavros Date: Fri, 19 Jan 2024 14:47:51 +0200 Subject: [PATCH 018/127] fix pest --- .../it_can_calculate_hellenic_holidays.snap | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap b/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap index 14b2e6ab2..00c8075cc 100644 --- a/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap +++ b/tests/.pest/snapshots/Countries/GreeceTest/it_can_calculate_hellenic_holidays.snap @@ -1,54 +1,54 @@ [ { - "name": "Πρωτοχρονιά", + "name": "\u03a0\u03c1\u03c9\u03c4\u03bf\u03c7\u03c1\u03bf\u03bd\u03b9\u03ac", "date": "2024-01-01" }, { - "name": "Θεοφάνια", + "name": "\u0398\u03b5\u03bf\u03c6\u03ac\u03bd\u03b9\u03b1", "date": "2024-01-06" }, { - "name": "Καθαρά Δευτέρα", + "name": "\u039a\u03b1\u03b8\u03b1\u03c1\u03ac \u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1", "date": "2024-03-18" }, { - "name": "25η Μαρτίου", + "name": "25\u03b7 \u039c\u03b1\u03c1\u03c4\u03af\u03bf\u03c5", "date": "2024-03-25" }, { - "name": "Πρωτομαγιά", + "name": "\u03a0\u03c1\u03c9\u03c4\u03bf\u03bc\u03b1\u03b3\u03b9\u03ac", "date": "2024-05-01" }, { - "name": "Μεγάλη Παρασκευή", + "name": "\u039c\u03b5\u03b3\u03ac\u03bb\u03b7 \u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae", "date": "2024-05-03" }, { - "name": "Κυριακή του Πάσχα", + "name": "\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae \u03c4\u03bf\u03c5 \u03a0\u03ac\u03c3\u03c7\u03b1", "date": "2024-05-05" }, { - "name": "Δευτέρα του Πάσχα", + "name": "\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1 \u03c4\u03bf\u03c5 \u03a0\u03ac\u03c3\u03c7\u03b1", "date": "2024-05-06" }, { - "name": "Αγίου Πνεύματος", + "name": "\u0391\u03b3\u03af\u03bf\u03c5 \u03a0\u03bd\u03b5\u03cd\u03bc\u03b1\u03c4\u03bf\u03c2", "date": "2024-06-24" }, { - "name": "Δεκαπενταύγουστος", + "name": "\u0394\u03b5\u03ba\u03b1\u03c0\u03b5\u03bd\u03c4\u03b1\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2", "date": "2024-08-15" }, { - "name": "28η Οκτωβρίου", + "name": "28\u03b7 \u039f\u03ba\u03c4\u03c9\u03b2\u03c1\u03af\u03bf\u03c5", "date": "2024-10-28" }, { - "name": "Χριστούγεννα", + "name": "\u03a7\u03c1\u03b9\u03c3\u03c4\u03bf\u03cd\u03b3\u03b5\u03bd\u03bd\u03b1", "date": "2024-12-25" }, { - "name": "Σύναξη της Θεοτόκου", + "name": "\u03a3\u03cd\u03bd\u03b1\u03be\u03b7 \u03c4\u03b7\u03c2 \u0398\u03b5\u03bf\u03c4\u03cc\u03ba\u03bf\u03c5", "date": "2024-12-26" } ] \ No newline at end of file From 8ec69653cf5ef6f7405c55e27e244eaa4e1aece2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Fri, 19 Jan 2024 18:37:16 +0100 Subject: [PATCH 019/127] Fix typo Co-authored-by: matusk --- src/Countries/Slovakia.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Slovakia.php b/src/Countries/Slovakia.php index f400d349b..589f0989a 100644 --- a/src/Countries/Slovakia.php +++ b/src/Countries/Slovakia.php @@ -19,7 +19,7 @@ protected function allHolidays(int $year): array 'Sviatok práce' => '05-01', 'Deň víťazstva nad fašizmom' => '05-08', 'Sviatok svätého Cyrila a Metoda' => '07-05', - 'Výročie Výročie Slovenského národného povstania' => '08-29', + 'Výročie Slovenského národného povstania' => '08-29', 'Deň Ústavy Slovenskej republiky' => '09-01', 'Sedembolestná Panna Mária' => '09-15', 'Deň vzniku samostatného česko-slovenského štátu' => '10-28', From ee8e9e1bf2812afc1c1f38c1bd6e586d344aa28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Fri, 19 Jan 2024 18:37:32 +0100 Subject: [PATCH 020/127] Fix typo Co-authored-by: matusk --- .../SlovakiaTest/it_can_calculate_slovak_holidays.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap b/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap index 2aa7ea1fd..a802e2e06 100644 --- a/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap +++ b/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap @@ -28,7 +28,7 @@ "date": "2024-07-05" }, { - "name": "V\u00fdro\u010die V\u00fdro\u010die Slovensk\u00e9ho n\u00e1rodn\u00e9ho povstania", + "name": "V\u00fdro\u010die Slovensk\u00e9ho n\u00e1rodn\u00e9ho povstania", "date": "2024-08-29" }, { From 56cac551bf3ec4189609faa3572995a517d54d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Fri, 19 Jan 2024 18:45:39 +0100 Subject: [PATCH 021/127] Update Slovakia.php Co-authored-by: matusk --- src/Countries/Slovakia.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Countries/Slovakia.php b/src/Countries/Slovakia.php index 589f0989a..0d5774f04 100644 --- a/src/Countries/Slovakia.php +++ b/src/Countries/Slovakia.php @@ -22,7 +22,6 @@ protected function allHolidays(int $year): array 'Výročie Slovenského národného povstania' => '08-29', 'Deň Ústavy Slovenskej republiky' => '09-01', 'Sedembolestná Panna Mária' => '09-15', - 'Deň vzniku samostatného česko-slovenského štátu' => '10-28', 'Sviatok všetkých svätých' => '11-01', 'Deň boja za slobodu a demokraciu' => '11-17', 'Štedrý deň' => '12-24', From 9e229556b60a1f24caca39bfab0bfa0b36ac4a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Fri, 19 Jan 2024 18:45:45 +0100 Subject: [PATCH 022/127] Update it_can_calculate_slovak_holidays.snap Co-authored-by: matusk --- .../SlovakiaTest/it_can_calculate_slovak_holidays.snap | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap b/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap index a802e2e06..ac07602fd 100644 --- a/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap +++ b/tests/.pest/snapshots/Countries/SlovakiaTest/it_can_calculate_slovak_holidays.snap @@ -39,10 +39,6 @@ "name": "Sedembolestn\u00e1 Panna M\u00e1ria", "date": "2024-09-15" }, - { - "name": "De\u0148 vzniku samostatn\u00e9ho \u010desko-slovensk\u00e9ho \u0161t\u00e1tu", - "date": "2024-10-28" - }, { "name": "Sviatok v\u0161etk\u00fdch sv\u00e4t\u00fdch", "date": "2024-11-01" From 0d0867b98e3ee905101a0106edb66915020a070d Mon Sep 17 00:00:00 2001 From: Amit Samtani Date: Fri, 19 Jan 2024 15:14:05 -0500 Subject: [PATCH 023/127] Add Panama Holidays --- src/Countries/Panama.php | 75 +++++++++++++++++ .../it_can_calculate_panama_holidays.snap | 82 +++++++++++++++++++ tests/Countries/PanamaTest.php | 18 ++++ 3 files changed, 175 insertions(+) create mode 100644 src/Countries/Panama.php create mode 100644 tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap create mode 100644 tests/Countries/PanamaTest.php diff --git a/src/Countries/Panama.php b/src/Countries/Panama.php new file mode 100644 index 000000000..b88ccb96a --- /dev/null +++ b/src/Countries/Panama.php @@ -0,0 +1,75 @@ + '01-01', + 'Día de los Mártires' => '01-09', + 'Día del Trabajador' => '05-01', + 'Separación de Panamá de Colombia' => '11-03', + 'Día de los Símbolos Patrios' => '11-04', + 'Día de Consolidación de la Separación de Panamá con Colombia en Colón' => '11-05', + 'Grito de la Independencia' => '11-10', + 'Independencia de Panamá de España' => '11-28', + 'Día de las Madres' => '12-08', + 'Día de los Caídos por la invasión de Estados Unidos a Panamá' => '12-20', + 'Navidad' => '12-25', + ]; + + return array_merge( + $fixedHolidays, + $this->puentes($fixedHolidays, $year), + $this->variableHolidays($year) + ); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Carnaval (Día 1)' => $easter->subDays(50), + 'Carnaval (Día 2)' => $easter->subDays(49), + 'Carnaval (Día 3)' => $easter->subDays(48), + 'Carnaval (Día 4)' => $easter->subDays(47), + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + ]; + } + + /** + * @param array $fixedHolidays Array of holidays in the format ['holiday name' => 'mm-dd'] + * @param int $year The year for which to calculate the holidays + * @return array + */ + protected function puentes(array $fixedHolidays, int $year): array + { + $holidays = []; + + foreach ($fixedHolidays as $name => $date) { + $holiday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$date}"); + + if ($holiday !== false) { + $holidays[$name] = $holiday; + if ($holiday->isSunday()) { + $holidays[$name . ' (Puente)'] = $holiday->addDay(); + } + } + } + + return $holidays; + } + +} diff --git a/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap b/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap new file mode 100644 index 000000000..b3231862a --- /dev/null +++ b/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap @@ -0,0 +1,82 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "D\u00eda de los M\u00e1rtires", + "date": "2024-01-09" + }, + { + "name": "Carnaval (D\u00eda 1)", + "date": "2024-02-10" + }, + { + "name": "Carnaval (D\u00eda 2)", + "date": "2024-02-11" + }, + { + "name": "Carnaval (D\u00eda 3)", + "date": "2024-02-12" + }, + { + "name": "Carnaval (D\u00eda 4)", + "date": "2024-02-13" + }, + { + "name": "Jueves Santo", + "date": "2024-03-28" + }, + { + "name": "Viernes Santo", + "date": "2024-03-29" + }, + { + "name": "D\u00eda del Trabajador", + "date": "2024-05-01" + }, + { + "name": "Separaci\u00f3n de Panam\u00e1 de Colombia", + "date": "2024-11-03" + }, + { + "name": "D\u00eda de los S\u00edmbolos Patrios", + "date": "2024-11-04" + }, + { + "name": "Separaci\u00f3n de Panam\u00e1 de Colombia (Puente)", + "date": "2024-11-04" + }, + { + "name": "D\u00eda de Consolidaci\u00f3n de la Separaci\u00f3n de Panam\u00e1 con Colombia en Col\u00f3n", + "date": "2024-11-05" + }, + { + "name": "Grito de la Independencia", + "date": "2024-11-10" + }, + { + "name": "Grito de la Independencia (Puente)", + "date": "2024-11-11" + }, + { + "name": "Independencia de Panam\u00e1 de Espa\u00f1a", + "date": "2024-11-28" + }, + { + "name": "D\u00eda de las Madres", + "date": "2024-12-08" + }, + { + "name": "D\u00eda de las Madres (Puente)", + "date": "2024-12-09" + }, + { + "name": "D\u00eda de los Ca\u00eddos por la invasi\u00f3n de Estados Unidos a Panam\u00e1", + "date": "2024-12-20" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/PanamaTest.php b/tests/Countries/PanamaTest.php new file mode 100644 index 000000000..f848a26f2 --- /dev/null +++ b/tests/Countries/PanamaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From ae7232bf81a5544bfa6ce41f82bf4e60a8087735 Mon Sep 17 00:00:00 2001 From: Amit Samtani Date: Fri, 19 Jan 2024 15:26:50 -0500 Subject: [PATCH 024/127] Add Panama Holidays --- src/Countries/Panama.php | 1 + .../PanamaTest/it_can_calculate_panama_holidays.snap | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Countries/Panama.php b/src/Countries/Panama.php index b88ccb96a..8e135b07a 100644 --- a/src/Countries/Panama.php +++ b/src/Countries/Panama.php @@ -46,6 +46,7 @@ protected function variableHolidays(int $year): array 'Carnaval (Día 4)' => $easter->subDays(47), 'Jueves Santo' => $easter->subDays(3), 'Viernes Santo' => $easter->subDays(2), + 'Sábado de Gloria' => $easter->subDays(1), ]; } diff --git a/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap b/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap index b3231862a..cbe9ce887 100644 --- a/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap +++ b/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap @@ -31,6 +31,10 @@ "name": "Viernes Santo", "date": "2024-03-29" }, + { + "name": "S\u00e1bado de Gloria", + "date": "2024-03-30" + }, { "name": "D\u00eda del Trabajador", "date": "2024-05-01" From 751da09dd5df9b2113fbe6328cc85e433473ba0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Fri, 19 Jan 2024 22:26:50 +0100 Subject: [PATCH 025/127] Add return type docblock --- src/Countries/Slovakia.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Countries/Slovakia.php b/src/Countries/Slovakia.php index f400d349b..199aea437 100644 --- a/src/Countries/Slovakia.php +++ b/src/Countries/Slovakia.php @@ -31,6 +31,7 @@ protected function allHolidays(int $year): array ], $this->variableHolidays($year)); } + /** @return array */ protected function variableHolidays(int $year): array { $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) From 876005a586c42217171bb32706c10eed35f5eaee Mon Sep 17 00:00:00 2001 From: Amit Samtani Date: Sat, 20 Jan 2024 07:57:36 -0500 Subject: [PATCH 026/127] Add sources on where we got the holidays. Rename puentes to calculateBridgeDays to keep everything in English. --- src/Countries/Panama.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Countries/Panama.php b/src/Countries/Panama.php index 8e135b07a..04f3c54d8 100644 --- a/src/Countries/Panama.php +++ b/src/Countries/Panama.php @@ -11,6 +11,9 @@ public function countryCode(): string return 'pa'; } + /* + * Source: https://www.telemetro.com/nacionales/calendario-feriados-panama-2024-todos-los-dias-no-laborables-y-festivos-n5953115 + */ protected function allHolidays(int $year): array { $fixedHolidays = [ @@ -29,8 +32,8 @@ protected function allHolidays(int $year): array return array_merge( $fixedHolidays, - $this->puentes($fixedHolidays, $year), - $this->variableHolidays($year) + $this->variableHolidays($year), + $this->calculateBridgeDays($fixedHolidays, $year), ); } @@ -51,11 +54,26 @@ protected function variableHolidays(int $year): array } /** + * Calculate bridge days for holidays that fall on a Sunday. + * In Panama, these are called "puentes" + * + * Source: https://www.telemetro.com/nacionales/calendario-dias-libres-panama-este-2023-n5825178 + * + * Spanish: + * "Según el artículo 47 del código de trabajo un día es considerado puente cuando la fecha + * establecida para una celebración nacional coincida con un día domingo, el lunes siguiente + * se habilitará como día de descanso semanal obligatorio" + * + * English Translation: + * "According to article 47 of the labor code, a day is considered a bridge when the date + * established for a national celebration to coincide with a Sunday, the following Monday + * will be enabled as a mandatory weekly rest day" + * * @param array $fixedHolidays Array of holidays in the format ['holiday name' => 'mm-dd'] * @param int $year The year for which to calculate the holidays * @return array */ - protected function puentes(array $fixedHolidays, int $year): array + protected function calculateBridgeDays(array $fixedHolidays, int $year): array { $holidays = []; @@ -72,5 +90,4 @@ protected function puentes(array $fixedHolidays, int $year): array return $holidays; } - } From d12bcb4a40a027e2fc8f5468f24b00f8a82a5634 Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sat, 20 Jan 2024 20:34:35 +0300 Subject: [PATCH 027/127] Added Islamic holidays --- src/Countries/Turkey.php | 275 +++++++++++++++++- .../it_can_calculate_turkey_holidays.snap | 34 --- ...olidays_with_data_set___1970____1970_.snap | 70 +++++ ...olidays_with_data_set___1973____1973_.snap | 70 +++++ ...olidays_with_data_set___1974____1974_.snap | 70 +++++ ...olidays_with_data_set___1975____1975_.snap | 70 +++++ ...olidays_with_data_set___1999____1999_.snap | 70 +++++ ...olidays_with_data_set___2000____2000_.snap | 70 +++++ ...olidays_with_data_set___2001____2001_.snap | 70 +++++ ...olidays_with_data_set___2005____2005_.snap | 70 +++++ ...olidays_with_data_set___2006____2006_.snap | 70 +++++ ...olidays_with_data_set___2007____2007_.snap | 70 +++++ ...olidays_with_data_set___2008____2008_.snap | 70 +++++ ...olidays_with_data_set___2009____2009_.snap | 70 +++++ ...olidays_with_data_set___2016____2016_.snap | 70 +++++ ...olidays_with_data_set___2017____2017_.snap | 70 +++++ ...olidays_with_data_set___2021____2021_.snap | 70 +++++ ...olidays_with_data_set___2022____2022_.snap | 70 +++++ ...olidays_with_data_set___2023____2023_.snap | 70 +++++ ...olidays_with_data_set___2024____2024_.snap | 70 +++++ ...olidays_with_data_set___2025____2025_.snap | 70 +++++ ...olidays_with_data_set___2032____2032_.snap | 70 +++++ ...olidays_with_data_set___2033____2033_.snap | 70 +++++ ...olidays_with_data_set___2034____2034_.snap | 70 +++++ ...olidays_with_data_set___2037____2037_.snap | 70 +++++ tests/Countries/TurkeyTest.php | 2 +- 26 files changed, 1879 insertions(+), 42 deletions(-) delete mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2024____2024_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap create mode 100644 tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index 58b6c13a8..698b78532 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -6,6 +6,169 @@ class Turkey extends Country { + /** + * No library or built-in php intl functions convert dates properly for all years or all country including + * “geniusts/hijri-dates”. It is most logical to prepare the dates between 1970 and 1938 as a constant property + * for Islamic holidays. Because Islamic holidays predicted and actual dates may change until the last moment. + * Since the information on wikipedia is incorrect, it was obtained by searching the old calendar + * on Google Images for each year. The accuracy of the information has been double checked. + * Ramadan and Eid al-Adha vary for Turkey and other countries. + * A converter algorithm that will cover all years does not seem possible. + */ + public const ramadanHolidays = [ + 1970 => '12-01', + 1971 => '11-20', + 1972 => '11-08', + 1973 => '10-28', + 1974 => '10-17', + 1975 => '10-06', + 1976 => '09-25', + 1977 => '09-15', + 1978 => '09-04', + 1979 => '08-24', + 1980 => '08-12', + 1981 => '08-01', + 1982 => '07-22', + 1983 => '07-12', + 1984 => '06-30', + 1985 => '06-20', + 1986 => '06-09', + 1987 => '05-29', + 1988 => '05-17', + 1989 => '05-06', + 1990 => '04-26', + 1991 => '04-16', + 1992 => '04-04', + 1993 => '03-24', + 1994 => '03-13', + 1995 => '03-03', + 1996 => '02-20', + 1997 => '02-09', + 1998 => '01-29', + 1999 => '01-19', + 2000 => [ + '01-08', + '12-27', + ], + 2001 => '12-16', + 2002 => '12-05', + 2003 => '11-25', + 2004 => '11-14', + 2005 => '11-03', + 2006 => '10-23', + 2007 => '10-12', + 2008 => '09-30', + 2009 => '09-20', + 2010 => '09-09', + 2011 => '08-30', + 2012 => '08-19', + 2013 => '08-08', + 2014 => '07-28', + 2015 => '07-17', + 2016 => '07-05', + 2017 => '06-25', + 2018 => '06-15', + 2019 => '06-04', + 2020 => '05-24', + 2021 => '05-13', + 2022 => '05-02', + 2023 => '04-21', + 2024 => '04-10', + 2025 => '04-30', + 2026 => '03-20', + 2027 => '03-09', + 2028 => '02-26', + 2029 => '02-14', + 2030 => '02-03', + 2031 => '01-24', + 2032 => '01-14', + 2033 => [ + '01-02', + '12-23', + ], + 2034 => '12-11', + 2035 => '12-01', + 2036 => '11-19', + 2037 => '11-09', + ]; + + public const sacrificeHolidays = [ + 1970 => '02-17', + 1971 => '02-16', + 1972 => '01-27', + 1973 => '01-15', + 1974 => [ + '01-04', + '12-24', + ], + 1975 => '12-13', + 1976 => '12-02', + 1977 => '11-22', + 1978 => '11-11', + 1979 => '10-31', + 1980 => '10-19', + 1981 => '10-08', + 1982 => '09-27', + 1983 => '09-17', + 1984 => '09-06', + 1985 => '08-26', + 1986 => '08-16', + 1987 => '08-05', + 1988 => '07-24', + 1989 => '07-13', + 1990 => '07-03', + 1991 => '06-23', + 1992 => '06-11', + 1993 => '06-01', + 1994 => '05-21', + 1995 => '05-10', + 1996 => '04-28', + 1997 => '04-18', + 1998 => '04-07', + 1999 => '03-28', + 2000 => '03-16', + 2001 => '03-05', + 2002 => '02-22', + 2003 => '02-11', + 2004 => '02-01', + 2005 => '01-20', + 2006 => [ + '01-10', + '12-31', + ], + 2007 => '12-20', + 2008 => '12-08', + 2009 => '11-27', + 2010 => '11-16', + 2011 => '11-06', + 2012 => '10-25', + 2013 => '10-15', + 2014 => '10-04', + 2015 => '09-23', + 2016 => '09-12', + 2017 => '09-01', + 2018 => '08-21', + 2019 => '08-11', + 2020 => '07-31', + 2021 => '07-20', + 2022 => '07-09', + 2023 => '06-28', + 2024 => '06-16', + 2025 => '06-06', + 2026 => '05-26', + 2027 => '05-16', + 2028 => '05-04', + 2029 => '04-23', + 2030 => '04-13', + 2031 => '04-02', + 2032 => '03-21', + 2033 => '03-11', + 2034 => '02-28', + 2035 => '02-17', + 2036 => '02-07', + 2037 => '01-26', + ]; + public function countryCode(): string { return 'tr'; @@ -13,24 +176,122 @@ public function countryCode(): string protected function allHolidays(int $year): array { + $newHolidays = []; + + if ($year >= 2009) { + $newHolidays['Emek ve Dayanışma Günü'] = '05-01'; + } + + if ($year >= 2017) { + $newHolidays['Demokrasi ve Millî Birlik Günü'] = '07-15'; + } + return array_merge([ 'Yılbaşı' => '01-01', 'Ulusal Egemenlik ve Çocuk Bayramı' => '04-23', - 'Emek ve Dayanışma Günü' => '05-01', 'Atatürk\'ü Anma, Gençlik ve Spor Bayramı' => '05-19', - 'Demokrasi ve Millî Birlik Günü' => '07-15', 'Zafer Bayramı' => '08-30', 'Cumhuriyet Bayramı Arifesi' => '10-28', 'Cumhuriyet Bayramı' => '10-29', - ], $this->variableHolidays($year)); + ], $newHolidays, $this->variableHolidays($year)); } /** @return array */ protected function variableHolidays(int $year): array { - return [ - //It will be implemented after Islamic holidays. Because Islamic holidays are lunar based. - //https://github.com/spatie/holidays/discussions/79 - ]; + return array_merge([ + + ], $this->getIslamicHolidays( + year: $year, + holidays: self::ramadanHolidays, + label: 'Ramazan Bayramı', + day: 3 + ), $this->getIslamicHolidays( + year: $year, + holidays: self::sacrificeHolidays, + label: 'Kurban Bayramı', + day: 4 + )); + } + + /** + * @param array> $holidays + * @return array + */ + protected function getIslamicHolidays( + int $year, + array $holidays, + string $label, + int $day, + ): array { + $islamicHolidays = []; + $counter = 0; + + if ($year != 1970) { + $previousHoliday = is_array($holidays[$year - 1]) ? $holidays[$year - 1][1] : $holidays[$year - 1]; + + $previousHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year - 1).'-'.$previousHoliday); + + if ($previousHoliday->addDays($day - 1)->year == $year) { + $islamicHolidays = $this->prepareHolidays( + holiday: $previousHoliday, + day: $day, + label: $label, + filterYear: $year + ); + $counter++; + } + } + + $currentYearHolidays = is_array($holidays[$year]) ? $holidays[$year] : [$holidays[$year]]; + + foreach ($currentYearHolidays as $currentYearHoliday) { + $currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$currentYearHoliday}"); + + $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( + holiday: $currentYearHoliday, + day: $day, + label: $label, + filterYear: $year, + prefix: $counter ? ($counter + 1).'. ' : '' + )); + $counter++; + } + + if ($year != 2037) { + $nextHoliday = is_array($holidays[$year + 1]) ? $holidays[$year + 1][1] : $holidays[$year + 1]; + + $nextHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year + 1).'-'.$nextHoliday); + + if ($nextHoliday->addDays(-1)->year == $year) { + $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( + holiday: $nextHoliday, + day: $day, + label: $label, + filterYear: $year, + prefix: $counter ? ($counter + 1).'. ' : '' + )); + } + } + + return $islamicHolidays; + } + + /** @return array */ + protected function prepareHolidays( + CarbonImmutable $holiday, + int $day, + string $label, + int $filterYear, + string $prefix = '' + ): array { + $holidays = []; + + $holidays[$prefix.$label.' Arifesi'] = $holiday->addDays(-1); + foreach (range(1, $day) as $range) { + $holidays[$prefix.$label.' '.$range.'. Gün'] = $holiday->addDays($range - 1); + } + + return array_filter($holidays, fn ($holiday) => $holiday->year == $filterYear); } } diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap deleted file mode 100644 index e78266927..000000000 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays.snap +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" - }, - { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" - }, - { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" - }, - { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" - }, - { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" - }, - { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2024____2024_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2024____2024_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2024____2024_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap new file mode 100644 index 000000000..14d82b725 --- /dev/null +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Y\u0131lba\u015f\u0131", + "date": "2024-01-01" + }, + { + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2024-04-09" + }, + { + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2024-04-10" + }, + { + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2024-04-11" + }, + { + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2024-04-12" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2024-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2024-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2024-05-19" + }, + { + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2024-06-15" + }, + { + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2024-06-16" + }, + { + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2024-06-17" + }, + { + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2024-06-18" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2024-06-19" + }, + { + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2024-07-15" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2024-08-30" + }, + { + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2024-10-28" + }, + { + "name": "Cumhuriyet Bayram\u0131", + "date": "2024-10-29" + } +] \ No newline at end of file diff --git a/tests/Countries/TurkeyTest.php b/tests/Countries/TurkeyTest.php index 7265a31fc..7579c764e 100644 --- a/tests/Countries/TurkeyTest.php +++ b/tests/Countries/TurkeyTest.php @@ -15,4 +15,4 @@ ->not()->toBeEmpty(); expect(formatDates($holidays))->toMatchSnapshot(); -}); +})->with([1970, 1973, 1974, 1975, 1999, 2000, 2001, 2005, 2006, 2007, 2008, 2009, 2016, 2017, 2021, 2022, 2023, 2024, 2025, 2032, 2033, 2034, 2037]); From 7e0e1181487254758b19debec5f47638fb1fabc8 Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sat, 20 Jan 2024 20:40:55 +0300 Subject: [PATCH 028/127] Added Islamic holidays --- ...olidays_with_data_set___1970____1970_.snap | 64 +++++++--------- ...olidays_with_data_set___1973____1973_.snap | 64 +++++++--------- ...olidays_with_data_set___1974____1974_.snap | 76 +++++++++++-------- ...olidays_with_data_set___1975____1975_.snap | 60 +++++++-------- ...olidays_with_data_set___1999____1999_.snap | 46 +++++------ ...olidays_with_data_set___2000____2000_.snap | 62 ++++++++------- ...olidays_with_data_set___2001____2001_.snap | 64 +++++++--------- ...olidays_with_data_set___2005____2005_.snap | 64 +++++++--------- ...olidays_with_data_set___2006____2006_.snap | 64 ++++++++-------- ...olidays_with_data_set___2007____2007_.snap | 70 +++++++++-------- ...olidays_with_data_set___2008____2008_.snap | 60 +++++++-------- ...olidays_with_data_set___2009____2009_.snap | 64 ++++++++-------- ...olidays_with_data_set___2016____2016_.snap | 56 +++++++------- ...olidays_with_data_set___2017____2017_.snap | 56 +++++++------- ...olidays_with_data_set___2021____2021_.snap | 50 ++++++------ ...olidays_with_data_set___2022____2022_.snap | 46 +++++------ ...olidays_with_data_set___2023____2023_.snap | 38 +++++----- ...olidays_with_data_set___2025____2025_.snap | 46 +++++------ ...olidays_with_data_set___2032____2032_.snap | 50 ++++++------ ...olidays_with_data_set___2033____2033_.snap | 66 ++++++++++------ ...olidays_with_data_set___2034____2034_.snap | 64 ++++++++-------- ...olidays_with_data_set___2037____2037_.snap | 64 ++++++++-------- tests/Countries/TurkeyTest.php | 4 +- 23 files changed, 637 insertions(+), 661 deletions(-) diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap index 14d82b725..34cfe3060 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1970____1970_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "1970-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "1970-02-16" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "1970-02-17" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "1970-02-18" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "1970-02-19" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "1970-02-20" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "1970-04-23" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" - }, - { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" - }, - { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "1970-05-19" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Zafer Bayram\u0131", + "date": "1970-08-30" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "1970-10-28" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "1970-10-29" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "1970-11-30" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "1970-12-01" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "1970-12-02" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "1970-12-03" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap index 14d82b725..2239623ac 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1973____1973_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "1973-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "1973-01-14" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "1973-01-15" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "1973-01-16" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "1973-01-17" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "1973-01-18" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "1973-04-23" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" - }, - { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" - }, - { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "1973-05-19" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Zafer Bayram\u0131", + "date": "1973-08-30" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "1973-10-27" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "1973-10-28" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "1973-10-28" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Cumhuriyet Bayram\u0131", + "date": "1973-10-29" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "1973-10-29" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "1973-10-30" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap index 14d82b725..1e862b48d 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1974____1974_.snap @@ -1,70 +1,82 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "1974-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "1974-01-03" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "1974-01-04" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "1974-01-05" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "1974-01-06" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "1974-01-07" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "1974-04-23" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "1974-05-19" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "name": "Zafer Bayram\u0131", + "date": "1974-08-30" }, { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "1974-10-16" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "1974-10-17" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "1974-10-18" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "1974-10-19" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "1974-10-28" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Cumhuriyet Bayram\u0131", + "date": "1974-10-29" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "2. Kurban Bayram\u0131 Arifesi", + "date": "1974-12-23" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "2. Kurban Bayram\u0131 1. G\u00fcn", + "date": "1974-12-24" + }, + { + "name": "2. Kurban Bayram\u0131 2. G\u00fcn", + "date": "1974-12-25" + }, + { + "name": "2. Kurban Bayram\u0131 3. G\u00fcn", + "date": "1974-12-26" + }, + { + "name": "2. Kurban Bayram\u0131 4. G\u00fcn", + "date": "1974-12-27" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap index 14d82b725..f7e4e6303 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1975____1975_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "1975-01-01" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "1975-04-23" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "1975-05-19" + }, + { + "name": "Zafer Bayram\u0131", + "date": "1975-08-30" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "1975-10-05" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "1975-10-06" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "1975-10-07" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "1975-10-08" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "1975-10-28" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "1975-10-29" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "1975-12-12" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "1975-12-13" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "1975-12-14" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "1975-12-15" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" - }, - { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" - }, - { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" - }, - { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "1975-12-16" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap index 14d82b725..d97fb437a 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___1999____1999_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "1999-01-01" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "1999-01-18" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "1999-01-19" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "1999-01-20" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" - }, - { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" - }, - { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "1999-01-21" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "1999-03-27" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "1999-03-28" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "1999-03-29" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "1999-03-30" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "date": "1999-03-31" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "1999-04-23" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "1999-05-19" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "1999-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "1999-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "1999-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap index 14d82b725..81ec80025 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2000____2000_.snap @@ -1,70 +1,78 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2000-01-01" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2000-01-07" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2000-01-08" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2000-01-09" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" - }, - { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" - }, - { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2000-01-10" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2000-03-15" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2000-03-16" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2000-03-17" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2000-03-18" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "date": "2000-03-19" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2000-04-23" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2000-05-19" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2000-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2000-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2000-10-29" + }, + { + "name": "2. Ramazan Bayram\u0131 Arifesi", + "date": "2000-12-26" + }, + { + "name": "2. Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2000-12-27" + }, + { + "name": "2. Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2000-12-28" + }, + { + "name": "2. Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2000-12-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap index 14d82b725..85bacf318 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2001____2001_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2001-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2001-03-04" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2001-03-05" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2001-03-06" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2001-03-07" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2001-03-08" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2001-04-23" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" - }, - { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" - }, - { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2001-05-19" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Zafer Bayram\u0131", + "date": "2001-08-30" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2001-10-28" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2001-10-29" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2001-12-15" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2001-12-16" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2001-12-17" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2001-12-18" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap index 14d82b725..7de07e71a 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2005____2005_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2005-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2005-01-19" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2005-01-20" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2005-01-21" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2005-01-22" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2005-01-23" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2005-04-23" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" - }, - { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" - }, - { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2005-05-19" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Zafer Bayram\u0131", + "date": "2005-08-30" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2005-10-28" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2005-10-29" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2005-11-02" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2005-11-03" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2005-11-04" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2005-11-05" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap index 14d82b725..4f181ced9 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2006____2006_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2006-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2006-01-09" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2006-01-10" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2006-01-11" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2006-01-12" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2006-01-13" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2006-04-23" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2006-05-19" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "name": "Zafer Bayram\u0131", + "date": "2006-08-30" }, { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2006-10-22" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2006-10-23" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2006-10-24" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2006-10-25" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2006-10-28" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Cumhuriyet Bayram\u0131", + "date": "2006-10-29" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "2. Kurban Bayram\u0131 Arifesi", + "date": "2006-12-30" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "2. Kurban Bayram\u0131 1. G\u00fcn", + "date": "2006-12-31" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap index 14d82b725..7ec5ca96f 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2007____2007_.snap @@ -1,70 +1,74 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2007-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2007-01-01" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2007-01-02" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2007-01-03" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2007-04-23" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2007-05-19" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Zafer Bayram\u0131", + "date": "2007-08-30" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2007-10-11" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2007-10-12" }, { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2007-10-13" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2007-10-14" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2007-10-28" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2007-10-29" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "2. Kurban Bayram\u0131 Arifesi", + "date": "2007-12-19" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "2. Kurban Bayram\u0131 1. G\u00fcn", + "date": "2007-12-20" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "2. Kurban Bayram\u0131 2. G\u00fcn", + "date": "2007-12-21" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "2. Kurban Bayram\u0131 3. G\u00fcn", + "date": "2007-12-22" + }, + { + "name": "2. Kurban Bayram\u0131 4. G\u00fcn", + "date": "2007-12-23" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap index 14d82b725..4735e391c 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2008____2008_.snap @@ -1,70 +1,62 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2008-01-01" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2008-04-23" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2008-05-19" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2008-08-30" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2008-09-29" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2008-09-30" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2008-10-01" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "2008-10-02" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2008-10-28" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2008-10-29" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2008-12-07" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2008-12-08" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2008-12-09" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2008-12-10" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" - }, - { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" - }, - { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" - }, - { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2008-12-11" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap index 14d82b725..3ac0bfbf8 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2009____2009_.snap @@ -1,70 +1,66 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2009-01-01" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2009-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2009-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2009-05-19" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2009-08-30" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2009-09-19" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2009-09-20" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2009-09-21" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "2009-09-22" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2009-10-28" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2009-10-29" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2009-11-26" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2009-11-27" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2009-11-28" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2009-11-29" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" - }, - { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" - }, - { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" - }, - { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2009-11-30" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap index 14d82b725..b94e88d0d 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2016____2016_.snap @@ -1,70 +1,66 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2016-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2016-04-23" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2016-05-01" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2016-05-19" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2016-07-04" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2016-07-05" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2016-07-06" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2016-07-07" + }, + { + "name": "Zafer Bayram\u0131", + "date": "2016-08-30" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2016-09-11" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2016-09-12" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2016-09-13" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2016-09-14" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" - }, - { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2016-09-15" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2016-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2016-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap index 14d82b725..054f2126f 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2017____2017_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2017-01-01" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2017-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2017-05-01" + }, + { + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2017-05-19" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2017-06-24" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2017-06-25" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2017-06-26" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "2017-06-27" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2017-07-15" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Zafer Bayram\u0131", + "date": "2017-08-30" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2017-08-31" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2017-09-01" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2017-09-02" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2017-09-03" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" - }, - { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2017-09-04" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2017-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2017-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap index 14d82b725..97508a514 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2021____2021_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2021-01-01" + }, + { + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2021-04-23" + }, + { + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2021-05-01" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2021-05-12" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2021-05-13" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2021-05-14" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" - }, - { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "2021-05-15" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2021-05-19" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2021-07-15" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2021-07-19" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2021-07-20" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2021-07-21" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2021-07-22" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" - }, - { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "date": "2021-07-23" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2021-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2021-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2021-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap index 14d82b725..7da33ee19 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2022____2022_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2022-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2022-04-23" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2022-05-01" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2022-05-01" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2022-05-02" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2022-05-03" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2022-05-04" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2022-05-19" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2022-07-08" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2022-07-09" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2022-07-10" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2022-07-11" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "date": "2022-07-12" }, { "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "date": "2022-07-15" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2022-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2022-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2022-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap index 14d82b725..5e90c2c56 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2023____2023_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2023-01-01" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2023-04-20" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2023-04-21" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2023-04-22" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2023-04-23" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2023-04-23" }, { "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "date": "2023-05-01" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2023-05-19" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2023-06-27" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2023-06-28" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2023-06-29" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2023-06-30" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "date": "2023-07-01" }, { "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "date": "2023-07-15" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2023-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2023-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2023-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap index 14d82b725..d4719a797 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2025____2025_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2025-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2025-04-23" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2025-04-29" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2025-04-30" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2025-05-01" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2025-05-01" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2025-05-02" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2025-05-19" }, { "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "date": "2025-06-05" }, { "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "date": "2025-06-06" }, { "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "date": "2025-06-07" }, { "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "date": "2025-06-08" }, { "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "date": "2025-06-09" }, { "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "date": "2025-07-15" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2025-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2025-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2025-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap index 14d82b725..b20e60485 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2032____2032_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2032-01-01" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2032-01-13" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2032-01-14" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2032-01-15" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "date": "2032-01-16" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2032-03-20" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2032-03-21" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2032-03-22" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2032-03-23" }, { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2032-03-24" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2032-04-23" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2032-05-01" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2032-05-19" }, { "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "date": "2032-07-15" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2032-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2032-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2032-10-29" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap index 14d82b725..bf66f3b38 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2033____2033_.snap @@ -1,70 +1,86 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2033-01-01" }, { "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "date": "2033-01-01" }, { "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "date": "2033-01-02" }, { "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "date": "2033-01-03" }, { "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "date": "2033-01-04" }, { - "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2033-03-10" }, { - "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2033-03-11" }, { - "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2033-03-12" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2033-03-13" }, { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2033-03-14" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", + "date": "2033-04-23" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", + "date": "2033-05-01" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", + "date": "2033-05-19" }, { "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "date": "2033-07-15" }, { "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "date": "2033-08-30" }, { "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "date": "2033-10-28" }, { "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "date": "2033-10-29" + }, + { + "name": "2. Ramazan Bayram\u0131 Arifesi", + "date": "2033-12-22" + }, + { + "name": "2. Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2033-12-23" + }, + { + "name": "2. Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2033-12-24" + }, + { + "name": "2. Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2033-12-25" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap index 14d82b725..d0df47b75 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2034____2034_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2034-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2034-02-27" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2034-02-28" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2034-03-01" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2034-03-02" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2034-03-03" }, { "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "2034-04-23" }, { "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "date": "2034-05-01" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2034-05-19" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" - }, - { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2034-07-15" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Zafer Bayram\u0131", + "date": "2034-08-30" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2034-10-28" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2034-10-29" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2034-12-10" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2034-12-11" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2034-12-12" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2034-12-13" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap index 14d82b725..a8fc796eb 100644 --- a/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap +++ b/tests/.pest/snapshots/Countries/TurkeyTest/it_can_calculate_turkey_holidays_with_data_set___2037____2037_.snap @@ -1,70 +1,70 @@ [ { "name": "Y\u0131lba\u015f\u0131", - "date": "2024-01-01" + "date": "2037-01-01" }, { - "name": "Ramazan Bayram\u0131 Arifesi", - "date": "2024-04-09" + "name": "Kurban Bayram\u0131 Arifesi", + "date": "2037-01-25" }, { - "name": "Ramazan Bayram\u0131 1. G\u00fcn", - "date": "2024-04-10" + "name": "Kurban Bayram\u0131 1. G\u00fcn", + "date": "2037-01-26" }, { - "name": "Ramazan Bayram\u0131 2. G\u00fcn", - "date": "2024-04-11" + "name": "Kurban Bayram\u0131 2. G\u00fcn", + "date": "2037-01-27" }, { - "name": "Ramazan Bayram\u0131 3. G\u00fcn", - "date": "2024-04-12" + "name": "Kurban Bayram\u0131 3. G\u00fcn", + "date": "2037-01-28" + }, + { + "name": "Kurban Bayram\u0131 4. G\u00fcn", + "date": "2037-01-29" }, { "name": "Ulusal Egemenlik ve \u00c7ocuk Bayram\u0131", - "date": "2024-04-23" + "date": "2037-04-23" }, { "name": "Emek ve Dayan\u0131\u015fma G\u00fcn\u00fc", - "date": "2024-05-01" + "date": "2037-05-01" }, { "name": "Atat\u00fcrk'\u00fc Anma, Gen\u00e7lik ve Spor Bayram\u0131", - "date": "2024-05-19" + "date": "2037-05-19" }, { - "name": "Kurban Bayram\u0131 Arifesi", - "date": "2024-06-15" - }, - { - "name": "Kurban Bayram\u0131 1. G\u00fcn", - "date": "2024-06-16" + "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", + "date": "2037-07-15" }, { - "name": "Kurban Bayram\u0131 2. G\u00fcn", - "date": "2024-06-17" + "name": "Zafer Bayram\u0131", + "date": "2037-08-30" }, { - "name": "Kurban Bayram\u0131 3. G\u00fcn", - "date": "2024-06-18" + "name": "Cumhuriyet Bayram\u0131 Arifesi", + "date": "2037-10-28" }, { - "name": "Kurban Bayram\u0131 4. G\u00fcn", - "date": "2024-06-19" + "name": "Cumhuriyet Bayram\u0131", + "date": "2037-10-29" }, { - "name": "Demokrasi ve Mill\u00ee Birlik G\u00fcn\u00fc", - "date": "2024-07-15" + "name": "Ramazan Bayram\u0131 Arifesi", + "date": "2037-11-08" }, { - "name": "Zafer Bayram\u0131", - "date": "2024-08-30" + "name": "Ramazan Bayram\u0131 1. G\u00fcn", + "date": "2037-11-09" }, { - "name": "Cumhuriyet Bayram\u0131 Arifesi", - "date": "2024-10-28" + "name": "Ramazan Bayram\u0131 2. G\u00fcn", + "date": "2037-11-10" }, { - "name": "Cumhuriyet Bayram\u0131", - "date": "2024-10-29" + "name": "Ramazan Bayram\u0131 3. G\u00fcn", + "date": "2037-11-11" } ] \ No newline at end of file diff --git a/tests/Countries/TurkeyTest.php b/tests/Countries/TurkeyTest.php index 7579c764e..4deb524c9 100644 --- a/tests/Countries/TurkeyTest.php +++ b/tests/Countries/TurkeyTest.php @@ -5,8 +5,8 @@ use Carbon\CarbonImmutable; use Spatie\Holidays\Holidays; -it('can calculate turkey holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); +it('can calculate turkey holidays', function ($year) { + CarbonImmutable::setTestNowAndTimezone($year.'-01-01'); $holidays = Holidays::for(country: 'tr')->get(); From 7bc859dcf5554ad6774690878ed1311b37d72666 Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sat, 20 Jan 2024 20:54:09 +0300 Subject: [PATCH 029/127] Added pint packages --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 91002ed8c..9f8a2f7fb 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "ext-calendar": "*" }, "require-dev": { + "laravel/pint": "^1.0", "laravel/prompts": "^0.1.15", "pestphp/pest": "^2.31", "phpstan/phpstan": "^1.10.56", @@ -46,7 +47,7 @@ "baseline": "vendor/bin/phpstan analyse --generate-baseline", "test": "vendor/bin/pest", "test-coverage": "vendor/bin/pest --coverage", - "format": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes" + "format": "vendor/bin/pint" }, "config": { "sort-packages": true, From 962b4f3e1e8aeeaa6c6a58c7db5fb8bf3b6a28bd Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sat, 20 Jan 2024 21:26:10 +0300 Subject: [PATCH 030/127] Fixed PHPStan --- src/Countries/Turkey.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index 698b78532..e6ca1be49 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -3,6 +3,7 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; +use Exception; class Turkey extends Country { @@ -230,7 +231,8 @@ protected function getIslamicHolidays( if ($year != 1970) { $previousHoliday = is_array($holidays[$year - 1]) ? $holidays[$year - 1][1] : $holidays[$year - 1]; - $previousHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year - 1).'-'.$previousHoliday); + $previousHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year - 1).'-'.$previousHoliday) + ?: throw new Exception('Date could not be created.'); if ($previousHoliday->addDays($day - 1)->year == $year) { $islamicHolidays = $this->prepareHolidays( @@ -246,7 +248,8 @@ protected function getIslamicHolidays( $currentYearHolidays = is_array($holidays[$year]) ? $holidays[$year] : [$holidays[$year]]; foreach ($currentYearHolidays as $currentYearHoliday) { - $currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$currentYearHoliday}"); + $currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$currentYearHoliday}") + ?: throw new Exception('Date could not be created.'); $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( holiday: $currentYearHoliday, @@ -261,7 +264,8 @@ protected function getIslamicHolidays( if ($year != 2037) { $nextHoliday = is_array($holidays[$year + 1]) ? $holidays[$year + 1][1] : $holidays[$year + 1]; - $nextHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year + 1).'-'.$nextHoliday); + $nextHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year + 1).'-'.$nextHoliday) + ?: throw new Exception('Date could not be created.'); if ($nextHoliday->addDays(-1)->year == $year) { $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( From 038db024da2850e4c770996d754190f6758afc38 Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sat, 20 Jan 2024 21:28:02 +0300 Subject: [PATCH 031/127] Fixed PHPStan --- src/Countries/Turkey.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index e6ca1be49..356ccfd05 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -3,7 +3,7 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; -use Exception; +use RuntimeException; class Turkey extends Country { @@ -232,7 +232,7 @@ protected function getIslamicHolidays( $previousHoliday = is_array($holidays[$year - 1]) ? $holidays[$year - 1][1] : $holidays[$year - 1]; $previousHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year - 1).'-'.$previousHoliday) - ?: throw new Exception('Date could not be created.'); + ?: throw new RuntimeException('Date could not be created.'); if ($previousHoliday->addDays($day - 1)->year == $year) { $islamicHolidays = $this->prepareHolidays( @@ -249,7 +249,7 @@ protected function getIslamicHolidays( foreach ($currentYearHolidays as $currentYearHoliday) { $currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$currentYearHoliday}") - ?: throw new Exception('Date could not be created.'); + ?: throw new RuntimeException('Date could not be created.'); $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( holiday: $currentYearHoliday, @@ -265,7 +265,7 @@ protected function getIslamicHolidays( $nextHoliday = is_array($holidays[$year + 1]) ? $holidays[$year + 1][1] : $holidays[$year + 1]; $nextHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year + 1).'-'.$nextHoliday) - ?: throw new Exception('Date could not be created.'); + ?: throw new RuntimeException('Date could not be created.'); if ($nextHoliday->addDays(-1)->year == $year) { $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( From 15dc453ac33830e958f4870381e71ca2b8a4dd49 Mon Sep 17 00:00:00 2001 From: Avdyl Krasniqi Date: Sat, 20 Jan 2024 21:01:22 +0100 Subject: [PATCH 032/127] Republic of Kosovo Holidays, Todo: implement islamic holidays --- src/Countries/Kosovo.php | 42 +++++++++++++++++++ .../it_can_calculate_kosovo_holidays.snap | 38 +++++++++++++++++ tests/Countries/KosovoTest.php | 18 ++++++++ 3 files changed, 98 insertions(+) create mode 100644 src/Countries/Kosovo.php create mode 100644 tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap create mode 100644 tests/Countries/KosovoTest.php diff --git a/src/Countries/Kosovo.php b/src/Countries/Kosovo.php new file mode 100644 index 000000000..e108da154 --- /dev/null +++ b/src/Countries/Kosovo.php @@ -0,0 +1,42 @@ + '01-01', + 'Krishtlindjet ortodokse' => '01-06', + 'Dita Ndërkombëtare e Punës' => '05-01', + 'Dita e Evropës' => '05-09', + 'Krishtlindjet Katolike' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $holidays = []; + + $holidays['Pashkët Katolike'] = $this->easter($year); + $holidays['Pashkët Ortodokse'] = $this->orthodoxEaster($year); + + if($year >= 2008) { + $holidays['Dita e Pavarësisë së Republikës së Kosovës'] = '02-17'; + $holidays['Dita e Kushtetutës së Republikës së Kosovës'] = '04-09'; + } + + // TODO: Implement islamic holidays + + return $holidays; + } +} diff --git a/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap b/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap new file mode 100644 index 000000000..9115c976f --- /dev/null +++ b/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap @@ -0,0 +1,38 @@ +[ + { + "name": "Viti i Ri", + "date": "2024-01-01" + }, + { + "name": "Krishtlindjet ortodokse", + "date": "2024-01-06" + }, + { + "name": "Dita e Pavar\u00ebsis\u00eb s\u00eb Republik\u00ebs s\u00eb Kosov\u00ebs", + "date": "2024-02-17" + }, + { + "name": "Pashk\u00ebt Katolike", + "date": "2024-03-31" + }, + { + "name": "Dita e Kushtetut\u00ebs s\u00eb Republik\u00ebs s\u00eb Kosov\u00ebs", + "date": "2024-04-09" + }, + { + "name": "Dita Nd\u00ebrkomb\u00ebtare e Pun\u00ebs", + "date": "2024-05-01" + }, + { + "name": "Pashk\u00ebt Ortodokse", + "date": "2024-05-05" + }, + { + "name": "Dita e Evrop\u00ebs", + "date": "2024-05-09" + }, + { + "name": "Krishtlindjet Katolike", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/KosovoTest.php b/tests/Countries/KosovoTest.php new file mode 100644 index 000000000..2621722ff --- /dev/null +++ b/tests/Countries/KosovoTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 55ec02624b36b2778ef44c917fc2c217d6b02613 Mon Sep 17 00:00:00 2001 From: Avdyl Krasniqi Date: Sat, 20 Jan 2024 21:03:22 +0100 Subject: [PATCH 033/127] fix wrong date --- src/Countries/Kosovo.php | 2 +- .../Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Countries/Kosovo.php b/src/Countries/Kosovo.php index e108da154..4d395117d 100644 --- a/src/Countries/Kosovo.php +++ b/src/Countries/Kosovo.php @@ -15,7 +15,7 @@ protected function allHolidays(int $year): array { return array_merge([ 'Viti i Ri' => '01-01', - 'Krishtlindjet ortodokse' => '01-06', + 'Krishtlindjet ortodokse' => '01-07', 'Dita Ndërkombëtare e Punës' => '05-01', 'Dita e Evropës' => '05-09', 'Krishtlindjet Katolike' => '12-25', diff --git a/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap b/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap index 9115c976f..895be7bc9 100644 --- a/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap +++ b/tests/.pest/snapshots/Countries/KosovoTest/it_can_calculate_kosovo_holidays.snap @@ -5,7 +5,7 @@ }, { "name": "Krishtlindjet ortodokse", - "date": "2024-01-06" + "date": "2024-01-07" }, { "name": "Dita e Pavar\u00ebsis\u00eb s\u00eb Republik\u00ebs s\u00eb Kosov\u00ebs", From 89c20d04ba78f0f9f5f81b43177b2d21b030828e Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sun, 21 Jan 2024 00:25:31 +0300 Subject: [PATCH 034/127] Fixed year --- src/Countries/Turkey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index 356ccfd05..f6bf6e7b9 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -9,7 +9,7 @@ class Turkey extends Country { /** * No library or built-in php intl functions convert dates properly for all years or all country including - * “geniusts/hijri-dates”. It is most logical to prepare the dates between 1970 and 1938 as a constant property + * “geniusts/hijri-dates”. It is most logical to prepare the dates between 1970 and 2037 as a constant property * for Islamic holidays. Because Islamic holidays predicted and actual dates may change until the last moment. * Since the information on wikipedia is incorrect, it was obtained by searching the old calendar * on Google Images for each year. The accuracy of the information has been double checked. From 82c27a9d32fc03f5162c0010ff7a5d3a0ac9b1ad Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Sun, 21 Jan 2024 00:26:55 +0300 Subject: [PATCH 035/127] fixed syntax --- src/Countries/Turkey.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Countries/Turkey.php b/src/Countries/Turkey.php index f6bf6e7b9..5957d6fd3 100644 --- a/src/Countries/Turkey.php +++ b/src/Countries/Turkey.php @@ -12,8 +12,8 @@ class Turkey extends Country * “geniusts/hijri-dates”. It is most logical to prepare the dates between 1970 and 2037 as a constant property * for Islamic holidays. Because Islamic holidays predicted and actual dates may change until the last moment. * Since the information on wikipedia is incorrect, it was obtained by searching the old calendar - * on Google Images for each year. The accuracy of the information has been double checked. - * Ramadan and Eid al-Adha vary for Turkey and other countries. + * on Google Images for each year. The accuracy of the information has been double-checked. + * Ramadan and Sacrifice holidays vary for Turkey and other countries. * A converter algorithm that will cover all years does not seem possible. */ public const ramadanHolidays = [ From 948d35289006acede732fa58768691b00b22a5aa Mon Sep 17 00:00:00 2001 From: Avdyl Krasniqi Date: Sat, 20 Jan 2024 23:32:14 +0100 Subject: [PATCH 036/127] fix typo --- src/Countries/Kosovo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Kosovo.php b/src/Countries/Kosovo.php index 4d395117d..87dfcc2f7 100644 --- a/src/Countries/Kosovo.php +++ b/src/Countries/Kosovo.php @@ -22,7 +22,7 @@ protected function allHolidays(int $year): array ], $this->variableHolidays($year)); } - /** @return array */ + /** @return array */ protected function variableHolidays(int $year): array { $holidays = []; From f25e12761733a2c5448239a355cfae6a990362e4 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Sun, 21 Jan 2024 21:19:27 +0100 Subject: [PATCH 037/127] add notes on Sri Lanka --- src/Countries/SriLanka.php | 21 +++++++++++++++++++++ tests/Countries/SriLankaTest.php | 10 ++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/Countries/SriLanka.php create mode 100644 tests/Countries/SriLankaTest.php diff --git a/src/Countries/SriLanka.php b/src/Countries/SriLanka.php new file mode 100644 index 000000000..a94f46cdf --- /dev/null +++ b/src/Countries/SriLanka.php @@ -0,0 +1,21 @@ +countryCode()); + } +} diff --git a/tests/Countries/SriLankaTest.php b/tests/Countries/SriLankaTest.php new file mode 100644 index 000000000..ab8eefe4a --- /dev/null +++ b/tests/Countries/SriLankaTest.php @@ -0,0 +1,10 @@ +get(); +})->throws(UnsupportedCountry::class); From 84511677c2ab3ecbaebc7ee46f02d3393d0700ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kowalewski?= Date: Mon, 22 Jan 2024 09:38:13 +0100 Subject: [PATCH 038/127] Polish holidays (#154) * poland * Fix polish holidays --------- Co-authored-by: fizgiel --- src/Countries/Poland.php | 42 +++++++++++++++ .../it_can_calculate_polish_holidays.snap | 54 +++++++++++++++++++ tests/Countries/PolandTest.php | 18 +++++++ 3 files changed, 114 insertions(+) create mode 100644 src/Countries/Poland.php create mode 100644 tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap create mode 100644 tests/Countries/PolandTest.php diff --git a/src/Countries/Poland.php b/src/Countries/Poland.php new file mode 100644 index 000000000..b6e111ebe --- /dev/null +++ b/src/Countries/Poland.php @@ -0,0 +1,42 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Nowy Rok' => '01-01', + 'Święto Trzech Króli' => '01-06', + 'Święto Pracy' => '05-01', + 'Święto Konstytucji 3 Maja' => '05-03', + 'Święto Wojska Polskiego, Wniebowzięcie Najświętszej Maryi Panny' => '08-15', + 'Wszystkich Świętych' => '11-01', + 'Święto Niepodległości' => '11-11', + 'Boże Narodzenie' => '12-25', + 'Drugi Dzień Bożego Narodzenia' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Europe/Warsaw'); + + return [ + 'Wielkanoc' => $easter, + 'Poniedziałek Wielkanocny' => $easter->addDay(), + 'Zielone Świątki' => $easter->addWeeks(7), + 'Boże Ciało' => $easter->addDays(60), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap b/tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap new file mode 100644 index 000000000..a14c2115a --- /dev/null +++ b/tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Nowy Rok", + "date": "2024-01-01" + }, + { + "name": "\u015awi\u0119to Trzech Kr\u00f3li", + "date": "2024-01-06" + }, + { + "name": "Wielkanoc", + "date": "2024-03-31" + }, + { + "name": "Poniedzia\u0142ek Wielkanocny", + "date": "2024-04-01" + }, + { + "name": "\u015awi\u0119to Pracy", + "date": "2024-05-01" + }, + { + "name": "\u015awi\u0119to Konstytucji 3 Maja", + "date": "2024-05-03" + }, + { + "name": "Zielone \u015awi\u0105tki", + "date": "2024-05-19" + }, + { + "name": "Bo\u017ce Cia\u0142o", + "date": "2024-05-30" + }, + { + "name": "\u015awi\u0119to Wojska Polskiego, Wniebowzi\u0119cie Naj\u015bwi\u0119tszej Maryi Panny", + "date": "2024-08-15" + }, + { + "name": "Wszystkich \u015awi\u0119tych", + "date": "2024-11-01" + }, + { + "name": "\u015awi\u0119to Niepodleg\u0142o\u015bci", + "date": "2024-11-11" + }, + { + "name": "Bo\u017ce Narodzenie", + "date": "2024-12-25" + }, + { + "name": "Drugi Dzie\u0144 Bo\u017cego Narodzenia", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/PolandTest.php b/tests/Countries/PolandTest.php new file mode 100644 index 000000000..25a75ebc7 --- /dev/null +++ b/tests/Countries/PolandTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From ac17b38fae55c04687aa04cd129742c6985becd3 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:39:09 +0100 Subject: [PATCH 039/127] cleanup Poland --- src/Countries/Poland.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Countries/Poland.php b/src/Countries/Poland.php index b6e111ebe..86dcf3697 100644 --- a/src/Countries/Poland.php +++ b/src/Countries/Poland.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'pl'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -30,7 +29,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Europe/Warsaw'); + $easter = $this->easter($year); return [ 'Wielkanoc' => $easter, From 49e0daab56a7b781566cbf4d82097250b69c624f Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 12:36:37 +0200 Subject: [PATCH 040/127] fix conflict phpstan-beseline --- phpstan-baseline.neon | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0f6d531fd..51b9330fc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20,21 +20,6 @@ parameters: count: 1 path: src/Countries/Country.php - - - message: "#^Cannot call method addDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Greece.php - - - - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Greece.php - - - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:variableHolidays\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: src/Countries/Greece.php - - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" count: 1 From 2cd3fbf722db4121be9c0d45c76414b356683fa0 Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 12:41:28 +0200 Subject: [PATCH 041/127] fix conflict phpstan-beseline generate again --- phpstan-baseline.neon | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 51b9330fc..0f6d531fd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20,6 +20,21 @@ parameters: count: 1 path: src/Countries/Country.php + - + message: "#^Cannot call method addDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" + count: 1 + path: src/Countries/Greece.php + + - + message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" + count: 1 + path: src/Countries/Greece.php + + - + message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:variableHolidays\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/Countries/Greece.php + - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" count: 1 From a7f766e4fd648304a1ae425fc28bab1a5ebbed56 Mon Sep 17 00:00:00 2001 From: Martin Welte Date: Mon, 22 Jan 2024 12:17:11 +0100 Subject: [PATCH 042/127] Add Support for Liechtenstein (#33) * feat: add liechtenstein * test: add test for liechtenstein --- src/Countries/Liechtenstein.php | 43 +++++++++++++++ ..._can_calculate_liechtenstein_holidays.snap | 54 +++++++++++++++++++ tests/Countries/LiechtensteinTest.php | 18 +++++++ 3 files changed, 115 insertions(+) create mode 100644 src/Countries/Liechtenstein.php create mode 100644 tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap create mode 100644 tests/Countries/LiechtensteinTest.php diff --git a/src/Countries/Liechtenstein.php b/src/Countries/Liechtenstein.php new file mode 100644 index 000000000..dea95a0c2 --- /dev/null +++ b/src/Countries/Liechtenstein.php @@ -0,0 +1,43 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Neujahr' => '01-01', + 'Heilige Drei Könige' => '01-06', + 'Tag der Arbeit' => '05-01', + 'Staatsfeiertag / Mariä Himmelfahrt' => '08-15', + 'Mariä Geburt' => '09-08', + 'Allerheiligen' => '11-01', + 'Mariä Empfängnis' => '12-08', + 'Weihnachten' => '12-25', + 'Stephanstag' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp($this->easter($year)) + ->setTimezone('Europe/Vaduz'); + + return [ + 'Ostermontag' => $easter->addDay(), + 'Auffahrt' => $easter->addDays(39), + 'Pfingstmontag' => $easter->addDays(50), + 'Fronleichnam' => $easter->addDays(60), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap b/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap new file mode 100644 index 000000000..7c23985e1 --- /dev/null +++ b/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Ostermontag", + "date": "1970-01-02" + }, + { + "name": "Auffahrt", + "date": "1970-02-09" + }, + { + "name": "Pfingstmontag", + "date": "1970-02-20" + }, + { + "name": "Fronleichnam", + "date": "1970-03-02" + }, + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Heilige Drei K\u00f6nige", + "date": "2024-01-06" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Staatsfeiertag \/ Mari\u00e4 Himmelfahrt", + "date": "2024-08-15" + }, + { + "name": "Mari\u00e4 Geburt", + "date": "2024-09-08" + }, + { + "name": "Allerheiligen", + "date": "2024-11-01" + }, + { + "name": "Mari\u00e4 Empf\u00e4ngnis", + "date": "2024-12-08" + }, + { + "name": "Weihnachten", + "date": "2024-12-25" + }, + { + "name": "Stephanstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/LiechtensteinTest.php b/tests/Countries/LiechtensteinTest.php new file mode 100644 index 000000000..00b62a5c6 --- /dev/null +++ b/tests/Countries/LiechtensteinTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From e5d1f98257c94863857814254690051cb05e229d Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:17:47 +0100 Subject: [PATCH 043/127] cleanup Liechtenstein --- src/Countries/Liechtenstein.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Countries/Liechtenstein.php b/src/Countries/Liechtenstein.php index dea95a0c2..372e59746 100644 --- a/src/Countries/Liechtenstein.php +++ b/src/Countries/Liechtenstein.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'li'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -30,8 +29,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp($this->easter($year)) - ->setTimezone('Europe/Vaduz'); + $easter = $this->easter($year); return [ 'Ostermontag' => $easter->addDay(), From b45dd8e88bc9ea2b80d3b99830093809d42ebe89 Mon Sep 17 00:00:00 2001 From: Eimantas Likas Date: Mon, 22 Jan 2024 13:30:34 +0200 Subject: [PATCH 044/127] Add Lithuanian holidays --- src/Countries/Lithuania.php | 42 ++++++++++++++ .../it_can_calculate_lithuanian_holidays.snap | 58 +++++++++++++++++++ tests/Countries/LithuaniaTest.php | 18 ++++++ 3 files changed, 118 insertions(+) create mode 100644 src/Countries/Lithuania.php create mode 100644 tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap create mode 100644 tests/Countries/LithuaniaTest.php diff --git a/src/Countries/Lithuania.php b/src/Countries/Lithuania.php new file mode 100644 index 000000000..3b78d60cb --- /dev/null +++ b/src/Countries/Lithuania.php @@ -0,0 +1,42 @@ + '01-01', + 'Lietuvos valstybės atkūrimo diena' => '02-16', + 'Nepriklausomybės atkūrimo diena' => '03-11', + 'Tarptautinė darbo diena' => '05-01', + 'Joninės' => '06-24', + 'Karaliaus Mindaugo karūnavimo diena' => '07-06', + 'Žolinė' => '08-15', + 'Visų šventųjų diena' => '11-01', + 'Vėlinės' => '11-02', + 'Šv. Kūčios' => '12-24', + 'Šv. Kalėdos' => '12-25', + 'Šv. Kalėdų antroji diena' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Velykos' => $easter, + 'Velykų antroji diena' => $easter->addDay(), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap b/tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap new file mode 100644 index 000000000..40fe82dfa --- /dev/null +++ b/tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "Naujieji metai", + "date": "2024-01-01" + }, + { + "name": "Lietuvos valstyb\u0117s atk\u016brimo diena", + "date": "2024-02-16" + }, + { + "name": "Nepriklausomyb\u0117s atk\u016brimo diena", + "date": "2024-03-11" + }, + { + "name": "Velykos", + "date": "2024-03-31" + }, + { + "name": "Velyk\u0173 antroji diena", + "date": "2024-04-01" + }, + { + "name": "Tarptautin\u0117 darbo diena", + "date": "2024-05-01" + }, + { + "name": "Jonin\u0117s", + "date": "2024-06-24" + }, + { + "name": "Karaliaus Mindaugo kar\u016bnavimo diena", + "date": "2024-07-06" + }, + { + "name": "\u017dolin\u0117", + "date": "2024-08-15" + }, + { + "name": "Vis\u0173 \u0161vent\u0173j\u0173 diena", + "date": "2024-11-01" + }, + { + "name": "V\u0117lin\u0117s", + "date": "2024-11-02" + }, + { + "name": "\u0160v. K\u016b\u010dios", + "date": "2024-12-24" + }, + { + "name": "\u0160v. Kal\u0117dos", + "date": "2024-12-25" + }, + { + "name": "\u0160v. Kal\u0117d\u0173 antroji diena", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/LithuaniaTest.php b/tests/Countries/LithuaniaTest.php new file mode 100644 index 000000000..310f58f5b --- /dev/null +++ b/tests/Countries/LithuaniaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From b2034ac7aa4be905a65bc7e791817bfd5396fda3 Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 14:14:21 +0200 Subject: [PATCH 045/127] update country orthodoxeaster --- src/Countries/Country.php | 17 +++++++++++++++-- src/Countries/Greece.php | 25 +------------------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 3a09768db..85ba9b45a 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -50,10 +50,23 @@ protected function easter(int $year): CarbonImmutable protected function orthodoxEaster(int $year): CarbonImmutable { - $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); + $a = $year % 4; + $b = $year % 7; + $c = $year % 19; + $d = (19 * $c + 15) % 30; + $e = (2 * $a + 4 * $b - $d + 34) % 7; + $month = (int) (($d + $e + 114) / 31); + $day = (($d + $e + 114) % 31) + 1; + // julian to gregorian + $jtg = (int) ($year / 100) - (int) ($year / 400) - 2; + + $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); + + /*$timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; - return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); + return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp));*/ + return CarbonImmutable::createFromTimestamp($easterDate); } public static function find(string $countryCode): ?Country diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index d05f4f75c..87b63f9e9 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -30,11 +30,7 @@ protected function allHolidays(int $year): array protected function variableHolidays(int $year): array { - $orthodox_easter = CarbonImmutable::createFromTimestamp( - $this->calculateOrthodoxEaster($year) - )->setTimezone("Europe/Athens"); - //$orthodox_easter = $this->orthodoxEaster($year); - + $orthodox_easter = $this->orthodoxEaster($year); $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); if ( @@ -58,23 +54,4 @@ protected function variableHolidays(int $year): array 'Αγίου Πνεύματος' => $orthodox_easter->addDays(50), //always Monday ]; } - - /** @return integer */ - protected function calculateOrthodoxEaster(int $year): int - { - $a = $year % 4; - $b = $year % 7; - $c = $year % 19; - $d = (19 * $c + 15) % 30; - $e = (2 * $a + 4 * $b - $d + 34) % 7; - $month = (int) (($d + $e + 114) / 31); - $day = (($d + $e + 114) % 31) + 1; - // julian to gregorian - $jtg = (int) ($year / 100) - (int) ($year / 400) - 2; - - $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); - - return (int) $easterDate; - - } } \ No newline at end of file From 4b398f1fc3d26b92b4129b1e7e8783bbce6c4ba0 Mon Sep 17 00:00:00 2001 From: Martin Welte Date: Mon, 22 Jan 2024 13:41:50 +0100 Subject: [PATCH 046/127] test: update liechtenstein snapshot (#164) --- ..._can_calculate_liechtenstein_holidays.snap | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap b/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap index 7c23985e1..15498d19a 100644 --- a/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap +++ b/tests/.pest/snapshots/Countries/LiechtensteinTest/it_can_calculate_liechtenstein_holidays.snap @@ -1,31 +1,31 @@ [ { - "name": "Ostermontag", - "date": "1970-01-02" + "name": "Neujahr", + "date": "2024-01-01" }, { - "name": "Auffahrt", - "date": "1970-02-09" + "name": "Heilige Drei K\u00f6nige", + "date": "2024-01-06" }, { - "name": "Pfingstmontag", - "date": "1970-02-20" + "name": "Ostermontag", + "date": "2024-04-01" }, { - "name": "Fronleichnam", - "date": "1970-03-02" + "name": "Tag der Arbeit", + "date": "2024-05-01" }, { - "name": "Neujahr", - "date": "2024-01-01" + "name": "Auffahrt", + "date": "2024-05-09" }, { - "name": "Heilige Drei K\u00f6nige", - "date": "2024-01-06" + "name": "Pfingstmontag", + "date": "2024-05-20" }, { - "name": "Tag der Arbeit", - "date": "2024-05-01" + "name": "Fronleichnam", + "date": "2024-05-30" }, { "name": "Staatsfeiertag \/ Mari\u00e4 Himmelfahrt", From 48bb3ba0c84f514bccfafc50c7eccc5adf0f912e Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:43:50 +0100 Subject: [PATCH 047/127] reduce baseline errors --- phpstan-baseline.neon | 15 --------------- src/Countries/Netherlands.php | 1 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 17eba40a1..8364bfa96 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -30,21 +30,6 @@ parameters: count: 1 path: src/Countries/Mexico.php - - - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Netherlands.php - - - - message: "#^Cannot call method subDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Netherlands.php - - - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Netherlands\\:\\:variableHolidays\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: src/Countries/Netherlands.php - - message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(Carbon\\\\CarbonImmutable\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: non\\-falsy\\-string given\\.$#" count: 1 diff --git a/src/Countries/Netherlands.php b/src/Countries/Netherlands.php index 91abc9bd1..9c366ad5b 100644 --- a/src/Countries/Netherlands.php +++ b/src/Countries/Netherlands.php @@ -24,6 +24,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { + /** @var CarbonImmutable $koningsDag */ $koningsDag = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-04-27"); if ($koningsDag->isSunday()) { From ad2555d4c465f285e2e99ff088a69380583bf68c Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 15:33:36 +0200 Subject: [PATCH 048/127] Update Country.php cleanup --- src/Countries/Country.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 85ba9b45a..64bc75c13 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -51,21 +51,16 @@ protected function easter(int $year): CarbonImmutable protected function orthodoxEaster(int $year): CarbonImmutable { $a = $year % 4; - $b = $year % 7; - $c = $year % 19; - $d = (19 * $c + 15) % 30; - $e = (2 * $a + 4 * $b - $d + 34) % 7; - $month = (int) (($d + $e + 114) / 31); - $day = (($d + $e + 114) % 31) + 1; - // julian to gregorian - $jtg = (int) ($year / 100) - (int) ($year / 400) - 2; + $b = $year % 7; + $c = $year % 19; + $d = (19 * $c + 15) % 30; + $e = (2 * $a + 4 * $b - $d + 34) % 7; + $month = (int) (($d + $e + 114) / 31); + $day = (($d + $e + 114) % 31) + 1; + // julian to gregorian + $jtg = (int) ($year / 100) - (int) ($year / 400) - 2; + $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); - $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); - - /*$timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); - $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; - - return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp));*/ return CarbonImmutable::createFromTimestamp($easterDate); } From e0fff55d9eb4915f17ea37b9406e99b3fd6b5583 Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 16:28:06 +0200 Subject: [PATCH 049/127] reduce baseline errors --- phpstan-baseline.neon | 15 --------------- src/Countries/Greece.php | 1 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 626ee351f..8364bfa96 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -25,21 +25,6 @@ parameters: count: 1 path: src/Countries/Country.php - - - message: "#^Cannot call method addDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Greece.php - - - - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Greece.php - - - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Greece\\:\\:variableHolidays\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: src/Countries/Greece.php - - message: "#^Cannot call method setTimezone\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" count: 1 diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index 87b63f9e9..ccf9a685c 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -31,6 +31,7 @@ protected function variableHolidays(int $year): array { $orthodox_easter = $this->orthodoxEaster($year); + /** @var CarbonImmutable $protomagia */ $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); if ( From d8c45403f88134a09688405311890618204099c6 Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 16:43:57 +0200 Subject: [PATCH 050/127] camelCase change --- src/Countries/Greece.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index ccf9a685c..cb268d6d5 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -30,29 +30,29 @@ protected function allHolidays(int $year): array protected function variableHolidays(int $year): array { - $orthodox_easter = $this->orthodoxEaster($year); + $orthodoxEaster = $this->orthodoxEaster($year); /** @var CarbonImmutable $protomagia */ $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); if ( - $protomagia == $orthodox_easter->subDays(2) || - $protomagia == $orthodox_easter->subDays(1) || - $protomagia == $orthodox_easter || - $protomagia == $orthodox_easter->addDay() + $protomagia == $orthodoxEaster->subDays(2) || + $protomagia == $orthodoxEaster->subDays(1) || + $protomagia == $orthodoxEaster || + $protomagia == $orthodoxEaster->addDay() ) { - $protomagia = $orthodox_easter->addDays(2); + $protomagia = $orthodoxEaster->addDays(2); } if ($protomagia->isSunday()) { $protomagia = $protomagia->addDay(); } return [ - 'Καθαρά Δευτέρα' => $orthodox_easter->subDays(48), //always Monday + 'Καθαρά Δευτέρα' => $orthodoxEaster->subDays(48), //always Monday 'Πρωτομαγιά' => $protomagia, - 'Μεγάλη Παρασκευή' => $orthodox_easter->subDays(2), - 'Κυριακή του Πάσχα' => $orthodox_easter, - 'Δευτέρα του Πάσχα' => $orthodox_easter->addDay(), - 'Αγίου Πνεύματος' => $orthodox_easter->addDays(50), //always Monday + 'Μεγάλη Παρασκευή' => $orthodoxEaster->subDays(2), + 'Κυριακή του Πάσχα' => $orthodoxEaster, + 'Δευτέρα του Πάσχα' => $orthodoxEaster->addDay(), + 'Αγίου Πνεύματος' => $orthodoxEaster->addDays(50), //always Monday ]; } } \ No newline at end of file From 00c99a7e0fbc839a23e5636a5a1fa01bd5070085 Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 18:28:08 +0200 Subject: [PATCH 051/127] restorer Country.php / add timezone --- src/Countries/Country.php | 16 ++++------------ src/Countries/Greece.php | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 64bc75c13..3a09768db 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -50,18 +50,10 @@ protected function easter(int $year): CarbonImmutable protected function orthodoxEaster(int $year): CarbonImmutable { - $a = $year % 4; - $b = $year % 7; - $c = $year % 19; - $d = (19 * $c + 15) % 30; - $e = (2 * $a + 4 * $b - $d + 34) % 7; - $month = (int) (($d + $e + 114) / 31); - $day = (($d + $e + 114) % 31) + 1; - // julian to gregorian - $jtg = (int) ($year / 100) - (int) ($year / 400) - 2; - $easterDate = mktime(0, 0, 0, $month, $day + $jtg, $year); - - return CarbonImmutable::createFromTimestamp($easterDate); + $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); + $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; + + return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); } public static function find(string $countryCode): ?Country diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index cb268d6d5..9f41be52c 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -29,8 +29,8 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - - $orthodoxEaster = $this->orthodoxEaster($year); + // OrthodoxEaster needs to setTimezone + $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone("Europe/Athens"); /** @var CarbonImmutable $protomagia */ $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); From 6342868ce3882c4251ed5043818678f07b634465 Mon Sep 17 00:00:00 2001 From: Stavros Date: Tue, 23 Jan 2024 13:48:05 +0200 Subject: [PATCH 052/127] Common orthodox easter date on all timezones --- src/Countries/Country.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 3a09768db..f23f9ea6c 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -53,7 +53,11 @@ protected function orthodoxEaster(int $year): CarbonImmutable $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; - return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); + // Common orthodox easter date on all timezones + return CarbonImmutable::createFromTimestamp($timestamp) + ->setTime(0, 0, 0) + ->addDays($daysDifference + 1); + //return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); } public static function find(string $countryCode): ?Country From 49ddfe3423ed08a2c75b08f204728f482769fc45 Mon Sep 17 00:00:00 2001 From: Stavros Date: Tue, 23 Jan 2024 14:00:48 +0200 Subject: [PATCH 053/127] Common orthodox easter date on all timezones - cleanup --- src/Countries/Country.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index f23f9ea6c..6697d4c3b 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -54,9 +54,7 @@ protected function orthodoxEaster(int $year): CarbonImmutable $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; // Common orthodox easter date on all timezones - return CarbonImmutable::createFromTimestamp($timestamp) - ->setTime(0, 0, 0) - ->addDays($daysDifference + 1); + return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp))->startOfDay()->addDay(); //return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); } From 07454e6e1e2b9b513ab58ce23468fb871a24c875 Mon Sep 17 00:00:00 2001 From: Ivan Mercedes <53806989+ivanmercedes@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:42:24 -0400 Subject: [PATCH 054/127] Added Haiti holidays (#148) --- src/Countries/Haiti.php | 41 +++++++++++++++ .../it_can_calculate_haiti_holidays.snap | 50 +++++++++++++++++++ tests/Countries/HaitiTest.php | 18 +++++++ 3 files changed, 109 insertions(+) create mode 100644 src/Countries/Haiti.php create mode 100644 tests/.pest/snapshots/Countries/HaitiTest/it_can_calculate_haiti_holidays.snap create mode 100644 tests/Countries/HaitiTest.php diff --git a/src/Countries/Haiti.php b/src/Countries/Haiti.php new file mode 100644 index 000000000..f35c3aa29 --- /dev/null +++ b/src/Countries/Haiti.php @@ -0,0 +1,41 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Nouvel an / Jour de l\'Indépendance' => '01-01', + 'Jour des Aieux' => '01-2', + 'Fête du Travail / Fête des Travailleurs' => '05-01', + 'Jour du Drapeau et de l\'Université' => '05-18', + 'L\'Assomption de Marie' => '08-15', + 'Anniversaire de la mort de Dessalines' => '10-17', + 'Toussaint' => '11-01', + 'Jour des Morts' => '11-02', + 'Vertières' => '11-18', + 'Noël' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Carnaval/Mardi Gras' => $easter->subDays(47), + 'Vendredi saint' => $easter->subDays(2), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/HaitiTest/it_can_calculate_haiti_holidays.snap b/tests/.pest/snapshots/Countries/HaitiTest/it_can_calculate_haiti_holidays.snap new file mode 100644 index 000000000..0a09db87f --- /dev/null +++ b/tests/.pest/snapshots/Countries/HaitiTest/it_can_calculate_haiti_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Nouvel an \/ Jour de l'Ind\u00e9pendance", + "date": "2024-01-01" + }, + { + "name": "Jour des Aieux", + "date": "2024-01-02" + }, + { + "name": "Carnaval\/Mardi Gras", + "date": "2024-02-13" + }, + { + "name": "Vendredi saint", + "date": "2024-03-29" + }, + { + "name": "F\u00eate du Travail \/ F\u00eate des Travailleurs", + "date": "2024-05-01" + }, + { + "name": "Jour du Drapeau et de l'Universit\u00e9", + "date": "2024-05-18" + }, + { + "name": "L'Assomption de Marie", + "date": "2024-08-15" + }, + { + "name": "Anniversaire de la mort de Dessalines", + "date": "2024-10-17" + }, + { + "name": "Toussaint", + "date": "2024-11-01" + }, + { + "name": "Jour des Morts", + "date": "2024-11-02" + }, + { + "name": "Verti\u00e8res", + "date": "2024-11-18" + }, + { + "name": "No\u00ebl", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/HaitiTest.php b/tests/Countries/HaitiTest.php new file mode 100644 index 000000000..9e5632765 --- /dev/null +++ b/tests/Countries/HaitiTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 1d6960ea471bf6c567c21e58a67f4e7f8b819e02 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:43:06 +0100 Subject: [PATCH 055/127] remove unneeded annotation --- src/Countries/Haiti.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Countries/Haiti.php b/src/Countries/Haiti.php index f35c3aa29..d35ac1255 100644 --- a/src/Countries/Haiti.php +++ b/src/Countries/Haiti.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'ht'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ From 55f455f3df289c3b35295fe1bfd508e924f570e0 Mon Sep 17 00:00:00 2001 From: Florin Pavel Date: Tue, 23 Jan 2024 14:46:21 +0200 Subject: [PATCH 056/127] Add Romanian Holidays (#27) * add romanian holidays * add Epiphany and Saint John public holidays * fix static analysis * Fix styling * add formula to calculate the difference between Julian and Gregorian calendars * Fix styling * add the source of the orthodox easter algorithm * Fix styling * fix phpstan * remove orthodoxEaster function from Romania class --- src/Countries/Romania.php | 60 ++++++++++++++++ .../it_can_calculate_romanian_holidays.snap | 70 +++++++++++++++++++ tests/Countries/RomaniaTest.php | 19 +++++ 3 files changed, 149 insertions(+) create mode 100644 src/Countries/Romania.php create mode 100644 tests/.pest/snapshots/Countries/RomaniaTest/it_can_calculate_romanian_holidays.snap create mode 100644 tests/Countries/RomaniaTest.php diff --git a/src/Countries/Romania.php b/src/Countries/Romania.php new file mode 100644 index 000000000..c9e1775b4 --- /dev/null +++ b/src/Countries/Romania.php @@ -0,0 +1,60 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Anul Nou' => '01-01', + 'A doua zi de Anul Nou' => '01-02', + 'Bobotează' => '01-06', + 'Sfântul Ion' => '01-07', + 'Ziua Unirii Principatelor Române' => '01-24', + 'Ziua Muncii' => '05-01', + 'Ziua Copilului' => '06-01', + 'Adormirea Maicii Domnului' => '08-15', + 'Sfântul Andrei' => '11-30', + 'Ziua Națională' => '12-01', + 'Crăciunul' => '12-25', + 'A doua zi de Crăciun' => '12-26', + ], $this->variableHolidays($year)); + } + + /** + * @return array + */ + protected function variableHolidays(int $year): array + { + $easter = $this->orthodoxEaster($year); + $easterMonday = $easter->addDay(); + $goodFriday = $easter->subDays(2); + + $pentecost = $this->orthodoxPentecost($year); + $pentecostMonday = $pentecost->addDay(); + + return [ + 'Vinerea Mare' => $goodFriday, + 'Paștele' => $easter, + 'A doua zi de Paște' => $easterMonday, + 'Rusaliile' => $pentecost, + 'A doua zi de Rusalii' => $pentecostMonday, + ]; + } + + protected function orthodoxPentecost(int $year): CarbonImmutable + { + $easter = $this->orthodoxEaster($year); + + return $easter->addDays(49); + } +} diff --git a/tests/.pest/snapshots/Countries/RomaniaTest/it_can_calculate_romanian_holidays.snap b/tests/.pest/snapshots/Countries/RomaniaTest/it_can_calculate_romanian_holidays.snap new file mode 100644 index 000000000..0c4fe65ec --- /dev/null +++ b/tests/.pest/snapshots/Countries/RomaniaTest/it_can_calculate_romanian_holidays.snap @@ -0,0 +1,70 @@ +[ + { + "name": "Anul Nou", + "date": "2024-01-01" + }, + { + "name": "A doua zi de Anul Nou", + "date": "2024-01-02" + }, + { + "name": "Boboteaz\u0103", + "date": "2024-01-06" + }, + { + "name": "Sf\u00e2ntul Ion", + "date": "2024-01-07" + }, + { + "name": "Ziua Unirii Principatelor Rom\u00e2ne", + "date": "2024-01-24" + }, + { + "name": "Ziua Muncii", + "date": "2024-05-01" + }, + { + "name": "Vinerea Mare", + "date": "2024-05-03" + }, + { + "name": "Pa\u0219tele", + "date": "2024-05-05" + }, + { + "name": "A doua zi de Pa\u0219te", + "date": "2024-05-06" + }, + { + "name": "Ziua Copilului", + "date": "2024-06-01" + }, + { + "name": "Rusaliile", + "date": "2024-06-23" + }, + { + "name": "A doua zi de Rusalii", + "date": "2024-06-24" + }, + { + "name": "Adormirea Maicii Domnului", + "date": "2024-08-15" + }, + { + "name": "Sf\u00e2ntul Andrei", + "date": "2024-11-30" + }, + { + "name": "Ziua Na\u021bional\u0103", + "date": "2024-12-01" + }, + { + "name": "Cr\u0103ciunul", + "date": "2024-12-25" + }, + { + "name": "A doua zi de Cr\u0103ciun", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/RomaniaTest.php b/tests/Countries/RomaniaTest.php new file mode 100644 index 000000000..80c177a98 --- /dev/null +++ b/tests/Countries/RomaniaTest.php @@ -0,0 +1,19 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); From 6a84f1b519873cc7519bfadcfdd103e9e7e4b1e5 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:48:01 +0100 Subject: [PATCH 057/127] cleanup Romania --- src/Countries/Romania.php | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/Countries/Romania.php b/src/Countries/Romania.php index c9e1775b4..7073fb783 100644 --- a/src/Countries/Romania.php +++ b/src/Countries/Romania.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'ro'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -30,31 +29,17 @@ protected function allHolidays(int $year): array ], $this->variableHolidays($year)); } - /** - * @return array - */ + /** @return array */ protected function variableHolidays(int $year): array { $easter = $this->orthodoxEaster($year); - $easterMonday = $easter->addDay(); - $goodFriday = $easter->subDays(2); - - $pentecost = $this->orthodoxPentecost($year); - $pentecostMonday = $pentecost->addDay(); return [ - 'Vinerea Mare' => $goodFriday, + 'Vinerea Mare' => $easter->subDays(2), 'Paștele' => $easter, - 'A doua zi de Paște' => $easterMonday, - 'Rusaliile' => $pentecost, - 'A doua zi de Rusalii' => $pentecostMonday, + 'A doua zi de Paște' => $easter->addDay(), + 'Rusaliile' => $easter->addDays(49), + 'A doua zi de Rusalii' => $easter->addDays(50), ]; } - - protected function orthodoxPentecost(int $year): CarbonImmutable - { - $easter = $this->orthodoxEaster($year); - - return $easter->addDays(49); - } } From a336fdcc32ec02edf93ccfc367ecf47b44d7054c Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:51:37 +0100 Subject: [PATCH 058/127] fix issue in baseline --- phpstan-baseline.neon | 5 ----- src/Countries/Mexico.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 8364bfa96..46ce0ede4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -25,11 +25,6 @@ parameters: count: 1 path: src/Countries/Country.php - - - message: "#^Cannot call method setTimezone\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 - path: src/Countries/Mexico.php - - message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(Carbon\\\\CarbonImmutable\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: non\\-falsy\\-string given\\.$#" count: 1 diff --git a/src/Countries/Mexico.php b/src/Countries/Mexico.php index 1cb2cdfa9..0ca4e61c8 100644 --- a/src/Countries/Mexico.php +++ b/src/Countries/Mexico.php @@ -55,7 +55,7 @@ protected function governmentChangeDate(int $year): ?CarbonImmutable // Check if the current year is a transmission year if (($year - $baseYear) % 6 === 0) { - return CarbonImmutable::create($year, 10, 1) // October 1st of the transmission year + return CarbonImmutable::createFromDate($year, 10, 1) // October 1st of the transmission year ->setTimezone('America/Mexico_City'); } From 74d1956a8f23dcec239f296136c215a70bda4596 Mon Sep 17 00:00:00 2001 From: Jonnathan Chiroy Date: Tue, 23 Jan 2024 06:52:30 -0600 Subject: [PATCH 059/127] Add Guatemala holidays (#106) * add: guatemalan holidays * Add guatemalan holidays --------- Co-authored-by: ejchiroy --- src/Countries/Guatemala.php | 38 +++++++++++++++++ .../it_can_calculate_guatemalan_holidays.snap | 42 +++++++++++++++++++ tests/Countries/GuatemalaTest.php | 18 ++++++++ 3 files changed, 98 insertions(+) create mode 100644 src/Countries/Guatemala.php create mode 100644 tests/.pest/snapshots/Countries/GuatemalaTest/it_can_calculate_guatemalan_holidays.snap create mode 100644 tests/Countries/GuatemalaTest.php diff --git a/src/Countries/Guatemala.php b/src/Countries/Guatemala.php new file mode 100644 index 000000000..ea1c8f436 --- /dev/null +++ b/src/Countries/Guatemala.php @@ -0,0 +1,38 @@ + '01-01', + 'Día de los Trabajadores' => '05-01', + 'Día del Ejército' => '06-31', + 'Día de la Independencia' => '09-15', + 'Día de la Revolución' => '10-20', + 'Día de Todos los Santos' => '11-01', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + 'Sábado Santo' => $easter->subDays(1), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/GuatemalaTest/it_can_calculate_guatemalan_holidays.snap b/tests/.pest/snapshots/Countries/GuatemalaTest/it_can_calculate_guatemalan_holidays.snap new file mode 100644 index 000000000..9b15bf4e8 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GuatemalaTest/it_can_calculate_guatemalan_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "Jueves Santo", + "date": "2024-03-28" + }, + { + "name": "Viernes Santo", + "date": "2024-03-29" + }, + { + "name": "S\u00e1bado Santo", + "date": "2024-03-30" + }, + { + "name": "D\u00eda de los Trabajadores", + "date": "2024-05-01" + }, + { + "name": "D\u00eda del Ej\u00e9rcito", + "date": "2024-07-01" + }, + { + "name": "D\u00eda de la Independencia", + "date": "2024-09-15" + }, + { + "name": "D\u00eda de la Revoluci\u00f3n", + "date": "2024-10-20" + }, + { + "name": "D\u00eda de Todos los Santos", + "date": "2024-11-01" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/GuatemalaTest.php b/tests/Countries/GuatemalaTest.php new file mode 100644 index 000000000..106ce7d4d --- /dev/null +++ b/tests/Countries/GuatemalaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 7a09493793cf481a6d69844acaaea30c07fde4f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <73190968+UrbinCedric@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:53:02 +0100 Subject: [PATCH 060/127] Add holidays for Luxembourg (#165) --- src/Countries/Luxembourg.php | 39 ++++++++++++++++ ..._can_calculate_luxembourgish_holidays.snap | 46 +++++++++++++++++++ tests/Countries/LuxembourgTest.php | 18 ++++++++ 3 files changed, 103 insertions(+) create mode 100644 src/Countries/Luxembourg.php create mode 100644 tests/.pest/snapshots/Countries/LuxembourgTest/it_can_calculate_luxembourgish_holidays.snap create mode 100644 tests/Countries/LuxembourgTest.php diff --git a/src/Countries/Luxembourg.php b/src/Countries/Luxembourg.php new file mode 100644 index 000000000..e5f73fd81 --- /dev/null +++ b/src/Countries/Luxembourg.php @@ -0,0 +1,39 @@ + '01-01', + 'Dag vun der Aarbecht' => '05-01', + 'Europadag' => '05-09', + 'Nationalfeierdag' => '06-23', + 'Mariä Himmelfahrt' => '08-15', + 'Allerhellgen' => '11-01', + 'Chrëschtdag' => '12-25', + 'Stiefesdag' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Ouschterméindeg' => $easter->addDay(), + 'Christi Himmelfahrt' => $easter->addDays(39), + 'Péngschtméindeg' => $easter->addDays(50), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/LuxembourgTest/it_can_calculate_luxembourgish_holidays.snap b/tests/.pest/snapshots/Countries/LuxembourgTest/it_can_calculate_luxembourgish_holidays.snap new file mode 100644 index 000000000..79f844c17 --- /dev/null +++ b/tests/.pest/snapshots/Countries/LuxembourgTest/it_can_calculate_luxembourgish_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neijoerschdag", + "date": "2024-01-01" + }, + { + "name": "Ouschterm\u00e9indeg", + "date": "2024-04-01" + }, + { + "name": "Dag vun der Aarbecht", + "date": "2024-05-01" + }, + { + "name": "Europadag", + "date": "2024-05-09" + }, + { + "name": "Christi Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "P\u00e9ngschtm\u00e9indeg", + "date": "2024-05-20" + }, + { + "name": "Nationalfeierdag", + "date": "2024-06-23" + }, + { + "name": "Mari\u00e4 Himmelfahrt", + "date": "2024-08-15" + }, + { + "name": "Allerhellgen", + "date": "2024-11-01" + }, + { + "name": "Chr\u00ebschtdag", + "date": "2024-12-25" + }, + { + "name": "Stiefesdag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/LuxembourgTest.php b/tests/Countries/LuxembourgTest.php new file mode 100644 index 000000000..48c69782c --- /dev/null +++ b/tests/Countries/LuxembourgTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From a5b467a392ada0201ac48f10c17781510f670d9b Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Tue, 23 Jan 2024 15:00:21 +0200 Subject: [PATCH 061/127] Add holidays for South Africa (#30) --- src/Countries/SouthAfrica.php | 59 +++++++++++++++++++ ...t_can_calculate_south_africa_holidays.snap | 54 +++++++++++++++++ tests/Countries/SouthAfricaTest.php | 18 ++++++ 3 files changed, 131 insertions(+) create mode 100644 src/Countries/SouthAfrica.php create mode 100644 tests/.pest/snapshots/Countries/SouthAfricaTest/it_can_calculate_south_africa_holidays.snap create mode 100644 tests/Countries/SouthAfricaTest.php diff --git a/src/Countries/SouthAfrica.php b/src/Countries/SouthAfrica.php new file mode 100644 index 000000000..79e72d223 --- /dev/null +++ b/src/Countries/SouthAfrica.php @@ -0,0 +1,59 @@ + '01-01', + 'Human Rights Day' => '03-21', + 'Freedom Day' => '04-27', + 'Workers\' Day' => '05-01', + 'Youth Day' => '06-16', + 'National Women\'s Day' => '08-09', + 'Heritage Day' => '09-24', + 'Day of Reconciliation' => '12-16', + 'Christmas Day' => '12-25', + 'Day of Goodwill' => '12-26', + ]; + + foreach ($holidays as $name => $date) { + $holidayDate = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$date}"); + assert($holidayDate instanceof CarbonImmutable); + + // The Public Holidays Act (Act No 36 of 1994) states that whenever a public holiday falls on a Sunday, the Monday following it will be a public holiday. + // https://www.gov.za/documents/public-holidays-act + if ( + $holidayDate->isSunday() && + !in_array($holidayDate->addDay()->format('m-d'), $holidays, true) // Check that the Monday is not already a holiday + ) { + $holidays[$name . ' Observed'] = $holidayDate->addDay(); + } + } + + return array_merge($holidays, $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Good Friday' => $easter->subDays(2), + 'Family Day' => $easter->addDay(), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/SouthAfricaTest/it_can_calculate_south_africa_holidays.snap b/tests/.pest/snapshots/Countries/SouthAfricaTest/it_can_calculate_south_africa_holidays.snap new file mode 100644 index 000000000..a77953f69 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SouthAfricaTest/it_can_calculate_south_africa_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Human Rights Day", + "date": "2024-03-21" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Family Day", + "date": "2024-04-01" + }, + { + "name": "Freedom Day", + "date": "2024-04-27" + }, + { + "name": "Workers' Day", + "date": "2024-05-01" + }, + { + "name": "Youth Day", + "date": "2024-06-16" + }, + { + "name": "Youth Day Observed", + "date": "2024-06-17" + }, + { + "name": "National Women's Day", + "date": "2024-08-09" + }, + { + "name": "Heritage Day", + "date": "2024-09-24" + }, + { + "name": "Day of Reconciliation", + "date": "2024-12-16" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Day of Goodwill", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/SouthAfricaTest.php b/tests/Countries/SouthAfricaTest.php new file mode 100644 index 000000000..fe98169c5 --- /dev/null +++ b/tests/Countries/SouthAfricaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 1b7ef835e7521dda88ba29dc094336b998927369 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Tue, 23 Jan 2024 13:00:44 +0000 Subject: [PATCH 062/127] Fix styling --- src/Countries/SouthAfrica.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Countries/SouthAfrica.php b/src/Countries/SouthAfrica.php index 79e72d223..64d404127 100644 --- a/src/Countries/SouthAfrica.php +++ b/src/Countries/SouthAfrica.php @@ -3,6 +3,7 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; + use function in_array; class SouthAfrica extends Country @@ -37,9 +38,9 @@ protected function allHolidays(int $year): array // https://www.gov.za/documents/public-holidays-act if ( $holidayDate->isSunday() && - !in_array($holidayDate->addDay()->format('m-d'), $holidays, true) // Check that the Monday is not already a holiday + ! in_array($holidayDate->addDay()->format('m-d'), $holidays, true) // Check that the Monday is not already a holiday ) { - $holidays[$name . ' Observed'] = $holidayDate->addDay(); + $holidays[$name.' Observed'] = $holidayDate->addDay(); } } From d04ca0447d797bc6dd0b793dc9ed3fdc9a854179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B3pez=20S=C3=A1nchez?= Date: Tue, 23 Jan 2024 08:01:41 -0500 Subject: [PATCH 063/127] Add Peru holidays (#54) * Adds Peru holidays * Adds Peru holidays * Use $this->easter factory and remoce comments on allHolidays method --- src/Countries/Peru.php | 44 +++++++++++++ .../it_can_calculate_peru_holidays.snap | 66 +++++++++++++++++++ tests/Countries/PeruTest.php | 18 +++++ 3 files changed, 128 insertions(+) create mode 100644 src/Countries/Peru.php create mode 100644 tests/.pest/snapshots/Countries/PeruTest/it_can_calculate_peru_holidays.snap create mode 100644 tests/Countries/PeruTest.php diff --git a/src/Countries/Peru.php b/src/Countries/Peru.php new file mode 100644 index 000000000..1c0f0b6cb --- /dev/null +++ b/src/Countries/Peru.php @@ -0,0 +1,44 @@ + '01-01', + 'Día del Trabajo' => '05-01', + 'Batalla de Arica y Día de la bandera' => '06-07', + 'Día de San Pedro y San Pablo' => '06-29', + 'Día de la Fuerza Aérea del Perú' => '07-23', + 'Día de la Independencia' => '07-28', + 'Fiestas Patrias' => '07-29', + 'Batalla de Junín' => '08-06', + 'Santa Rosa de Lima' => '08-30', + 'Combate de Angamos' => '10-08', + 'Día de Todos los Santos' => '11-01', + 'Inmaculada Concepción' => '12-08', + 'Batalla de Ayacucho' => '12-09', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/PeruTest/it_can_calculate_peru_holidays.snap b/tests/.pest/snapshots/Countries/PeruTest/it_can_calculate_peru_holidays.snap new file mode 100644 index 000000000..df38f0613 --- /dev/null +++ b/tests/.pest/snapshots/Countries/PeruTest/it_can_calculate_peru_holidays.snap @@ -0,0 +1,66 @@ +[ + { + "name": "A\u00f1o nuevo", + "date": "2024-01-01" + }, + { + "name": "Jueves Santo", + "date": "2024-03-28" + }, + { + "name": "Viernes Santo", + "date": "2024-03-29" + }, + { + "name": "D\u00eda del Trabajo", + "date": "2024-05-01" + }, + { + "name": "Batalla de Arica y D\u00eda de la bandera", + "date": "2024-06-07" + }, + { + "name": "D\u00eda de San Pedro y San Pablo", + "date": "2024-06-29" + }, + { + "name": "D\u00eda de la Fuerza A\u00e9rea del Per\u00fa", + "date": "2024-07-23" + }, + { + "name": "D\u00eda de la Independencia", + "date": "2024-07-28" + }, + { + "name": "Fiestas Patrias", + "date": "2024-07-29" + }, + { + "name": "Batalla de Jun\u00edn", + "date": "2024-08-06" + }, + { + "name": "Santa Rosa de Lima", + "date": "2024-08-30" + }, + { + "name": "Combate de Angamos", + "date": "2024-10-08" + }, + { + "name": "D\u00eda de Todos los Santos", + "date": "2024-11-01" + }, + { + "name": "Inmaculada Concepci\u00f3n", + "date": "2024-12-08" + }, + { + "name": "Batalla de Ayacucho", + "date": "2024-12-09" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/PeruTest.php b/tests/Countries/PeruTest.php new file mode 100644 index 000000000..aff6670eb --- /dev/null +++ b/tests/Countries/PeruTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From dcb66ef65feaae6c63c0390e904d107e3fe6494a Mon Sep 17 00:00:00 2001 From: Nick Dijkstra <3372841+ndijkstra@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:14:40 +0100 Subject: [PATCH 064/127] Update Dutch holidays (#67) * Remove "Oudejaarsdag" since it is not an official holiday * Use correct capitalization of holidays * Use Eerste and Tweede instead of 1e and 2e * Fix tests * Update capital letters in snapshot * Remove blank line EOF * Update it_can_calculate_dutch_holidays.snap --- src/Countries/Netherlands.php | 12 ++++++------ .../it_can_calculate_dutch_holidays.snap | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Countries/Netherlands.php b/src/Countries/Netherlands.php index 9c366ad5b..44ae6ae7c 100644 --- a/src/Countries/Netherlands.php +++ b/src/Countries/Netherlands.php @@ -16,8 +16,8 @@ protected function allHolidays(int $year): array return array_merge([ 'Nieuwjaarsdag' => '01-01', 'Bevrijdingsdag' => '05-05', - '1e Kerstdag' => '12-25', - '2e Kerstdag' => '12-26', + 'Eerste kerstdag' => '12-25', + 'Tweede kerstdag' => '12-26', ], $this->variableHolidays($year)); } @@ -36,11 +36,11 @@ protected function variableHolidays(int $year): array return [ 'Koningsdag' => $koningsDag, 'Goede Vrijdag' => $easter->subDays(2), - '1e Paasdag' => $easter, - '2e Paasdag' => $easter->addDay(), + 'Eerste paasdag' => $easter, + 'Tweede paasdag' => $easter->addDay(), 'Hemelvaartsdag' => $easter->addDays(39), - '1e Pinksterdag' => $easter->addDays(49), - '2e Pinksterdag' => $easter->addDays(50), + 'Eerste pinksterdag' => $easter->addDays(49), + 'Tweede pinksterdag' => $easter->addDays(50), ]; } } diff --git a/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap b/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap index 7ba840be8..43bb5dfa6 100644 --- a/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap +++ b/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap @@ -8,11 +8,11 @@ "date": "2024-03-29" }, { - "name": "1e Paasdag", + "name": "Eerste paasdag", "date": "2024-03-31" }, { - "name": "2e Paasdag", + "name": "Tweede paasdag", "date": "2024-04-01" }, { @@ -28,19 +28,19 @@ "date": "2024-05-09" }, { - "name": "1e Pinksterdag", + "name": "Eerste pinksterdag", "date": "2024-05-19" }, { - "name": "2e Pinksterdag", + "name": "Tweede pinksterdag", "date": "2024-05-20" }, { - "name": "1e Kerstdag", + "name": "Eerste kerstdag", "date": "2024-12-25" }, { - "name": "2e Kerstdag", + "name": "Tweede kerstdag", "date": "2024-12-26" } -] \ No newline at end of file +] From 78fe5938b54aaf55c7e7253897176510079d48ce Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:16:00 +0100 Subject: [PATCH 065/127] update NL snapshot --- .../it_can_calculate_ugandan_holidays.snap | 46 ------------------- .../it_can_calculate_dutch_holidays.snap | 2 +- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap diff --git a/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap b/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap deleted file mode 100644 index 63bfa81dc..000000000 --- a/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "name": "New Years Day", - "date": "2024-01-01" - }, - { - "name": "John Chilembwe Day", - "date": "2024-01-15" - }, - { - "name": "Martyrs Day", - "date": "2024-03-03" - }, - { - "name": "Good Friday", - "date": "2024-03-29" - }, - { - "name": "Easter Monday", - "date": "2024-04-01" - }, - { - "name": "Labour Day", - "date": "2024-05-01" - }, - { - "name": "Kamuzu Day", - "date": "2024-05-14" - }, - { - "name": "Independence Day", - "date": "2024-07-06" - }, - { - "name": "Mothers Day", - "date": "2024-10-15" - }, - { - "name": "Christmas Day", - "date": "2024-12-25" - }, - { - "name": "Boxing Day", - "date": "2024-12-26" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap b/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap index 43bb5dfa6..13a3de79f 100644 --- a/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap +++ b/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap @@ -43,4 +43,4 @@ "name": "Tweede kerstdag", "date": "2024-12-26" } -] +] \ No newline at end of file From 954ddcac2a3a83b8a8d0afbb1105a1ca964d6f64 Mon Sep 17 00:00:00 2001 From: Stavros Date: Tue, 23 Jan 2024 15:18:03 +0200 Subject: [PATCH 066/127] Greece only with default orthodoxEaster as other OrthodoxCountries --- src/Countries/Country.php | 4 +--- src/Countries/Greece.php | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 6697d4c3b..3a09768db 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -53,9 +53,7 @@ protected function orthodoxEaster(int $year): CarbonImmutable $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; - // Common orthodox easter date on all timezones - return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp))->startOfDay()->addDay(); - //return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); + return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); } public static function find(string $countryCode): ?Country diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index 9f41be52c..f6242839c 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -31,28 +31,30 @@ protected function variableHolidays(int $year): array { // OrthodoxEaster needs to setTimezone $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone("Europe/Athens"); + $cleanMonday = $orthodoxEaster->copy()->subDays(48); + $megaliParaskevi = $orthodoxEaster->copy()->subDays(2); + $megaloSavvato = $orthodoxEaster->copy()->subDays(1); + $deuteraPasha = $orthodoxEaster->copy()->addDay(); + $agiouPneumatos = $orthodoxEaster->copy()->addDays(50); + /** @var CarbonImmutable $protomagia */ $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); + $moveProtomagia = [$megaliParaskevi, $megaloSavvato, $orthodoxEaster, $deuteraPasha]; - if ( - $protomagia == $orthodoxEaster->subDays(2) || - $protomagia == $orthodoxEaster->subDays(1) || - $protomagia == $orthodoxEaster || - $protomagia == $orthodoxEaster->addDay() - ) { - $protomagia = $orthodoxEaster->addDays(2); + if ( in_array($protomagia, $moveProtomagia) ) { + $protomagia = $orthodoxEaster->copy()->addDays(2); } if ($protomagia->isSunday()) { - $protomagia = $protomagia->addDay(); + $protomagia = $protomagia->copy()->addDay(); } return [ - 'Καθαρά Δευτέρα' => $orthodoxEaster->subDays(48), //always Monday + 'Καθαρά Δευτέρα' => $cleanMonday, //always Monday 'Πρωτομαγιά' => $protomagia, - 'Μεγάλη Παρασκευή' => $orthodoxEaster->subDays(2), + 'Μεγάλη Παρασκευή' => $megaliParaskevi, 'Κυριακή του Πάσχα' => $orthodoxEaster, - 'Δευτέρα του Πάσχα' => $orthodoxEaster->addDay(), - 'Αγίου Πνεύματος' => $orthodoxEaster->addDays(50), //always Monday + 'Δευτέρα του Πάσχα' => $deuteraPasha, + 'Αγίου Πνεύματος' => $agiouPneumatos, //always Monday ]; } } \ No newline at end of file From 262bfa5887357cfb3f11bec3ba016f39b2b4e13d Mon Sep 17 00:00:00 2001 From: Petr Katerinak <33215381+inDeev@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:27:41 +0100 Subject: [PATCH 067/127] Added historical data for Czechia (#159) Co-authored-by: Petr Katerinak --- src/Countries/Czechia.php | 63 ++++++++++++++----- .../it_can_calculate_czech_holidays.snap | 2 +- tests/Countries/CzechiaTest.php | 54 ++++++++++++++++ 3 files changed, 102 insertions(+), 17 deletions(-) diff --git a/src/Countries/Czechia.php b/src/Countries/Czechia.php index c4aff4200..e13921286 100644 --- a/src/Countries/Czechia.php +++ b/src/Countries/Czechia.php @@ -13,19 +13,43 @@ public function countryCode(): string protected function allHolidays(int $year): array { - return array_merge([ - 'Den obnovy samostatného českého státu' => '01-01', - 'Svátek práce' => '05-01', - 'Den vítězství' => '05-08', - 'Den slovanských věrozvěstů Cyrila a Metoděje' => '07-05', - 'Den upálení mistra Jana Husa' => '07-06', - 'Den české státnosti' => '09-28', - 'Den vzniku samostatného československého státu' => '10-28', - 'Den boje za svobodu a demokracii a Mezinárodní den studentstva' => '11-17', - 'Štědrý den' => '12-24', - '1. svátek vánoční' => '12-25', - '2. svátek vánoční' => '12-26', - ], $this->variableHolidays($year)); + // https://kalendar.beda.cz/statni-svatky-a-vyznamne-dny-v-roce-prehledne?year=1970 + $holidays = [ + 'Nový rok' => ['01-01', $year <= 2000], + 'Nový rok; Den obnovy samostatného českého státu' => ['01-01', $year >= 2001], + + 'Svátek práce' => ['05-01', true], + + 'Výročí osvobození Československa Sovětskou armádou' => ['05-09', $year <= 1990], + 'Den osvobození od fašismu' => [$year === 1991 ? '05-09' : '05-08' , $year >= 1991 && $year <= 2000], + 'Den osvobození' => ['05-08', $year >= 2001 && $year <= 2003], + 'Den vítězství' => ['05-08', $year >= 2004], + + 'Den slovanských věrozvěstů Cyrila a Metoděje' => ['07-05', $year >= 1990], + + 'Den upálení mistra Jana Husa' => ['07-06', $year >= 1990], + + 'Den české státnosti' => ['09-28', $year >= 2000], + + 'Vyhlášení samostatnosti ČSR; Schválení zákona o federaci' => ['10-28', $year <= 1971], + 'Den znárodnění' => ['10-28', $year === 1972], + 'Vyhlášení samostatnosti ČSR; Schválení zákona o federaci; Den znárodnění' => ['10-28', $year >= 1973 && $year <= 1974], + 'Den vzniku samostatného československého státu' => ['10-28', $year >= 1988], + + 'Den boje za svobodu a demokracii a Mezinárodní den studentstva' => ['11-17', $year >= 2000], + 'Štědrý den' => ['12-24', $year >= 1990], + '1. svátek vánoční' => ['12-25', true], + '2. svátek vánoční' => ['12-26', true], + ]; + + $filteredHolidays = array_map( + static fn (array $holiday) => $holiday[0], + array_filter($holidays, + static fn (array $holiday) => $holiday[1] === true + ) + ); + + return array_merge($filteredHolidays, $this->variableHolidays($year)); } /** @return array */ @@ -33,9 +57,16 @@ protected function variableHolidays(int $year): array { $easter = $this->easter($year); - return [ - 'Velikonoční pondělí' => $easter->addDay(), - 'Velký pátek' => $easter->subDays(2), + $variableHolidays = [ + 'Velikonoční pondělí' => [$easter->addDay(), true], + 'Velký pátek' => [$easter->subDays(2), $year >= 2016], ]; + + return array_map( + static fn (array $variableHoliday) => $variableHoliday[0], + array_filter($variableHolidays, + static fn (array $variableHoliday) => $variableHoliday[1] === true + ) + ); } } diff --git a/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap b/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap index 9e3ba56a8..77ae51125 100644 --- a/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap +++ b/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap @@ -1,6 +1,6 @@ [ { - "name": "Den obnovy samostatn\u00e9ho \u010desk\u00e9ho st\u00e1tu", + "name": "Nov\u00fd rok; Den obnovy samostatn\u00e9ho \u010desk\u00e9ho st\u00e1tu", "date": "2024-01-01" }, { diff --git a/tests/Countries/CzechiaTest.php b/tests/Countries/CzechiaTest.php index 0a7ece2fa..4616cbcb7 100644 --- a/tests/Countries/CzechiaTest.php +++ b/tests/Countries/CzechiaTest.php @@ -16,3 +16,57 @@ expect(formatDates($holidays))->toMatchSnapshot(); }); + +it ('gives right holidays for specific years', function (int $year, array $containsHolidays) { + $holidays = Holidays::for('cz', $year)->get(); + + $allHolidaysSince1970 = [ + 0 => 'Nový rok', + 1 => 'Nový rok; Den obnovy samostatného českého státu', + 2 => 'Svátek práce', + 3 => 'Výročí osvobození Československa Sovětskou armádou', + 4 => 'Den osvobození od fašismu', + 5 => 'Den osvobození', + 6 => 'Den vítězství', + 7 => 'Den slovanských věrozvěstů Cyrila a Metoděje', + 8 => 'Den upálení mistra Jana Husa', + 9 => 'Den české státnosti', + 10 => 'Vyhlášení samostatnosti ČSR; Schválení zákona o federaci', + 11 => 'Den znárodnění', + 12 => 'Vyhlášení samostatnosti ČSR; Schválení zákona o federaci; Den znárodnění', + 13 => 'Den vzniku samostatného československého státu', + 14 => 'Den boje za svobodu a demokracii a Mezinárodní den studentstva', + 15 => 'Štědrý den', + 16 => '1. svátek vánoční', + 17 => '2. svátek vánoční', + // Variable: + 18 => 'Velikonoční pondělí', + 19 => 'Velký pátek', + ]; + + expect($holidays)->toBeArray(); + + $expectedHolidays = array_map( + static fn (int $index) => $allHolidaysSince1970[$index], + $containsHolidays + ); + + $givenNames = array_map( + static fn (array $holidayProperties) => $holidayProperties['name'], + $holidays + ); + + expect($givenNames)->toEqualCanonicalizing($expectedHolidays); +})->with([ + [1970, [0, 18, 2, 3, 10, 16, 17]], + [1975, [0, 18, 2, 3, 16, 17]], + [1980, [0, 18, 2, 3, 16, 17]], + [1985, [0, 18, 2, 3, 16, 17]], + [1990, [0, 18, 2, 3, 7, 8, 13, 15, 16, 17]], + [1995, [0, 18, 2, 4, 7, 8, 13, 15, 16, 17]], + [2000, [0, 18, 2, 4, 7, 8, 9, 13, 14, 15, 16, 17]], + [2005, [1, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], + [2010, [1, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], + [2015, [1, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], + [2020, [1, 19, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], +]); \ No newline at end of file From fe37e447a3671f565b00345c4909d4445e0a6abc Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Tue, 23 Jan 2024 13:28:01 +0000 Subject: [PATCH 068/127] Fix styling --- src/Countries/Czechia.php | 2 +- tests/Countries/CzechiaTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Countries/Czechia.php b/src/Countries/Czechia.php index e13921286..402aed2db 100644 --- a/src/Countries/Czechia.php +++ b/src/Countries/Czechia.php @@ -21,7 +21,7 @@ protected function allHolidays(int $year): array 'Svátek práce' => ['05-01', true], 'Výročí osvobození Československa Sovětskou armádou' => ['05-09', $year <= 1990], - 'Den osvobození od fašismu' => [$year === 1991 ? '05-09' : '05-08' , $year >= 1991 && $year <= 2000], + 'Den osvobození od fašismu' => [$year === 1991 ? '05-09' : '05-08', $year >= 1991 && $year <= 2000], 'Den osvobození' => ['05-08', $year >= 2001 && $year <= 2003], 'Den vítězství' => ['05-08', $year >= 2004], diff --git a/tests/Countries/CzechiaTest.php b/tests/Countries/CzechiaTest.php index 4616cbcb7..5b9f09bb3 100644 --- a/tests/Countries/CzechiaTest.php +++ b/tests/Countries/CzechiaTest.php @@ -17,7 +17,7 @@ expect(formatDates($holidays))->toMatchSnapshot(); }); -it ('gives right holidays for specific years', function (int $year, array $containsHolidays) { +it('gives right holidays for specific years', function (int $year, array $containsHolidays) { $holidays = Holidays::for('cz', $year)->get(); $allHolidaysSince1970 = [ @@ -69,4 +69,4 @@ [2010, [1, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], [2015, [1, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], [2020, [1, 19, 18, 2, 6, 7, 8, 9, 13, 14, 15, 16, 17]], -]); \ No newline at end of file +]); From 71169b8b1fc4832ddcf30030b3a27d7c57a14a74 Mon Sep 17 00:00:00 2001 From: freekmurze Date: Tue, 23 Jan 2024 14:28:59 +0000 Subject: [PATCH 069/127] Fix styling --- src/Countries/Greece.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Countries/Greece.php b/src/Countries/Greece.php index f6242839c..1b206e007 100644 --- a/src/Countries/Greece.php +++ b/src/Countries/Greece.php @@ -14,13 +14,13 @@ public function countryCode(): string protected function allHolidays(int $year): array { return array_merge([ - 'Πρωτοχρονιά' => '01-01', - 'Θεοφάνια' => '01-06', - '25η Μαρτίου' => '03-25', - 'Πρωτομαγιά' => '05-01', - 'Δεκαπενταύγουστος' => '08-15', - '28η Οκτωβρίου' => '10-28', - 'Χριστούγεννα' => '12-25', + 'Πρωτοχρονιά' => '01-01', + 'Θεοφάνια' => '01-06', + '25η Μαρτίου' => '03-25', + 'Πρωτομαγιά' => '05-01', + 'Δεκαπενταύγουστος' => '08-15', + '28η Οκτωβρίου' => '10-28', + 'Χριστούγεννα' => '12-25', 'Σύναξη της Θεοτόκου' => '12-26', ], $this->variableHolidays($year)); @@ -30,7 +30,7 @@ protected function allHolidays(int $year): array protected function variableHolidays(int $year): array { // OrthodoxEaster needs to setTimezone - $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone("Europe/Athens"); + $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone('Europe/Athens'); $cleanMonday = $orthodoxEaster->copy()->subDays(48); $megaliParaskevi = $orthodoxEaster->copy()->subDays(2); $megaloSavvato = $orthodoxEaster->copy()->subDays(1); @@ -41,7 +41,7 @@ protected function variableHolidays(int $year): array $protomagia = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-05-01"); $moveProtomagia = [$megaliParaskevi, $megaloSavvato, $orthodoxEaster, $deuteraPasha]; - if ( in_array($protomagia, $moveProtomagia) ) { + if (in_array($protomagia, $moveProtomagia)) { $protomagia = $orthodoxEaster->copy()->addDays(2); } if ($protomagia->isSunday()) { @@ -49,12 +49,12 @@ protected function variableHolidays(int $year): array } return [ - 'Καθαρά Δευτέρα' => $cleanMonday, //always Monday - 'Πρωτομαγιά' => $protomagia, - 'Μεγάλη Παρασκευή' => $megaliParaskevi, + 'Καθαρά Δευτέρα' => $cleanMonday, //always Monday + 'Πρωτομαγιά' => $protomagia, + 'Μεγάλη Παρασκευή' => $megaliParaskevi, 'Κυριακή του Πάσχα' => $orthodoxEaster, 'Δευτέρα του Πάσχα' => $deuteraPasha, - 'Αγίου Πνεύματος' => $agiouPneumatos, //always Monday + 'Αγίου Πνεύματος' => $agiouPneumatos, //always Monday ]; } -} \ No newline at end of file +} From 4d4039690bfc38694ce68c4fd0067907effe80b7 Mon Sep 17 00:00:00 2001 From: freekmurze Date: Tue, 23 Jan 2024 14:29:29 +0000 Subject: [PATCH 070/127] Fix styling --- src/Countries/Kosovo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Kosovo.php b/src/Countries/Kosovo.php index 87dfcc2f7..0c2ba0d13 100644 --- a/src/Countries/Kosovo.php +++ b/src/Countries/Kosovo.php @@ -30,7 +30,7 @@ protected function variableHolidays(int $year): array $holidays['Pashkët Katolike'] = $this->easter($year); $holidays['Pashkët Ortodokse'] = $this->orthodoxEaster($year); - if($year >= 2008) { + if ($year >= 2008) { $holidays['Dita e Pavarësisë së Republikës së Kosovës'] = '02-17'; $holidays['Dita e Kushtetutës së Republikës së Kosovës'] = '04-09'; } From 586ad9f3339bb2ff4fe0d81d9b7acae5077f8186 Mon Sep 17 00:00:00 2001 From: freekmurze Date: Tue, 23 Jan 2024 14:30:15 +0000 Subject: [PATCH 071/127] Fix styling --- src/Countries/Panama.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Countries/Panama.php b/src/Countries/Panama.php index 04f3c54d8..98e10eb1d 100644 --- a/src/Countries/Panama.php +++ b/src/Countries/Panama.php @@ -69,8 +69,8 @@ protected function variableHolidays(int $year): array * established for a national celebration to coincide with a Sunday, the following Monday * will be enabled as a mandatory weekly rest day" * - * @param array $fixedHolidays Array of holidays in the format ['holiday name' => 'mm-dd'] - * @param int $year The year for which to calculate the holidays + * @param array $fixedHolidays Array of holidays in the format ['holiday name' => 'mm-dd'] + * @param int $year The year for which to calculate the holidays * @return array */ protected function calculateBridgeDays(array $fixedHolidays, int $year): array @@ -83,7 +83,7 @@ protected function calculateBridgeDays(array $fixedHolidays, int $year): array if ($holiday !== false) { $holidays[$name] = $holiday; if ($holiday->isSunday()) { - $holidays[$name . ' (Puente)'] = $holiday->addDay(); + $holidays[$name.' (Puente)'] = $holiday->addDay(); } } } From 65a0cd15685b48692c41c6bade9918cd5d15f953 Mon Sep 17 00:00:00 2001 From: freekmurze Date: Tue, 23 Jan 2024 14:33:12 +0000 Subject: [PATCH 072/127] Fix styling --- src/Countries/Canada.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index c7efc9e22..1925fb2ca 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -16,21 +16,21 @@ protected function allHolidays(int $year): array { return array_merge( [ - 'New Year\'s Day' => new CarbonImmutable($year . "-01-01", 'America/Toronto'), - 'Canada Day' => new CarbonImmutable($year . "-07-01", 'America/Toronto'), + 'New Year\'s Day' => new CarbonImmutable($year.'-01-01', 'America/Toronto'), + 'Canada Day' => new CarbonImmutable($year.'-07-01', 'America/Toronto'), 'Civic Holiday' => new CarbonImmutable( - "first monday of August " . $year, 'America/Toronto' + 'first monday of August '.$year, 'America/Toronto' ), 'Labour Day' => new CarbonImmutable( - "first monday of September " . $year, 'America/Toronto' + 'first monday of September '.$year, 'America/Toronto' ), 'National Day for Truth and Reconciliation' => new CarbonImmutable( - $year . "-09-30", + $year.'-09-30', 'America/Toronto' ), - 'Remembrance Day' => new CarbonImmutable($year . "-11-11", 'America/Toronto'), - 'Christmas Day' => new CarbonImmutable($year . "-12-25", 'America/Toronto'), - 'Boxing Day' => new CarbonImmutable($year . '-12-26', 'America/Toronto'), + 'Remembrance Day' => new CarbonImmutable($year.'-11-11', 'America/Toronto'), + 'Christmas Day' => new CarbonImmutable($year.'-12-25', 'America/Toronto'), + 'Boxing Day' => new CarbonImmutable($year.'-12-26', 'America/Toronto'), ], $this->variableHolidays($year) ); @@ -51,6 +51,7 @@ protected function variableHolidays(int $year): array } $thanksgiving = new CarbonImmutable("second monday of October $year", 'America/Toronto'); + return [ 'Victoria Day' => $victoriaDay, 'Good Friday' => $goodFriday, From 9f45e43b48848ad2276174f9419a781b7906ea07 Mon Sep 17 00:00:00 2001 From: freekmurze Date: Tue, 23 Jan 2024 14:34:33 +0000 Subject: [PATCH 073/127] Fix styling --- src/Countries/Turkmenistan.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Countries/Turkmenistan.php b/src/Countries/Turkmenistan.php index 11004160a..18cb3a662 100644 --- a/src/Countries/Turkmenistan.php +++ b/src/Countries/Turkmenistan.php @@ -5,12 +5,11 @@ use Carbon\CarbonImmutable; use DateTime; use DateTimeZone; -use DateInterval; use IntlDateFormatter; class Turkmenistan extends Country { - protected string $timezone = "Asia/Ashgabat"; + protected string $timezone = 'Asia/Ashgabat'; public function countryCode(): string { @@ -47,7 +46,7 @@ protected function islamicCalendar(string $input, int $year, $nextYear = false): $hijriYear = $this->getHijriYear(year: $year, nextYear: $nextYear); $formatter = $this->getIslamicFormatter(); - $timeStamp = $formatter->parse($input . '/' . $hijriYear . ' AH'); + $timeStamp = $formatter->parse($input.'/'.$hijriYear.' AH'); $dateTime = date_create()->setTimeStamp($timeStamp)->setTimezone(new DateTimeZone($this->timezone)); return $dateTime->format('m-d'); @@ -68,7 +67,7 @@ protected function getHijriYear(int $year, $nextYear = false): int { $formatter = $this->getIslamicFormatter(); $formatter->setPattern('yyyy'); - $dateTime = DateTime::createFromFormat('d/m/Y', '01/01/' . ($nextYear ? $year + 1 : $year)); + $dateTime = DateTime::createFromFormat('d/m/Y', '01/01/'.($nextYear ? $year + 1 : $year)); return (int) $formatter->format($dateTime); } From f2514d60fcd8fd20951afe48a98bdedacdefd618 Mon Sep 17 00:00:00 2001 From: freekmurze Date: Tue, 23 Jan 2024 14:35:32 +0000 Subject: [PATCH 074/127] Update CHANGELOG --- CHANGELOG.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cdd8fd19..14dc75264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,55 @@ All notable changes to `holidays` will be documented in this file. +## 1.2.0 - 2024-01-23 + +### What's Changed + +* Added Dominican Republic holidays by @KiritoXD01 in https://github.com/spatie/holidays/pull/57 +* Added pint package by @thecaliskan in https://github.com/spatie/holidays/pull/149 +* Polish holidays by @srsbiz in https://github.com/spatie/holidays/pull/154 +* Add Support for Liechtenstein by @Martin-Welte in https://github.com/spatie/holidays/pull/33 +* test: update liechtenstein snapshot by @Martin-Welte in https://github.com/spatie/holidays/pull/164 +* Added Haiti holidays by @ivanmercedes in https://github.com/spatie/holidays/pull/148 +* Add Romanian Holidays by @florinp in https://github.com/spatie/holidays/pull/27 +* Add Guatemala holidays by @ejchiroy in https://github.com/spatie/holidays/pull/106 +* Add holidays for Luxembourg by @UrbinCedric in https://github.com/spatie/holidays/pull/165 +* Add holidays for South Africa by @pierredup in https://github.com/spatie/holidays/pull/30 +* Add Peru holidays by @dlopez525 in https://github.com/spatie/holidays/pull/54 +* Update Dutch holidays by @ndijkstra in https://github.com/spatie/holidays/pull/67 +* Added historical data for Czechia by @inDeev in https://github.com/spatie/holidays/pull/159 +* Add Greece holidays by @lowv-developer in https://github.com/spatie/holidays/pull/114 +* Add 🇽🇰Kosovo🇽🇰 Holidays by @AvdylKrasniqi in https://github.com/spatie/holidays/pull/151 +* Feature/add panama holidays by @amitsamtani in https://github.com/spatie/holidays/pull/147 +* Add Norway Holidays by @Tor2r in https://github.com/spatie/holidays/pull/105 +* Add Lithuanian holidays by @eimantaaas in https://github.com/spatie/holidays/pull/163 +* Add Canadian Holidays by @thinkstylestudio in https://github.com/spatie/holidays/pull/41 +* Add Turkmenistan Holidays by @kakajansh in https://github.com/spatie/holidays/pull/96 + +### New Contributors + +* @KiritoXD01 made their first contribution in https://github.com/spatie/holidays/pull/57 +* @thecaliskan made their first contribution in https://github.com/spatie/holidays/pull/149 +* @srsbiz made their first contribution in https://github.com/spatie/holidays/pull/154 +* @Martin-Welte made their first contribution in https://github.com/spatie/holidays/pull/33 +* @ivanmercedes made their first contribution in https://github.com/spatie/holidays/pull/148 +* @florinp made their first contribution in https://github.com/spatie/holidays/pull/27 +* @ejchiroy made their first contribution in https://github.com/spatie/holidays/pull/106 +* @UrbinCedric made their first contribution in https://github.com/spatie/holidays/pull/165 +* @pierredup made their first contribution in https://github.com/spatie/holidays/pull/30 +* @dlopez525 made their first contribution in https://github.com/spatie/holidays/pull/54 +* @ndijkstra made their first contribution in https://github.com/spatie/holidays/pull/67 +* @inDeev made their first contribution in https://github.com/spatie/holidays/pull/159 +* @lowv-developer made their first contribution in https://github.com/spatie/holidays/pull/114 +* @AvdylKrasniqi made their first contribution in https://github.com/spatie/holidays/pull/151 +* @amitsamtani made their first contribution in https://github.com/spatie/holidays/pull/147 +* @Tor2r made their first contribution in https://github.com/spatie/holidays/pull/105 +* @eimantaaas made their first contribution in https://github.com/spatie/holidays/pull/163 +* @thinkstylestudio made their first contribution in https://github.com/spatie/holidays/pull/41 +* @kakajansh made their first contribution in https://github.com/spatie/holidays/pull/96 + +**Full Changelog**: https://github.com/spatie/holidays/compare/1.1.0...1.2.0 + ## 1.1.0 - 2024-01-19 ### What's Changed From faf0451c97f71a58b3420b881599a87a6822eb42 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:41:10 +0100 Subject: [PATCH 075/127] phpstan fixes --- phpstan-baseline.neon | 10 ++++++++++ src/Countries/Turkmenistan.php | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 46ce0ede4..d237ce635 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -25,6 +25,16 @@ parameters: count: 1 path: src/Countries/Country.php + - + message: "#^Cannot call method setTimeStamp\\(\\) on DateTime\\|false\\.$#" + count: 1 + path: src/Countries/Turkmenistan.php + + - + message: "#^Parameter \\#1 \\$datetime of method IntlDateFormatter\\:\\:format\\(\\) expects array\\|DateTimeInterface\\|float\\|int\\|IntlCalendar\\|string, DateTime\\|false given\\.$#" + count: 1 + path: src/Countries/Turkmenistan.php + - message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(Carbon\\\\CarbonImmutable\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: non\\-falsy\\-string given\\.$#" count: 1 diff --git a/src/Countries/Turkmenistan.php b/src/Countries/Turkmenistan.php index 18cb3a662..b9bf8b33e 100644 --- a/src/Countries/Turkmenistan.php +++ b/src/Countries/Turkmenistan.php @@ -30,7 +30,7 @@ protected function allHolidays(int $year): array ], $this->variableHolidays($year)); } - /** @return array */ + /** @return array */ protected function variableHolidays(int $year): array { return [ @@ -41,7 +41,7 @@ protected function variableHolidays(int $year): array ]; } - protected function islamicCalendar(string $input, int $year, $nextYear = false): string + protected function islamicCalendar(string $input, int $year, bool $nextYear = false): string { $hijriYear = $this->getHijriYear(year: $year, nextYear: $nextYear); $formatter = $this->getIslamicFormatter(); @@ -63,7 +63,7 @@ protected function getIslamicFormatter(): IntlDateFormatter ); } - protected function getHijriYear(int $year, $nextYear = false): int + protected function getHijriYear(int $year, bool $nextYear = false): int { $formatter = $this->getIslamicFormatter(); $formatter->setPattern('yyyy'); From 6455e422bc9d8522c945a7c0039957c3b48372d1 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Tue, 23 Jan 2024 14:41:31 +0000 Subject: [PATCH 076/127] Fix styling --- src/Countries/Turkmenistan.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Countries/Turkmenistan.php b/src/Countries/Turkmenistan.php index b9bf8b33e..cd2076091 100644 --- a/src/Countries/Turkmenistan.php +++ b/src/Countries/Turkmenistan.php @@ -2,7 +2,6 @@ namespace Spatie\Holidays\Countries; -use Carbon\CarbonImmutable; use DateTime; use DateTimeZone; use IntlDateFormatter; From 18f71ca0e0d2a635e8366e0b49b9963de6c517d4 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:43:31 +0100 Subject: [PATCH 077/127] fix tests for Canada --- src/Countries/Canada.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index 1925fb2ca..52ea0e958 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'ca'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge( @@ -39,11 +38,10 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easterSunday = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('America/Toronto'); + $easter = $this->easter($year); - $goodFriday = $easterSunday->subDays(2); - $easterMonday = $easterSunday->addDays(1); + $goodFriday = $easter->subDays(2); + $easterMonday = $easter->addDay(); $victoriaDay = new CarbonImmutable("last monday of May $year", 'America/Toronto'); if ($victoriaDay->day < 25) { From 437a90a8a4208b79892334376a6cb6f0c90e8d16 Mon Sep 17 00:00:00 2001 From: Peter Khomyn Date: Tue, 23 Jan 2024 16:44:53 +0200 Subject: [PATCH 078/127] Add Ukrainian holidays (#112) * Add Ukrainian Holidays * correct country code * correct country code * Update Ukraine.php --- src/Countries/Ukraine.php | 39 ++++++++++++++++ .../it_can_calculate_ukrainian_holidays.snap | 46 +++++++++++++++++++ tests/Countries/UkraineTest.php | 19 ++++++++ 3 files changed, 104 insertions(+) create mode 100644 src/Countries/Ukraine.php create mode 100644 tests/.pest/snapshots/Countries/UkraineTest/it_can_calculate_ukrainian_holidays.snap create mode 100644 tests/Countries/UkraineTest.php diff --git a/src/Countries/Ukraine.php b/src/Countries/Ukraine.php new file mode 100644 index 000000000..0342bec09 --- /dev/null +++ b/src/Countries/Ukraine.php @@ -0,0 +1,39 @@ + '01-01', + 'Міжнародний жіночий день' => '03-08', + 'День праці' => '05-01', + 'День пам\'яті та перемоги над нацизмом у Другій світовій війні 1939 – 1945 років' => '05-08', + 'День Конституції України' => '06-28', + 'День Української Державності' => '07-15', + 'День Незалежності України' => '08-24', + 'День захисників і захисниць України' => '10-01', + 'Різдво Христове' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->orthodoxEaster($year); + + return [ + 'Великодній Понеділок' => $easter->addDay(), + 'Трійця' => $easter->addDays(50), + ]; + } +} \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/UkraineTest/it_can_calculate_ukrainian_holidays.snap b/tests/.pest/snapshots/Countries/UkraineTest/it_can_calculate_ukrainian_holidays.snap new file mode 100644 index 000000000..2539a9ca2 --- /dev/null +++ b/tests/.pest/snapshots/Countries/UkraineTest/it_can_calculate_ukrainian_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "\u041d\u043e\u0432\u0438\u0439 \u0420\u0456\u043a", + "date": "2024-01-01" + }, + { + "name": "\u041c\u0456\u0436\u043d\u0430\u0440\u043e\u0434\u043d\u0438\u0439 \u0436\u0456\u043d\u043e\u0447\u0438\u0439 \u0434\u0435\u043d\u044c", + "date": "2024-03-08" + }, + { + "name": "\u0414\u0435\u043d\u044c \u043f\u0440\u0430\u0446\u0456", + "date": "2024-05-01" + }, + { + "name": "\u0412\u0435\u043b\u0438\u043a\u043e\u0434\u043d\u0456\u0439 \u041f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a", + "date": "2024-05-06" + }, + { + "name": "\u0414\u0435\u043d\u044c \u043f\u0430\u043c'\u044f\u0442\u0456 \u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u043e\u0433\u0438 \u043d\u0430\u0434 \u043d\u0430\u0446\u0438\u0437\u043c\u043e\u043c \u0443 \u0414\u0440\u0443\u0433\u0456\u0439 \u0441\u0432\u0456\u0442\u043e\u0432\u0456\u0439 \u0432\u0456\u0439\u043d\u0456 1939 \u2013 1945 \u0440\u043e\u043a\u0456\u0432", + "date": "2024-05-08" + }, + { + "name": "\u0422\u0440\u0456\u0439\u0446\u044f", + "date": "2024-06-24" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041a\u043e\u043d\u0441\u0442\u0438\u0442\u0443\u0446\u0456\u0457 \u0423\u043a\u0440\u0430\u0457\u043d\u0438", + "date": "2024-06-28" + }, + { + "name": "\u0414\u0435\u043d\u044c \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u043e\u0457 \u0414\u0435\u0440\u0436\u0430\u0432\u043d\u043e\u0441\u0442\u0456", + "date": "2024-07-15" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041d\u0435\u0437\u0430\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0456 \u0423\u043a\u0440\u0430\u0457\u043d\u0438", + "date": "2024-08-24" + }, + { + "name": "\u0414\u0435\u043d\u044c \u0437\u0430\u0445\u0438\u0441\u043d\u0438\u043a\u0456\u0432 \u0456 \u0437\u0430\u0445\u0438\u0441\u043d\u0438\u0446\u044c \u0423\u043a\u0440\u0430\u0457\u043d\u0438", + "date": "2024-10-01" + }, + { + "name": "\u0420\u0456\u0437\u0434\u0432\u043e \u0425\u0440\u0438\u0441\u0442\u043e\u0432\u0435", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/UkraineTest.php b/tests/Countries/UkraineTest.php new file mode 100644 index 000000000..117a035c5 --- /dev/null +++ b/tests/Countries/UkraineTest.php @@ -0,0 +1,19 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); \ No newline at end of file From b2d0cbf1a5b249d3c5bb059d48970ed16271e05f Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Tue, 23 Jan 2024 14:45:13 +0000 Subject: [PATCH 079/127] Fix styling --- src/Countries/Ukraine.php | 2 +- tests/Countries/UkraineTest.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Countries/Ukraine.php b/src/Countries/Ukraine.php index 0342bec09..8c45f28a3 100644 --- a/src/Countries/Ukraine.php +++ b/src/Countries/Ukraine.php @@ -36,4 +36,4 @@ protected function variableHolidays(int $year): array 'Трійця' => $easter->addDays(50), ]; } -} \ No newline at end of file +} diff --git a/tests/Countries/UkraineTest.php b/tests/Countries/UkraineTest.php index 117a035c5..04e9b3115 100644 --- a/tests/Countries/UkraineTest.php +++ b/tests/Countries/UkraineTest.php @@ -3,7 +3,6 @@ namespace Spatie\Holidays\Tests\Countries; use Carbon\CarbonImmutable; -use Spatie\Holidays\Countries\Austria; use Spatie\Holidays\Holidays; it('can calculate ukrainian holidays', function () { @@ -16,4 +15,4 @@ ->not()->toBeEmpty(); expect(formatDates($holidays))->toMatchSnapshot(); -}); \ No newline at end of file +}); From 09360740bb253239f5a8dd4135117cecae7bfb17 Mon Sep 17 00:00:00 2001 From: Ivars Date: Tue, 23 Jan 2024 17:57:06 +0200 Subject: [PATCH 080/127] Add latvian holidays --- src/Countries/Latvia.php | 63 +++++++++++++++++++ .../it_can_calculate_latvian_holidays.snap | 58 +++++++++++++++++ tests/Countries/LatviaTest.php | 18 ++++++ 3 files changed, 139 insertions(+) create mode 100644 src/Countries/Latvia.php create mode 100644 tests/.pest/snapshots/Countries/LatviaTest/it_can_calculate_latvian_holidays.snap create mode 100644 tests/Countries/LatviaTest.php diff --git a/src/Countries/Latvia.php b/src/Countries/Latvia.php new file mode 100644 index 000000000..b9a29ad3e --- /dev/null +++ b/src/Countries/Latvia.php @@ -0,0 +1,63 @@ + '01-01', + 'Darba svētki' => '05-01', + 'Latvijas Republikas Neatkarības deklarācijas pasludināšanas diena' => '05-04', + 'Līgo diena' => '06-23', + 'Jāņu diena' => '06-24', + 'Latvijas Republikas proklamēšanas diena' => '11-18', + 'Ziemassvētku vakars' => '12-24', + 'Pirmie Ziemassvētki' => '12-25', + 'Otrie Ziemassvētki' => '12-26', + 'Vecgada vakars' => '12-31', + ], $this->variableHolidays($year), $this->postponedHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Lielā Piektdiena' => $easter->subDays(2), + 'Pirmās Lieldienas' => $easter, + 'Otrās Lieldienas' => $easter->addDay(), + ]; + } + + /** @return array */ + protected function postponedHolidays(int $year): array + { + // If the holidays - May 4 and November 18 - fall on a Saturday or Sunday, + // the next working day is designated as a holiday. + $holidays = []; + + $date = new CarbonImmutable(); + + $date = $date->setDate($year, 5, 4); + if($date->isWeekend()) { + $holidays['Pārceltā 4. maija brīvdiena'] = $date->nextWeekday()->format('m-d'); + } + + $date = $date->setDate($year, 11, 18); + if($date->isWeekend()) { + $holidays['Pārceltā 18. novembra brīvdiena'] = $date->nextWeekday()->format('m-d'); + } + + return $holidays; + } +} diff --git a/tests/.pest/snapshots/Countries/LatviaTest/it_can_calculate_latvian_holidays.snap b/tests/.pest/snapshots/Countries/LatviaTest/it_can_calculate_latvian_holidays.snap new file mode 100644 index 000000000..efe1c19fc --- /dev/null +++ b/tests/.pest/snapshots/Countries/LatviaTest/it_can_calculate_latvian_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "Jaunais gads", + "date": "2024-01-01" + }, + { + "name": "Liel\u0101 Piektdiena", + "date": "2024-03-29" + }, + { + "name": "Pirm\u0101s Lieldienas", + "date": "2024-03-31" + }, + { + "name": "Otr\u0101s Lieldienas", + "date": "2024-04-01" + }, + { + "name": "Darba sv\u0113tki", + "date": "2024-05-01" + }, + { + "name": "Latvijas Republikas Neatkar\u012bbas deklar\u0101cijas pasludin\u0101\u0161anas diena", + "date": "2024-05-04" + }, + { + "name": "P\u0101rcelt\u0101 4. maija br\u012bvdiena", + "date": "2024-05-06" + }, + { + "name": "L\u012bgo diena", + "date": "2024-06-23" + }, + { + "name": "J\u0101\u0146u diena", + "date": "2024-06-24" + }, + { + "name": "Latvijas Republikas proklam\u0113\u0161anas diena", + "date": "2024-11-18" + }, + { + "name": "Ziemassv\u0113tku vakars", + "date": "2024-12-24" + }, + { + "name": "Pirmie Ziemassv\u0113tki", + "date": "2024-12-25" + }, + { + "name": "Otrie Ziemassv\u0113tki", + "date": "2024-12-26" + }, + { + "name": "Vecgada vakars", + "date": "2024-12-31" + } +] \ No newline at end of file diff --git a/tests/Countries/LatviaTest.php b/tests/Countries/LatviaTest.php new file mode 100644 index 000000000..bce7acb68 --- /dev/null +++ b/tests/Countries/LatviaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 9aa2b302b5243363e52618897432f1120650702e Mon Sep 17 00:00:00 2001 From: thecaliskan Date: Tue, 23 Jan 2024 19:04:14 +0300 Subject: [PATCH 081/127] Added has helper --- README.md | 11 +++++++++++ src/Holidays.php | 5 +++++ tests/HolidaysTest.php | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/README.md b/README.md index 8bc3564e3..714dbff0c 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,17 @@ use Spatie\Holidays\Holidays; Holidays::for('be')->getName('2024-01-01'); // Nieuwjaar ``` +### Determining whether a country is supported + +If you need to check a country supported, you can use the `has` method. + +```php +use Spatie\Holidays\Holidays; + +Holidays::has('be'); // true +Holidays::has('unknown'); // false +``` + ### Package limitations 1. Islamic holidays are not supported (yet) diff --git a/src/Holidays.php b/src/Holidays.php index 775592df5..8b530b0b2 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -28,6 +28,11 @@ public static function for(Country|string $country, ?int $year = null): static return new static($country, $year); } + public static function has(string $country): bool + { + return Country::find($country) instanceof Country; + } + /** @return array */ public function get(Country|string|null $country = null, ?int $year = null): array { diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index 2477e6053..aa242162b 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -83,3 +83,11 @@ $result = Holidays::for('be')->getName(CarbonImmutable::parse('2024-01-02')); expect($result)->toBeNull(); }); + +it('can get the country is supported', function () { + $result = Holidays::has(country: 'be'); + expect($result)->toBeTrue(); + + $result = Holidays::has(country: 'unknown'); + expect($result)->toBeFalse(); +}); From e932a2d5ac9c4ccdf2ccfff6fec07cde88965bc9 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:28:16 +0100 Subject: [PATCH 082/127] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 714dbff0c..92128ddeb 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Holidays::for('be')->getName('2024-01-01'); // Nieuwjaar ### Determining whether a country is supported -If you need to check a country supported, you can use the `has` method. +To verify whether a country is supported, you can use the `has` method. ```php use Spatie\Holidays\Holidays; From d66e37598278a3b846c6e5f4e2b7b8194e593bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Stri=C5=A1ovsk=C3=BD?= Date: Tue, 23 Jan 2024 21:16:37 +0100 Subject: [PATCH 083/127] Use `easter()` method to calculate easter date from parent class --- src/Countries/Slovakia.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Countries/Slovakia.php b/src/Countries/Slovakia.php index c57ace0ae..32d21dccb 100644 --- a/src/Countries/Slovakia.php +++ b/src/Countries/Slovakia.php @@ -33,8 +33,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Bratislava'); + $easter = $this->easter($year); return [ 'Veľkonočný pondelok' => $easter->addDay(), From e96aab31994e6d1512a9977d465b11886e3c5add Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:47:07 +0100 Subject: [PATCH 084/127] check on null instead of object --- src/Holidays.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Holidays.php b/src/Holidays.php index 8b530b0b2..4cc9011a0 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -30,7 +30,7 @@ public static function for(Country|string $country, ?int $year = null): static public static function has(string $country): bool { - return Country::find($country) instanceof Country; + return Country::find($country) !== null; } /** @return array */ From b600a44ecf145885ce1ec9fd188bbb6c0b45bb0b Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 10:02:01 +0100 Subject: [PATCH 085/127] add locale to api --- src/Countries/Country.php | 7 ++++++- src/Holidays.php | 14 +++++++++++--- tests/HolidaysTest.php | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 3a09768db..78457455e 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -14,7 +14,7 @@ abstract public function countryCode(): string; abstract protected function allHolidays(int $year): array; /** @return array */ - public function get(int $year): array + public function get(int $year, ?string $locale = null): array { $this->ensureYearCanBeCalculated($year); @@ -90,6 +90,11 @@ public static function findOrFail(string $countryCode): Country return $country; } + protected function translate(string $name): string + { + return $name; + } + protected function ensureYearCanBeCalculated(int $year): void { /** diff --git a/src/Holidays.php b/src/Holidays.php index 4cc9011a0..76123011a 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -14,10 +14,11 @@ class Holidays protected function __construct( protected Country $country, protected int $year, + protected ?string $locale = null, ) { } - public static function for(Country|string $country, ?int $year = null): static + public static function for(Country|string $country, ?int $year = null, ?string $locale = null): static { $year ??= CarbonImmutable::now()->year; @@ -25,7 +26,7 @@ public static function for(Country|string $country, ?int $year = null): static $country = Country::findOrFail($country); } - return new static($country, $year); + return new static($country, $year, $locale); } public static function has(string $country): bool @@ -33,6 +34,13 @@ public static function has(string $country): bool return Country::find($country) !== null; } + public function locale(string $locale): static + { + $this->locale = $locale; + + return $this; + } + /** @return array */ public function get(Country|string|null $country = null, ?int $year = null): array { @@ -91,7 +99,7 @@ public function getName(CarbonInterface|string $date, Country|string|null $count protected function calculate(): self { - $this->holidays = $this->country->get($this->year); + $this->holidays = $this->country->get($this->year, $this->locale); return $this; } diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index aa242162b..8929ff433 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -91,3 +91,35 @@ $result = Holidays::has(country: 'unknown'); expect($result)->toBeFalse(); }); + +it('can get translated holiday names', function () { + $result = Holidays::for(country: 'be', year: 2020, locale: 'nl')->get(); + + expect($result) + ->toBeArray() + ->toContain('Nieuwjaar') + ->not()->toContain('jour de l\'An'); + + $result = Holidays::for(country: 'be', year: 2020, locale: 'fr')->get(); + + expect($result) + ->toBeArray() + ->toContain('jour de l\'An') + ->not()->toContain('Nieuwjaar'); +}); + +it('can get translated holiday names by calling the locale method', function () { + $result = Holidays::for('be')->locale('nl')->get(); + + expect($result) + ->toBeArray() + ->toContain('Nieuwjaar') + ->not()->toContain('jour de l\'An'); + + $result = Holidays::for('be')->locale('fr')->get(); + + expect($result) + ->toBeArray() + ->toContain('jour de l\'An') + ->not()->toContain('Nieuwjaar'); +}); From 1ec5d8d117f7b1292eccd41a2705dac5f1b0bf90 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 10:02:45 +0100 Subject: [PATCH 086/127] remove locale setter not using this for country and year either --- src/Holidays.php | 7 ------- tests/HolidaysTest.php | 16 ---------------- 2 files changed, 23 deletions(-) diff --git a/src/Holidays.php b/src/Holidays.php index 76123011a..ee2accb98 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -34,13 +34,6 @@ public static function has(string $country): bool return Country::find($country) !== null; } - public function locale(string $locale): static - { - $this->locale = $locale; - - return $this; - } - /** @return array */ public function get(Country|string|null $country = null, ?int $year = null): array { diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index 8929ff433..7367908b7 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -107,19 +107,3 @@ ->toContain('jour de l\'An') ->not()->toContain('Nieuwjaar'); }); - -it('can get translated holiday names by calling the locale method', function () { - $result = Holidays::for('be')->locale('nl')->get(); - - expect($result) - ->toBeArray() - ->toContain('Nieuwjaar') - ->not()->toContain('jour de l\'An'); - - $result = Holidays::for('be')->locale('fr')->get(); - - expect($result) - ->toBeArray() - ->toContain('jour de l\'An') - ->not()->toContain('Nieuwjaar'); -}); From 28ac2927d130a539c7caaf8844a8ec28c78a8a2c Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:55:44 +0100 Subject: [PATCH 087/127] add translations in french for Belgium --- lang/belgium/fr/holidays.json | 12 ++++++ src/Concerns/Translatable.php | 30 +++++++++++++ src/Countries/Country.php | 21 +++++----- src/Holidays.php | 3 +- .../it_can_get_translated_holiday_names.snap | 42 +++++++++++++++++++ tests/HolidaysTest.php | 12 +----- 6 files changed, 98 insertions(+), 22 deletions(-) create mode 100644 lang/belgium/fr/holidays.json create mode 100644 src/Concerns/Translatable.php create mode 100644 tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap diff --git a/lang/belgium/fr/holidays.json b/lang/belgium/fr/holidays.json new file mode 100644 index 000000000..4232e2d7d --- /dev/null +++ b/lang/belgium/fr/holidays.json @@ -0,0 +1,12 @@ +{ + "Nieuwjaar": "Jour de l'An", + "Dag van de Arbeid": "Fête du Travail", + "Nationale Feestdag": "Fête nationale", + "OLV Hemelvaart": "Assomption", + "Allerheiligen": "Toussaint", + "Wapenstilstand": "Armistice", + "Kerstmis": "Noël", + "Paasmaandag": "Lundi de Pâques", + "OLH Hemelvaart": "Ascension", + "Pinkstermaandag": "Lundi de Pentecôte" +} diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php new file mode 100644 index 000000000..41df04cff --- /dev/null +++ b/src/Concerns/Translatable.php @@ -0,0 +1,30 @@ + */ @@ -20,19 +23,22 @@ public function get(int $year, ?string $locale = null): array $allHolidays = $this->allHolidays($year); - $allHolidays = array_map(function ($date) use ($year) { + $translatedHolidays = []; + foreach ($allHolidays as $name => $date) { if (is_string($date)) { $date = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$date}"); } - return $date; - }, $allHolidays); + $name = $this->translate(basename(str_replace('\\', '/', static::class)), $name, $locale); + + $translatedHolidays[$name] = $date; + } - uasort($allHolidays, + uasort($translatedHolidays, fn (CarbonImmutable $a, CarbonImmutable $b) => $a->timestamp <=> $b->timestamp ); - return $allHolidays; + return $translatedHolidays; } public static function make(): static @@ -90,11 +96,6 @@ public static function findOrFail(string $countryCode): Country return $country; } - protected function translate(string $name): string - { - return $name; - } - protected function ensureYearCanBeCalculated(int $year): void { /** diff --git a/src/Holidays.php b/src/Holidays.php index ee2accb98..b526308ac 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -39,8 +39,9 @@ public function get(Country|string|null $country = null, ?int $year = null): arr { $country ??= $this->country; $year ??= $this->year; + $locale ??= $this->locale; - return static::for($country, $year) + return static::for($country, $year, $locale) ->calculate() ->toArray(); } diff --git a/tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap b/tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap new file mode 100644 index 000000000..037a0d8f2 --- /dev/null +++ b/tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Jour de l'An", + "date": "2020-01-01" + }, + { + "name": "Lundi de P\u00e2ques", + "date": "2020-04-13" + }, + { + "name": "F\u00eate du Travail", + "date": "2020-05-01" + }, + { + "name": "Ascension", + "date": "2020-05-21" + }, + { + "name": "Lundi de Pentec\u00f4te", + "date": "2020-06-01" + }, + { + "name": "F\u00eate nationale", + "date": "2020-07-21" + }, + { + "name": "Assomption", + "date": "2020-08-15" + }, + { + "name": "Toussaint", + "date": "2020-11-01" + }, + { + "name": "Armistice", + "date": "2020-11-11" + }, + { + "name": "No\u00ebl", + "date": "2020-12-25" + } +] \ No newline at end of file diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index 7367908b7..a74c54016 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -93,17 +93,7 @@ }); it('can get translated holiday names', function () { - $result = Holidays::for(country: 'be', year: 2020, locale: 'nl')->get(); - - expect($result) - ->toBeArray() - ->toContain('Nieuwjaar') - ->not()->toContain('jour de l\'An'); - $result = Holidays::for(country: 'be', year: 2020, locale: 'fr')->get(); - expect($result) - ->toBeArray() - ->toContain('jour de l\'An') - ->not()->toContain('Nieuwjaar'); + expect(formatDates($result))->toMatchSnapshot(); }); From bf14f45cfc4a7a941826c72b3b214f76e4667890 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:58:08 +0100 Subject: [PATCH 088/127] cleanup --- src/Concerns/Translatable.php | 1 + src/Holidays.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php index 41df04cff..3da140448 100644 --- a/src/Concerns/Translatable.php +++ b/src/Concerns/Translatable.php @@ -19,6 +19,7 @@ protected function translate(string $country, string $name, ?string $locale = nu return $name; } + /** @var array $data */ $data = json_decode($content, true); if (! isset($data[$name])) { diff --git a/src/Holidays.php b/src/Holidays.php index b526308ac..4f27a579e 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -39,9 +39,8 @@ public function get(Country|string|null $country = null, ?int $year = null): arr { $country ??= $this->country; $year ??= $this->year; - $locale ??= $this->locale; - return static::for($country, $year, $locale) + return static::for($country, $year, $this->locale) ->calculate() ->toArray(); } From cb5cfec333cc73cbc31c977ef2b714d3a0978239 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 10:58:33 +0000 Subject: [PATCH 089/127] Fix styling --- src/Concerns/Translatable.php | 2 +- tests/HolidaysTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php index 3da140448..68877cb3b 100644 --- a/src/Concerns/Translatable.php +++ b/src/Concerns/Translatable.php @@ -13,7 +13,7 @@ protected function translate(string $country, string $name, ?string $locale = nu $countryName = strtolower($country); - $content = file_get_contents(__DIR__ . "/../../lang/{$countryName}/{$locale}/holidays.json"); + $content = file_get_contents(__DIR__."/../../lang/{$countryName}/{$locale}/holidays.json"); if ($content === false) { return $name; diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index a74c54016..f6487f5cf 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -92,7 +92,7 @@ expect($result)->toBeFalse(); }); -it('can get translated holiday names', function () { +it('can get translated holiday names', function () { $result = Holidays::for(country: 'be', year: 2020, locale: 'fr')->get(); expect(formatDates($result))->toMatchSnapshot(); From 1a3b1361afb072bf6c7ed2b912848f74b4624789 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:58:08 +0100 Subject: [PATCH 090/127] cleanup --- src/Concerns/Translatable.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php index 68877cb3b..d8e7af489 100644 --- a/src/Concerns/Translatable.php +++ b/src/Concerns/Translatable.php @@ -2,7 +2,6 @@ namespace Spatie\Holidays\Concerns; -/** @ */ trait Translatable { protected function translate(string $country, string $name, ?string $locale = null): string From 59cca7b4ba7f861d1576fc3607212f377e86fd5e Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:36:57 +0100 Subject: [PATCH 091/127] update readme and throw exception when needed --- README.md | 11 +++++++++++ src/Concerns/Translatable.php | 4 +++- src/Exceptions/InvalidLocale.php | 13 +++++++++++++ tests/HolidaysTest.php | 5 +++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/Exceptions/InvalidLocale.php diff --git a/README.md b/README.md index 92128ddeb..508e61d5b 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,16 @@ use Spatie\Holidays\Holidays; $holidays = Holidays::for(country: 'be', year: 2024))->get(); ``` +### Getting holidays in a specific language + +```php +use Spatie\Holidays\Holidays; + +$holidays = Holidays::for(country: 'be', locale: 'fr'))->get(); +``` + +If the locale is not supported for a country, an exception will be thrown. + ### Determining if a date is a holiday If you need to see if a date is a holiday, you can use the `isHoliday` method. @@ -112,6 +122,7 @@ This is a community driven package. If you find any errors, please create an iss 2. Add a test for the new country in the `tests` directory. 3. Run the tests so a snapshot gets created. 4. Verify the result in the newly created snapshot is correct. +5. If the country has multiple languages, add a file in the `lang/` directory. In case your country has specific rules for calculating holidays, for example region specific holidays, you can pass this to the constructor of your country class. diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php index d8e7af489..0c65b5f7a 100644 --- a/src/Concerns/Translatable.php +++ b/src/Concerns/Translatable.php @@ -2,6 +2,8 @@ namespace Spatie\Holidays\Concerns; +use Spatie\Holidays\Exceptions\InvalidLocale; + trait Translatable { protected function translate(string $country, string $name, ?string $locale = null): string @@ -15,7 +17,7 @@ protected function translate(string $country, string $name, ?string $locale = nu $content = file_get_contents(__DIR__."/../../lang/{$countryName}/{$locale}/holidays.json"); if ($content === false) { - return $name; + throw InvalidLocale::notFound($country, $locale); } /** @var array $data */ diff --git a/src/Exceptions/InvalidLocale.php b/src/Exceptions/InvalidLocale.php new file mode 100644 index 000000000..1d34fc8d3 --- /dev/null +++ b/src/Exceptions/InvalidLocale.php @@ -0,0 +1,13 @@ +toMatchSnapshot(); }); + +it('cannot get translated holiday names for unsupported locales', function () { + Holidays::for(country: 'be', year: 2020, locale: 'en')->get(); +})->throws(InvalidLocale::class, 'Locale `en` is not supported for country `Belgium`.'); From 52aef70b7dc47e23fb0c9821be66f6d2858c4919 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 11:37:35 +0000 Subject: [PATCH 092/127] Fix styling --- tests/HolidaysTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index bec1aeab3..6d0b2b317 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -99,6 +99,6 @@ expect(formatDates($result))->toMatchSnapshot(); }); -it('cannot get translated holiday names for unsupported locales', function () { +it('cannot get translated holiday names for unsupported locales', function () { Holidays::for(country: 'be', year: 2020, locale: 'en')->get(); })->throws(InvalidLocale::class, 'Locale `en` is not supported for country `Belgium`.'); From faf22be7976c1f56505ba4aa69447db81c212db9 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:39:52 +0100 Subject: [PATCH 093/127] remove snapshot --- .../it_can_get_translated_holiday_names.snap | 42 ------------------- tests/HolidaysTest.php | 3 +- 2 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap diff --git a/tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap b/tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap deleted file mode 100644 index 037a0d8f2..000000000 --- a/tests/.pest/snapshots/HolidaysTest/it_can_get_translated_holiday_names.snap +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "name": "Jour de l'An", - "date": "2020-01-01" - }, - { - "name": "Lundi de P\u00e2ques", - "date": "2020-04-13" - }, - { - "name": "F\u00eate du Travail", - "date": "2020-05-01" - }, - { - "name": "Ascension", - "date": "2020-05-21" - }, - { - "name": "Lundi de Pentec\u00f4te", - "date": "2020-06-01" - }, - { - "name": "F\u00eate nationale", - "date": "2020-07-21" - }, - { - "name": "Assomption", - "date": "2020-08-15" - }, - { - "name": "Toussaint", - "date": "2020-11-01" - }, - { - "name": "Armistice", - "date": "2020-11-11" - }, - { - "name": "No\u00ebl", - "date": "2020-12-25" - } -] \ No newline at end of file diff --git a/tests/HolidaysTest.php b/tests/HolidaysTest.php index 6d0b2b317..c09d7db67 100644 --- a/tests/HolidaysTest.php +++ b/tests/HolidaysTest.php @@ -96,7 +96,8 @@ it('can get translated holiday names', function () { $result = Holidays::for(country: 'be', year: 2020, locale: 'fr')->get(); - expect(formatDates($result))->toMatchSnapshot(); + expect($result)->toBeArray(); + expect($result[0]['name'])->toBe('Jour de l\'An'); }); it('cannot get translated holiday names for unsupported locales', function () { From eb85b1f3e22fcd26f146a6fa5398209d085e1181 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 12:22:52 +0000 Subject: [PATCH 094/127] Fix styling --- src/Countries/Latvia.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Countries/Latvia.php b/src/Countries/Latvia.php index b9a29ad3e..b5c088605 100644 --- a/src/Countries/Latvia.php +++ b/src/Countries/Latvia.php @@ -49,12 +49,12 @@ protected function postponedHolidays(int $year): array $date = new CarbonImmutable(); $date = $date->setDate($year, 5, 4); - if($date->isWeekend()) { + if ($date->isWeekend()) { $holidays['Pārceltā 4. maija brīvdiena'] = $date->nextWeekday()->format('m-d'); } $date = $date->setDate($year, 11, 18); - if($date->isWeekend()) { + if ($date->isWeekend()) { $holidays['Pārceltā 18. novembra brīvdiena'] = $date->nextWeekday()->format('m-d'); } From 82afddc1dbc1eca374427c77755bd37cd23580e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Le=C3=B3n=20Torres?= <47951932+alvleont@users.noreply.github.com> Date: Wed, 24 Jan 2024 07:43:50 -0500 Subject: [PATCH 095/127] Added Colombia Holidays (#55) * Adding Colombia Holidays Added the Colombia's holidays. There's a situation with some holidays due to the "Emiliany Law" they are moved to the following monday. * Adding Colombia Holidays Added the Colombia's holidays. There's a situation with some holidays due to the "Emiliany Law" they are moved to the following monday. * Update Colombia.php Deleted the line as suggested by @Nielsvanpach * Update Colombia.php * Added changes to Colombia.php and to the test file - Suggestions from @luisprmat were incorporated. - All the work of emiliani holiday generation was included into the emilianiHoliday method to achieve code readability - The order of the holidays was updated to ensure that the next emiliani holiday that appears can be included at the end of the list. - The test was updated because it's "colombian holidays" not "colombia holidays" --- src/Countries/Colombia.php | 58 +++++++++++++++ .../it_can_calculate_colombian_holidays.snap | 74 +++++++++++++++++++ tests/Countries/ColombiaTest.php | 18 +++++ 3 files changed, 150 insertions(+) create mode 100644 src/Countries/Colombia.php create mode 100644 tests/.pest/snapshots/Countries/ColombiaTest/it_can_calculate_colombian_holidays.snap create mode 100644 tests/Countries/ColombiaTest.php diff --git a/src/Countries/Colombia.php b/src/Countries/Colombia.php new file mode 100644 index 000000000..e2430f76a --- /dev/null +++ b/src/Countries/Colombia.php @@ -0,0 +1,58 @@ + '01-01', + 'Día del Trabajo' => '05-01', + 'Día de la independencia' => '07-20', + 'Batalla de Boyacá' => '08-07', + 'Inmaculada Concepción' => '12-08', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + 'Ascención de Jesús' => $easter->addDays(43), + 'Corpus Christi' => $easter->addDays(64), + 'Sagrado corazón de Jesús' => $easter->addDays(71), + 'Reyes Magos' => $this->emilianiHoliday($year, 1, 6), + 'Día de San José' => $this->emilianiHoliday($year, 3, 19), + 'San Pedro y San Pablo' => $this->emilianiHoliday($year, 6, 29), + 'Asunción de la Virgen' => $this->emilianiHoliday($year, 8, 15), + 'Día de la raza' => $this->emilianiHoliday($year, 10, 12), + 'Todos los santos' => $this->emilianiHoliday($year, 11, 1), + 'Independencia de Cartagena' => $this->emilianiHoliday($year, 11, 11), + + ]; + } + + /** @return CarbonImmutable */ + private function emilianiHoliday(int $year, int $month, int $day): CarbonImmutable + { + $dateObj = CarbonImmutable::createFromDate($year, $month, $day, 'America/Bogota')->startOfDay(); + if ($dateObj->is('Monday')) { + return $dateObj; + } else { + return $dateObj->next('Monday'); + } + } +} diff --git a/tests/.pest/snapshots/Countries/ColombiaTest/it_can_calculate_colombian_holidays.snap b/tests/.pest/snapshots/Countries/ColombiaTest/it_can_calculate_colombian_holidays.snap new file mode 100644 index 000000000..38e611c25 --- /dev/null +++ b/tests/.pest/snapshots/Countries/ColombiaTest/it_can_calculate_colombian_holidays.snap @@ -0,0 +1,74 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "Reyes Magos", + "date": "2024-01-08" + }, + { + "name": "D\u00eda de San Jos\u00e9", + "date": "2024-03-25" + }, + { + "name": "Jueves Santo", + "date": "2024-03-28" + }, + { + "name": "Viernes Santo", + "date": "2024-03-29" + }, + { + "name": "D\u00eda del Trabajo", + "date": "2024-05-01" + }, + { + "name": "Ascenci\u00f3n de Jes\u00fas", + "date": "2024-05-13" + }, + { + "name": "Corpus Christi", + "date": "2024-06-03" + }, + { + "name": "Sagrado coraz\u00f3n de Jes\u00fas", + "date": "2024-06-10" + }, + { + "name": "San Pedro y San Pablo", + "date": "2024-07-01" + }, + { + "name": "D\u00eda de la independencia", + "date": "2024-07-20" + }, + { + "name": "Batalla de Boyac\u00e1", + "date": "2024-08-07" + }, + { + "name": "Asunci\u00f3n de la Virgen", + "date": "2024-08-19" + }, + { + "name": "D\u00eda de la raza", + "date": "2024-10-14" + }, + { + "name": "Todos los santos", + "date": "2024-11-04" + }, + { + "name": "Independencia de Cartagena", + "date": "2024-11-11" + }, + { + "name": "Inmaculada Concepci\u00f3n", + "date": "2024-12-08" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/ColombiaTest.php b/tests/Countries/ColombiaTest.php new file mode 100644 index 000000000..623ffd94b --- /dev/null +++ b/tests/Countries/ColombiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From cefdbaec0eb080cfd0cc2e2b94331291472cb860 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 12:44:13 +0000 Subject: [PATCH 096/127] Fix styling --- src/Countries/Colombia.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Countries/Colombia.php b/src/Countries/Colombia.php index e2430f76a..f3176f794 100644 --- a/src/Countries/Colombia.php +++ b/src/Countries/Colombia.php @@ -45,7 +45,6 @@ protected function variableHolidays(int $year): array ]; } - /** @return CarbonImmutable */ private function emilianiHoliday(int $year, int $month, int $day): CarbonImmutable { $dateObj = CarbonImmutable::createFromDate($year, $month, $day, 'America/Bogota')->startOfDay(); From 72c128082e1334414f416b2d969d8155d42bdbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conny=20Sj=C3=B6blom?= <34518404+ConnySjoblom@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:15:30 +0200 Subject: [PATCH 097/127] Add Finnish Holidays (#85) * Add holidays for Finland * Use createFromDate instead of create * Add holidays for Finland in Swedish --- lang/finland/sv/holidays.json | 15 ++++++ src/Countries/Finland.php | 54 +++++++++++++++++++ .../it_can_calculate_finnish_holidays.snap | 54 +++++++++++++++++++ ...t_can_get_finnish_holidays_in_swedish.snap | 54 +++++++++++++++++++ tests/Countries/FinlandTest.php | 32 +++++++++++ 5 files changed, 209 insertions(+) create mode 100644 lang/finland/sv/holidays.json create mode 100644 src/Countries/Finland.php create mode 100644 tests/.pest/snapshots/Countries/FinlandTest/it_can_calculate_finnish_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/FinlandTest/it_can_get_finnish_holidays_in_swedish.snap create mode 100644 tests/Countries/FinlandTest.php diff --git a/lang/finland/sv/holidays.json b/lang/finland/sv/holidays.json new file mode 100644 index 000000000..0baa6a4c5 --- /dev/null +++ b/lang/finland/sv/holidays.json @@ -0,0 +1,15 @@ +{ + "Uudenvuodenpäivä": "Nyårsdagen", + "Loppiainen": "Trettondagen", + "Pitkäperjantai": "Långfredagen", + "Pääsiäispäivä": "Påskdagen", + "Toinen pääsiäispäivä": "Annandag påsk", + "Vappu": "Första maj", + "Helatorstai": "Kristi himmelsfärdsdag", + "Helluntaipäivä": "Pingst", + "Juhannuspäivä": "Midsommardagen", + "Pyhäinpäivä": "Alla helgons dag", + "Itsenäisyyspäivä": "Självständighetsdagen", + "Joulupäivä": "Juldagen", + "Tapaninpäivä": "Annandag jul" +} diff --git a/src/Countries/Finland.php b/src/Countries/Finland.php new file mode 100644 index 000000000..103fda86f --- /dev/null +++ b/src/Countries/Finland.php @@ -0,0 +1,54 @@ +fixedHolidays($year), $this->variableHolidays($year)); + } + + /** @return array */ + protected function fixedHolidays(int $year): array + { + return [ + 'Uudenvuodenpäivä' => CarbonImmutable::createFromDate($year, 1, 1), + 'Loppiainen' => CarbonImmutable::createFromDate($year, 1, 6), + 'Vappu' => CarbonImmutable::createFromDate($year, 5, 1), + 'Itsenäisyyspäivä' => CarbonImmutable::createFromDate($year, 12, 6), + 'Joulupäivä' => CarbonImmutable::createFromDate($year, 12, 25), + 'Tapaninpäivä' => CarbonImmutable::createFromDate($year, 12, 26), + ]; + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Europe/Helsinki'); + + $midsummerDay = CarbonImmutable::createFromDate($year, 6, 20) + ->next(CarbonImmutable::SATURDAY); + + return [ + 'Pitkäperjantai' => $easter->subDays(2), + 'Pääsiäispäivä' => $easter, + 'Toinen pääsiäispäivä' => $easter->addDay(), + 'Helatorstai' => $easter->addDays(39), + 'Helluntaipäivä' => $easter->addDays(49), + 'Juhannuspäivä' => $midsummerDay->day > 26 + ? $midsummerDay->subWeek() + : $midsummerDay, + 'Pyhäinpäivä' => CarbonImmutable::createFromDate($year, 10, 31) + ->next(CarbonImmutable::SATURDAY), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/FinlandTest/it_can_calculate_finnish_holidays.snap b/tests/.pest/snapshots/Countries/FinlandTest/it_can_calculate_finnish_holidays.snap new file mode 100644 index 000000000..8a4f7a954 --- /dev/null +++ b/tests/.pest/snapshots/Countries/FinlandTest/it_can_calculate_finnish_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Uudenvuodenp\u00e4iv\u00e4", + "date": "2024-01-01" + }, + { + "name": "Loppiainen", + "date": "2024-01-06" + }, + { + "name": "Pitk\u00e4perjantai", + "date": "2024-03-29" + }, + { + "name": "P\u00e4\u00e4si\u00e4isp\u00e4iv\u00e4", + "date": "2024-03-31" + }, + { + "name": "Toinen p\u00e4\u00e4si\u00e4isp\u00e4iv\u00e4", + "date": "2024-04-01" + }, + { + "name": "Vappu", + "date": "2024-05-01" + }, + { + "name": "Helatorstai", + "date": "2024-05-09" + }, + { + "name": "Helluntaip\u00e4iv\u00e4", + "date": "2024-05-19" + }, + { + "name": "Juhannusp\u00e4iv\u00e4", + "date": "2024-06-22" + }, + { + "name": "Pyh\u00e4inp\u00e4iv\u00e4", + "date": "2024-11-02" + }, + { + "name": "Itsen\u00e4isyysp\u00e4iv\u00e4", + "date": "2024-12-06" + }, + { + "name": "Joulup\u00e4iv\u00e4", + "date": "2024-12-25" + }, + { + "name": "Tapaninp\u00e4iv\u00e4", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/FinlandTest/it_can_get_finnish_holidays_in_swedish.snap b/tests/.pest/snapshots/Countries/FinlandTest/it_can_get_finnish_holidays_in_swedish.snap new file mode 100644 index 000000000..7f852ccd4 --- /dev/null +++ b/tests/.pest/snapshots/Countries/FinlandTest/it_can_get_finnish_holidays_in_swedish.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Ny\u00e5rsdagen", + "date": "2024-01-01" + }, + { + "name": "Trettondagen", + "date": "2024-01-06" + }, + { + "name": "L\u00e5ngfredagen", + "date": "2024-03-29" + }, + { + "name": "P\u00e5skdagen", + "date": "2024-03-31" + }, + { + "name": "Annandag p\u00e5sk", + "date": "2024-04-01" + }, + { + "name": "F\u00f6rsta maj", + "date": "2024-05-01" + }, + { + "name": "Kristi himmelsf\u00e4rdsdag", + "date": "2024-05-09" + }, + { + "name": "Pingst", + "date": "2024-05-19" + }, + { + "name": "Midsommardagen", + "date": "2024-06-22" + }, + { + "name": "Alla helgons dag", + "date": "2024-11-02" + }, + { + "name": "Sj\u00e4lvst\u00e4ndighetsdagen", + "date": "2024-12-06" + }, + { + "name": "Juldagen", + "date": "2024-12-25" + }, + { + "name": "Annandag jul", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/FinlandTest.php b/tests/Countries/FinlandTest.php new file mode 100644 index 000000000..565dc1623 --- /dev/null +++ b/tests/Countries/FinlandTest.php @@ -0,0 +1,32 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); + +it('can get finnish holidays in swedish', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'fi', locale: 'sv')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); From 915f16a83c3e857869610d94e513534df11108fd Mon Sep 17 00:00:00 2001 From: Marc <108322460+mkokio@users.noreply.github.com> Date: Thu, 25 Jan 2024 00:17:37 +0900 Subject: [PATCH 098/127] Add Japan support (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Japan country support * Tested: it can calculate japanese holidays → Snapshot created --- src/Countries/Japan.php | 59 +++++++++++++++++ .../it_can_calculate_japanese_holidays.snap | 66 +++++++++++++++++++ tests/Countries/JapanTest.php | 18 +++++ 3 files changed, 143 insertions(+) create mode 100644 src/Countries/Japan.php create mode 100644 tests/.pest/snapshots/Countries/JapanTest/it_can_calculate_japanese_holidays.snap create mode 100644 tests/Countries/JapanTest.php diff --git a/src/Countries/Japan.php b/src/Countries/Japan.php new file mode 100644 index 000000000..07acee028 --- /dev/null +++ b/src/Countries/Japan.php @@ -0,0 +1,59 @@ + '01-01', // New Year's Day + '建国記念の日' => '02-11', // Foundation Day + '天皇誕生日' => '02-23', // Emperor's Birthday + '春分の日' => '03-20', // Vernal Equinox Day *Decided each year; rarely on 03-21 + '昭和の日' => '04-29', // Showa Day + '憲法記念日' => '05-03', // Constitution Day + 'みどりの日' => '05-04', // Greenery Day + 'こどもの日' => '05-05', // Children's Day + '山の日' => '08-11', // Mountain Day + '秋分の日' => '09-23', // Autumnal Equinox Day *Decided each year; rarely on 09-22 + '文化の日' => '11-03', // Culture Day + '勤労感謝の日' => '11-23', // Labor Thanksgiving Day + + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $comingOfAgeDay = (new CarbonImmutable("second monday of january $year")) // Coming of Age Day + ->setTimezone('Asia/Tokyo'); + + $oceansDay = (new CarbonImmutable("third monday of july $year")) // Ocean's Day + ->setTimezone('Asia/Tokyo'); + + $respectForTheAgedDay = (new CarbonImmutable("third monday of september $year")) // Respect for the Aged Day + ->setTimezone('Asia/Tokyo'); + + $sportsDay = (new CarbonImmutable("second monday of october $year")) // Sports Day + ->setTimezone('Asia/Tokyo'); + + $holidays = [ + '成人の日' => $comingOfAgeDay, + '海の日' => $oceansDay, + '敬老の日' => $respectForTheAgedDay, + 'スポーツの日' => $sportsDay, + ]; + + return $holidays; + + } + +} \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/JapanTest/it_can_calculate_japanese_holidays.snap b/tests/.pest/snapshots/Countries/JapanTest/it_can_calculate_japanese_holidays.snap new file mode 100644 index 000000000..5d86d702a --- /dev/null +++ b/tests/.pest/snapshots/Countries/JapanTest/it_can_calculate_japanese_holidays.snap @@ -0,0 +1,66 @@ +[ + { + "name": "\u5143\u65e5", + "date": "2024-01-01" + }, + { + "name": "\u6210\u4eba\u306e\u65e5", + "date": "2024-01-08" + }, + { + "name": "\u5efa\u56fd\u8a18\u5ff5\u306e\u65e5", + "date": "2024-02-11" + }, + { + "name": "\u5929\u7687\u8a95\u751f\u65e5", + "date": "2024-02-23" + }, + { + "name": "\u6625\u5206\u306e\u65e5", + "date": "2024-03-20" + }, + { + "name": "\u662d\u548c\u306e\u65e5", + "date": "2024-04-29" + }, + { + "name": "\u61b2\u6cd5\u8a18\u5ff5\u65e5", + "date": "2024-05-03" + }, + { + "name": "\u307f\u3069\u308a\u306e\u65e5", + "date": "2024-05-04" + }, + { + "name": "\u3053\u3069\u3082\u306e\u65e5", + "date": "2024-05-05" + }, + { + "name": "\u6d77\u306e\u65e5", + "date": "2024-07-15" + }, + { + "name": "\u5c71\u306e\u65e5", + "date": "2024-08-11" + }, + { + "name": "\u656c\u8001\u306e\u65e5", + "date": "2024-09-16" + }, + { + "name": "\u79cb\u5206\u306e\u65e5", + "date": "2024-09-23" + }, + { + "name": "\u30b9\u30dd\u30fc\u30c4\u306e\u65e5", + "date": "2024-10-14" + }, + { + "name": "\u6587\u5316\u306e\u65e5", + "date": "2024-11-03" + }, + { + "name": "\u52e4\u52b4\u611f\u8b1d\u306e\u65e5", + "date": "2024-11-23" + } +] \ No newline at end of file diff --git a/tests/Countries/JapanTest.php b/tests/Countries/JapanTest.php new file mode 100644 index 000000000..252cd24dc --- /dev/null +++ b/tests/Countries/JapanTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); \ No newline at end of file From 964e741fe6cbfe2a65428fd33fe3aee39ba26ed6 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 15:17:58 +0000 Subject: [PATCH 099/127] Fix styling --- src/Countries/Japan.php | 9 ++++----- tests/Countries/JapanTest.php | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Countries/Japan.php b/src/Countries/Japan.php index 07acee028..38b1bc7d5 100644 --- a/src/Countries/Japan.php +++ b/src/Countries/Japan.php @@ -26,7 +26,7 @@ protected function allHolidays(int $year): array '秋分の日' => '09-23', // Autumnal Equinox Day *Decided each year; rarely on 09-22 '文化の日' => '11-03', // Culture Day '勤労感謝の日' => '11-23', // Labor Thanksgiving Day - + ], $this->variableHolidays($year)); } @@ -41,9 +41,9 @@ protected function variableHolidays(int $year): array $respectForTheAgedDay = (new CarbonImmutable("third monday of september $year")) // Respect for the Aged Day ->setTimezone('Asia/Tokyo'); - + $sportsDay = (new CarbonImmutable("second monday of october $year")) // Sports Day - ->setTimezone('Asia/Tokyo'); + ->setTimezone('Asia/Tokyo'); $holidays = [ '成人の日' => $comingOfAgeDay, @@ -55,5 +55,4 @@ protected function variableHolidays(int $year): array return $holidays; } - -} \ No newline at end of file +} diff --git a/tests/Countries/JapanTest.php b/tests/Countries/JapanTest.php index 252cd24dc..3a948815e 100644 --- a/tests/Countries/JapanTest.php +++ b/tests/Countries/JapanTest.php @@ -15,4 +15,4 @@ ->not()->toBeEmpty(); expect(formatDates($holidays))->toMatchSnapshot(); -}); \ No newline at end of file +}); From 95f9772ddb23dea99124815dc81b27628b5b72a4 Mon Sep 17 00:00:00 2001 From: Anand Capur <551002+arcdigital@users.noreply.github.com> Date: Wed, 24 Jan 2024 07:19:23 -0800 Subject: [PATCH 100/127] Add US Holidays (#26) --- src/Countries/UnitedStates.php | 49 +++++++++++++++++++ ...ate_united_states_holidays_after_2021.snap | 46 +++++++++++++++++ ...te_united_states_holidays_before_2021.snap | 42 ++++++++++++++++ tests/Countries/UnitedStatesTest.php | 32 ++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 src/Countries/UnitedStates.php create mode 100644 tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_after_2021.snap create mode 100644 tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_before_2021.snap create mode 100644 tests/Countries/UnitedStatesTest.php diff --git a/src/Countries/UnitedStates.php b/src/Countries/UnitedStates.php new file mode 100644 index 000000000..695103dca --- /dev/null +++ b/src/Countries/UnitedStates.php @@ -0,0 +1,49 @@ + '01-01', + 'Independence Day' => '07-04', + 'Veterans Day' => '11-11', + 'Christmas' => '12-25', + ], $this->variableHolidays($year)); + + if ($year >= 2021) { + $holidays['Juneteenth National Independence Day'] = '06-19'; + } + + return $holidays; + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $martinLutherKingDay = new CarbonImmutable("third monday of January $year", 'America/Los_Angeles'); + $presidentsDay = new CarbonImmutable("third monday of February $year", 'America/Los_Angeles'); + $memorialDay = new CarbonImmutable("last monday of May $year", 'America/Los_Angeles'); + $laborDay = new CarbonImmutable("first monday of September $year", 'America/Los_Angeles'); + $columbusDay = new CarbonImmutable("second monday of October $year", 'America/Los_Angeles'); + $thanksgiving = new CarbonImmutable("fourth thursday of November $year", 'America/Los_Angeles'); + + return [ + 'Martin Luther King Day' => $martinLutherKingDay, + 'Presidents\' Day' => $presidentsDay, + 'Memorial Day' => $memorialDay, + 'Labor Day' => $laborDay, + 'Columbus Day' => $columbusDay, + 'Thanksgiving' => $thanksgiving, + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_after_2021.snap b/tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_after_2021.snap new file mode 100644 index 000000000..41227b5c4 --- /dev/null +++ b/tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_after_2021.snap @@ -0,0 +1,46 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Martin Luther King Day", + "date": "2024-01-15" + }, + { + "name": "Presidents' Day", + "date": "2024-02-19" + }, + { + "name": "Memorial Day", + "date": "2024-05-27" + }, + { + "name": "Juneteenth National Independence Day", + "date": "2024-06-19" + }, + { + "name": "Independence Day", + "date": "2024-07-04" + }, + { + "name": "Labor Day", + "date": "2024-09-02" + }, + { + "name": "Columbus Day", + "date": "2024-10-14" + }, + { + "name": "Veterans Day", + "date": "2024-11-11" + }, + { + "name": "Thanksgiving", + "date": "2024-11-28" + }, + { + "name": "Christmas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_before_2021.snap b/tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_before_2021.snap new file mode 100644 index 000000000..5d92494f7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/UnitedStatesTest/it_can_calculate_united_states_holidays_before_2021.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2020-01-01" + }, + { + "name": "Martin Luther King Day", + "date": "2020-01-20" + }, + { + "name": "Presidents' Day", + "date": "2020-02-17" + }, + { + "name": "Memorial Day", + "date": "2020-05-25" + }, + { + "name": "Independence Day", + "date": "2020-07-04" + }, + { + "name": "Labor Day", + "date": "2020-09-07" + }, + { + "name": "Columbus Day", + "date": "2020-10-12" + }, + { + "name": "Veterans Day", + "date": "2020-11-11" + }, + { + "name": "Thanksgiving", + "date": "2020-11-26" + }, + { + "name": "Christmas", + "date": "2020-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/UnitedStatesTest.php b/tests/Countries/UnitedStatesTest.php new file mode 100644 index 000000000..bdf277d2f --- /dev/null +++ b/tests/Countries/UnitedStatesTest.php @@ -0,0 +1,32 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); + +it('can calculate united states holidays before 2021', function () { + CarbonImmutable::setTestNowAndTimezone('2020-01-01'); + + $holidays = Holidays::for(country: 'us')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); From e82a37e1456166ec4a4b34024b7d9f2bc670b611 Mon Sep 17 00:00:00 2001 From: Nikola Zivkovic Date: Wed, 24 Jan 2024 16:29:44 +0100 Subject: [PATCH 101/127] Add Serbian holidays (#107) * Add Serbian holidays * Calculate orthodox easter * Improve phpstan * Fix test * Expand list with Christmas and Easter --- src/Countries/Serbia.php | 54 +++++++++++++++++++ .../it_can_calculate_serbian_holidays.snap | 46 ++++++++++++++++ tests/Countries/SerbiaTest.php | 18 +++++++ 3 files changed, 118 insertions(+) create mode 100644 src/Countries/Serbia.php create mode 100644 tests/.pest/snapshots/Countries/SerbiaTest/it_can_calculate_serbian_holidays.snap create mode 100644 tests/Countries/SerbiaTest.php diff --git a/src/Countries/Serbia.php b/src/Countries/Serbia.php new file mode 100644 index 000000000..adbea34ce --- /dev/null +++ b/src/Countries/Serbia.php @@ -0,0 +1,54 @@ + '01-01', + 'Nova godina - drugi dan' => '01-02', + 'Božić' => '01-07', + 'Dan državnosti - prvi dan' => '02-15', + 'Dan državnosti - drugi dan' => '02-16', + 'Praznik rada - prvi dan' => '05-01', + 'Praznik rada - drugi dan' => '05-02', + 'Dan primirja u Prvom svetskom ratu' => '11-11', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp( + $this->orthodoxEaster($year) + )->setTimezone('Europe/Belgrade'); + + return [ + 'Veliki petak' => $easter->subDays(2), + 'Vaskrs' => $easter, + 'Vaskršnji ponedeljak' => $easter->addDay(), + ]; + } + + protected function orthodoxEaster(int $year): int + { + $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); + $daysDifference = (int)($year / 100) - (int)($year / 400) - 2; + + return (int) strtotime("+$daysDifference days", $timestamp); + } +} diff --git a/tests/.pest/snapshots/Countries/SerbiaTest/it_can_calculate_serbian_holidays.snap b/tests/.pest/snapshots/Countries/SerbiaTest/it_can_calculate_serbian_holidays.snap new file mode 100644 index 000000000..09b207302 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SerbiaTest/it_can_calculate_serbian_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Nova godina - prvi dan", + "date": "2024-01-01" + }, + { + "name": "Nova godina - drugi dan", + "date": "2024-01-02" + }, + { + "name": "Bo\u017ei\u0107", + "date": "2024-01-07" + }, + { + "name": "Dan dr\u017eavnosti - prvi dan", + "date": "2024-02-15" + }, + { + "name": "Dan dr\u017eavnosti - drugi dan", + "date": "2024-02-16" + }, + { + "name": "Praznik rada - prvi dan", + "date": "2024-05-01" + }, + { + "name": "Praznik rada - drugi dan", + "date": "2024-05-02" + }, + { + "name": "Veliki petak", + "date": "2024-05-03" + }, + { + "name": "Vaskrs", + "date": "2024-05-05" + }, + { + "name": "Vaskr\u0161nji ponedeljak", + "date": "2024-05-06" + }, + { + "name": "Dan primirja u Prvom svetskom ratu", + "date": "2024-11-11" + } +] \ No newline at end of file diff --git a/tests/Countries/SerbiaTest.php b/tests/Countries/SerbiaTest.php new file mode 100644 index 000000000..1a44fbb44 --- /dev/null +++ b/tests/Countries/SerbiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 3fe183595a79db02b8da0c7e219267928f801147 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 15:30:04 +0000 Subject: [PATCH 102/127] Fix styling --- src/Countries/Serbia.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Serbia.php b/src/Countries/Serbia.php index adbea34ce..13dc3ad8f 100644 --- a/src/Countries/Serbia.php +++ b/src/Countries/Serbia.php @@ -47,7 +47,7 @@ protected function variableHolidays(int $year): array protected function orthodoxEaster(int $year): int { $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); - $daysDifference = (int)($year / 100) - (int)($year / 400) - 2; + $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; return (int) strtotime("+$daysDifference days", $timestamp); } From 86483371c45dc1a253fd4dd603e7172158b241fa Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:33:55 +0100 Subject: [PATCH 103/127] fix Serbia --- src/Countries/Serbia.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Countries/Serbia.php b/src/Countries/Serbia.php index 13dc3ad8f..117885062 100644 --- a/src/Countries/Serbia.php +++ b/src/Countries/Serbia.php @@ -6,11 +6,6 @@ class Serbia extends Country { - protected function __construct( - public ?string $region = null - ) { - } - public function countryCode(): string { return 'sr'; @@ -33,9 +28,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp( - $this->orthodoxEaster($year) - )->setTimezone('Europe/Belgrade'); + $easter = $this->orthodoxEaster($year); return [ 'Veliki petak' => $easter->subDays(2), @@ -43,12 +36,4 @@ protected function variableHolidays(int $year): array 'Vaskršnji ponedeljak' => $easter->addDay(), ]; } - - protected function orthodoxEaster(int $year): int - { - $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); - $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; - - return (int) strtotime("+$daysDifference days", $timestamp); - } } From a47637ea1d3c96fb259f6e974a4d0e38e494c6e1 Mon Sep 17 00:00:00 2001 From: Mauricio Villatoro Date: Wed, 24 Jan 2024 09:41:49 -0600 Subject: [PATCH 104/127] Add El Salvador Holidays (#93) * add El Salvador holidays * fix styling --- src/Countries/ElSalvador.php | 41 +++++++++++++++++ ...it_can_calculate_el_salvador_holidays.snap | 46 +++++++++++++++++++ tests/Countries/ElSalvadorTest.php | 18 ++++++++ 3 files changed, 105 insertions(+) create mode 100644 src/Countries/ElSalvador.php create mode 100644 tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap create mode 100644 tests/Countries/ElSalvadorTest.php diff --git a/src/Countries/ElSalvador.php b/src/Countries/ElSalvador.php new file mode 100644 index 000000000..7f6183b3b --- /dev/null +++ b/src/Countries/ElSalvador.php @@ -0,0 +1,41 @@ + '01-01', + 'Día del Trabajo' => '05-01', + 'Día de la Madre' => '05-10', + 'Día del Padre' => '06-17', + 'Fiesta Divino Salvador del Mundo' => '08-06', + 'Día de la Independencia' => '09-15', + 'Día de Los Difuntos' => '11-02', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('America/El_Salvador'); + + return [ + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + 'Sábado de Gloria' => $easter->subDays(1), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap b/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap new file mode 100644 index 000000000..2586f7686 --- /dev/null +++ b/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "Jueves Santo", + "date": "2024-03-27" + }, + { + "name": "Viernes Santo", + "date": "2024-03-28" + }, + { + "name": "S\u00e1bado de Gloria", + "date": "2024-03-29" + }, + { + "name": "D\u00eda del Trabajo", + "date": "2024-05-01" + }, + { + "name": "D\u00eda de la Madre", + "date": "2024-05-10" + }, + { + "name": "D\u00eda del Padre", + "date": "2024-06-17" + }, + { + "name": "Fiesta Divino Salvador del Mundo", + "date": "2024-08-06" + }, + { + "name": "D\u00eda de la Independencia", + "date": "2024-09-15" + }, + { + "name": "D\u00eda de Los Difuntos", + "date": "2024-11-02" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/ElSalvadorTest.php b/tests/Countries/ElSalvadorTest.php new file mode 100644 index 000000000..892a8f791 --- /dev/null +++ b/tests/Countries/ElSalvadorTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 076b619261a707cb50484a296c45f8a95fe5cc0c Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Wed, 24 Jan 2024 15:42:09 +0000 Subject: [PATCH 105/127] Fix styling --- src/Countries/ElSalvador.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Countries/ElSalvador.php b/src/Countries/ElSalvador.php index 7f6183b3b..c3a84a224 100644 --- a/src/Countries/ElSalvador.php +++ b/src/Countries/ElSalvador.php @@ -6,7 +6,6 @@ class ElSalvador extends Country { - public function countryCode(): string { return 'sv'; From 0acd603c6f1534e87e088b6e53f26d3816930de7 Mon Sep 17 00:00:00 2001 From: Dzianis Kotau Date: Thu, 25 Jan 2024 12:15:39 +0400 Subject: [PATCH 106/127] Belarus Holidays (#156) --- lang/belarus/be-latn/holidays.json | 12 +++++ lang/belarus/en/holidays.json | 12 +++++ lang/belarus/ru/holidays.json | 12 +++++ src/Countries/Belarus.php | 38 +++++++++++++ .../it_can_calculate_belarus_holidays.snap | 42 +++++++++++++++ ...e_belarus_holidays_in_Belarus_Lacinka.snap | 42 +++++++++++++++ ...calculate_belarus_holidays_in_English.snap | 42 +++++++++++++++ ...calculate_belarus_holidays_in_Russian.snap | 42 +++++++++++++++ tests/Countries/BelarusTest.php | 54 +++++++++++++++++++ 9 files changed, 296 insertions(+) create mode 100644 lang/belarus/be-latn/holidays.json create mode 100644 lang/belarus/en/holidays.json create mode 100644 lang/belarus/ru/holidays.json create mode 100644 src/Countries/Belarus.php create mode 100644 tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap create mode 100644 tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap create mode 100644 tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap create mode 100644 tests/Countries/BelarusTest.php diff --git a/lang/belarus/be-latn/holidays.json b/lang/belarus/be-latn/holidays.json new file mode 100644 index 000000000..fda504206 --- /dev/null +++ b/lang/belarus/be-latn/holidays.json @@ -0,0 +1,12 @@ +{ + "Новы год": "Novy hod", + "Новы год (другі дзень)": "Novy hod (druhi dzień)", + "Нараджэнне Хрыстова (праваслаўнае Раство)": "Naradžeńnie Chrystova (pravasłaŭnaje Rastvo)", + "Дзень жанчын": "Dzień žančyn", + "Свята працы": "Sviata pracy", + "Дзень Перамогі": "Dzień Pieramohi", + "Дзень Незалежнасці": "Dzień Niezaležnaści", + "Дзень Кастрычніцкай рэвалюцыі": "Dzień Kastryčnickaj revalucyi", + "Нараджэнне Хрыстова (каталіцкае Раство)": "Naradžeńnie Chrystova (katalickaje Rastvo)", + "Радаўніца": "Radaŭnica" +} diff --git a/lang/belarus/en/holidays.json b/lang/belarus/en/holidays.json new file mode 100644 index 000000000..89c241bcd --- /dev/null +++ b/lang/belarus/en/holidays.json @@ -0,0 +1,12 @@ +{ + "Новы год": "New Year's Day", + "Новы год (другі дзень)": "New Year's Day (second day)", + "Нараджэнне Хрыстова (праваслаўнае Раство)": "Orthodox Christmas", + "Дзень жанчын": "Women's Day", + "Свята працы": "Labor Day", + "Дзень Перамогі": "Victory Day", + "Дзень Незалежнасці": "Independence Day", + "Дзень Кастрычніцкай рэвалюцыі": "October Revolution Day", + "Нараджэнне Хрыстова (каталіцкае Раство)": "Catholic Christmas", + "Радаўніца": "Radaunitsa" +} diff --git a/lang/belarus/ru/holidays.json b/lang/belarus/ru/holidays.json new file mode 100644 index 000000000..266eb0cef --- /dev/null +++ b/lang/belarus/ru/holidays.json @@ -0,0 +1,12 @@ +{ + "Новы год": "Новый год", + "Новы год (другі дзень)": "Новый год (второй день)", + "Нараджэнне Хрыстова (праваслаўнае Раство)": "Православное Рождество", + "Дзень жанчын": "Международный женский день", + "Свята працы": "День труда", + "Дзень Перамогі": "День Победы", + "Дзень Незалежнасці": "День Независимости", + "Дзень Кастрычніцкай рэвалюцыі": "День Октябрьской революции", + "Нараджэнне Хрыстова (каталіцкае Раство)": "Католическое Рождество", + "Радаўніца": "Радуница" +} diff --git a/src/Countries/Belarus.php b/src/Countries/Belarus.php new file mode 100644 index 000000000..f065d714e --- /dev/null +++ b/src/Countries/Belarus.php @@ -0,0 +1,38 @@ + '01-01', + 'Новы год (другі дзень)' => '01-02', + 'Нараджэнне Хрыстова (праваслаўнае Раство)' => '01-07', + 'Дзень жанчын' => '03-08', + 'Свята працы' => '05-01', + 'Дзень Перамогі' => '05-09', + 'Дзень Незалежнасці' => '07-03', + 'Дзень Кастрычніцкай рэвалюцыі' => '11-07', + 'Нараджэнне Хрыстова (каталіцкае Раство)' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->orthodoxEaster($year); + + return [ + 'Радаўніца' => $easter->addDays(9), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap new file mode 100644 index 000000000..7f456be80 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "\u041d\u043e\u0432\u044b \u0433\u043e\u0434", + "date": "2024-01-01" + }, + { + "name": "\u041d\u043e\u0432\u044b \u0433\u043e\u0434 (\u0434\u0440\u0443\u0433\u0456 \u0434\u0437\u0435\u043d\u044c)", + "date": "2024-01-02" + }, + { + "name": "\u041d\u0430\u0440\u0430\u0434\u0436\u044d\u043d\u043d\u0435 \u0425\u0440\u044b\u0441\u0442\u043e\u0432\u0430 (\u043f\u0440\u0430\u0432\u0430\u0441\u043b\u0430\u045e\u043d\u0430\u0435 \u0420\u0430\u0441\u0442\u0432\u043e)", + "date": "2024-01-07" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u0436\u0430\u043d\u0447\u044b\u043d", + "date": "2024-03-08" + }, + { + "name": "\u0421\u0432\u044f\u0442\u0430 \u043f\u0440\u0430\u0446\u044b", + "date": "2024-05-01" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u041f\u0435\u0440\u0430\u043c\u043e\u0433\u0456", + "date": "2024-05-09" + }, + { + "name": "\u0420\u0430\u0434\u0430\u045e\u043d\u0456\u0446\u0430", + "date": "2024-05-14" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u041d\u0435\u0437\u0430\u043b\u0435\u0436\u043d\u0430\u0441\u0446\u0456", + "date": "2024-07-03" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u041a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u0446\u043a\u0430\u0439 \u0440\u044d\u0432\u0430\u043b\u044e\u0446\u044b\u0456", + "date": "2024-11-07" + }, + { + "name": "\u041d\u0430\u0440\u0430\u0434\u0436\u044d\u043d\u043d\u0435 \u0425\u0440\u044b\u0441\u0442\u043e\u0432\u0430 (\u043a\u0430\u0442\u0430\u043b\u0456\u0446\u043a\u0430\u0435 \u0420\u0430\u0441\u0442\u0432\u043e)", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap new file mode 100644 index 000000000..3ce0d9150 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Novy hod", + "date": "2024-01-01" + }, + { + "name": "Novy hod (druhi dzie\u0144)", + "date": "2024-01-02" + }, + { + "name": "Narad\u017ee\u0144nie Chrystova (pravas\u0142a\u016dnaje Rastvo)", + "date": "2024-01-07" + }, + { + "name": "Dzie\u0144 \u017ean\u010dyn", + "date": "2024-03-08" + }, + { + "name": "Sviata pracy", + "date": "2024-05-01" + }, + { + "name": "Dzie\u0144 Pieramohi", + "date": "2024-05-09" + }, + { + "name": "Rada\u016dnica", + "date": "2024-05-14" + }, + { + "name": "Dzie\u0144 Niezale\u017ena\u015bci", + "date": "2024-07-03" + }, + { + "name": "Dzie\u0144 Kastry\u010dnickaj revalucyi", + "date": "2024-11-07" + }, + { + "name": "Narad\u017ee\u0144nie Chrystova (katalickaje Rastvo)", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap new file mode 100644 index 000000000..a57b40011 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "New Year's Day (second day)", + "date": "2024-01-02" + }, + { + "name": "Orthodox Christmas", + "date": "2024-01-07" + }, + { + "name": "Women's Day", + "date": "2024-03-08" + }, + { + "name": "Labor Day", + "date": "2024-05-01" + }, + { + "name": "Victory Day", + "date": "2024-05-09" + }, + { + "name": "Radaunitsa", + "date": "2024-05-14" + }, + { + "name": "Independence Day", + "date": "2024-07-03" + }, + { + "name": "October Revolution Day", + "date": "2024-11-07" + }, + { + "name": "Catholic Christmas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap new file mode 100644 index 000000000..1c93d7360 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap @@ -0,0 +1,42 @@ +[ + { + "name": "\u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434", + "date": "2024-01-01" + }, + { + "name": "\u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434 (\u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c)", + "date": "2024-01-02" + }, + { + "name": "\u041f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u043e\u0435 \u0420\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e", + "date": "2024-01-07" + }, + { + "name": "\u041c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0439 \u0436\u0435\u043d\u0441\u043a\u0438\u0439 \u0434\u0435\u043d\u044c", + "date": "2024-03-08" + }, + { + "name": "\u0414\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u0430", + "date": "2024-05-01" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041f\u043e\u0431\u0435\u0434\u044b", + "date": "2024-05-09" + }, + { + "name": "\u0420\u0430\u0434\u0443\u043d\u0438\u0446\u0430", + "date": "2024-05-14" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438", + "date": "2024-07-03" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041e\u043a\u0442\u044f\u0431\u0440\u044c\u0441\u043a\u043e\u0439 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u0438", + "date": "2024-11-07" + }, + { + "name": "\u041a\u0430\u0442\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0420\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/BelarusTest.php b/tests/Countries/BelarusTest.php new file mode 100644 index 000000000..5fc33f7e7 --- /dev/null +++ b/tests/Countries/BelarusTest.php @@ -0,0 +1,54 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate belarus holidays in English', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'by', locale: 'en')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate belarus holidays in Belarus Lacinka', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'by', locale: 'be-latn')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate belarus holidays in Russian', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'by', locale: 'ru')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From ab04ec4b4dad19258f2e9142a28fbfa96962b00e Mon Sep 17 00:00:00 2001 From: Arne Breitsprecher Date: Thu, 25 Jan 2024 09:21:27 +0100 Subject: [PATCH 107/127] Adding German holidays (#8) * Create Germany.php * Create GermanyTest.php * Test Snapshot * Change easter to class method * Adding regional state holidays * Adding state testing snapshots * Pint fixes * Moving failing test to fixed TestTime * phpstan fixing return * Test fix: Count regional holidays by numbers from wikipedia & Fixing Bug for regional SN,BB, HE --- src/Countries/Germany.php | 189 ++++++++++++++++++ .../it_can_calculate_german_holidays.snap | 38 ++++ ...with_data_set____BB___12_____BB___12_.snap | 50 +++++ ...with_data_set____BE___10_____BE___10_.snap | 42 ++++ ...with_data_set____BW___12_____BW___12_.snap | 50 +++++ ...with_data_set____BY___13_____BY___13_.snap | 54 +++++ ...with_data_set____HB___10_____HB___10_.snap | 42 ++++ ...with_data_set____HE___12_____HE___12_.snap | 50 +++++ ...with_data_set____HH___10_____HH___10_.snap | 42 ++++ ...with_data_set____MV___11_____MV___11_.snap | 46 +++++ ...with_data_set____NI___10_____NI___10_.snap | 42 ++++ ...with_data_set____NW___11_____NW___11_.snap | 46 +++++ ...with_data_set____RP___11_____RP___11_.snap | 46 +++++ ...with_data_set____SH___10_____SH___10_.snap | 42 ++++ ...with_data_set____SL___12_____SL___12_.snap | 50 +++++ ...with_data_set____SN___11_____SN___11_.snap | 46 +++++ ...with_data_set____ST___11_____ST___11_.snap | 46 +++++ ...with_data_set____TH___11_____TH___11_.snap | 46 +++++ tests/Countries/GermanyTest.php | 80 ++++++++ 19 files changed, 1047 insertions(+) create mode 100644 src/Countries/Germany.php create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_calculate_german_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BB___12_____BB___12_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BE___10_____BE___10_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BW___12_____BW___12_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BY___13_____BY___13_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HB___10_____HB___10_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HE___12_____HE___12_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HH___10_____HH___10_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____MV___11_____MV___11_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NI___10_____NI___10_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NW___11_____NW___11_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____RP___11_____RP___11_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SH___10_____SH___10_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SL___12_____SL___12_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SN___11_____SN___11_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____ST___11_____ST___11_.snap create mode 100644 tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____TH___11_____TH___11_.snap create mode 100644 tests/Countries/GermanyTest.php diff --git a/src/Countries/Germany.php b/src/Countries/Germany.php new file mode 100644 index 000000000..6bdc0da33 --- /dev/null +++ b/src/Countries/Germany.php @@ -0,0 +1,189 @@ +format('m-d'); + } + + /** @return array */ + protected function historicalHolidays(int $year): array + { + $historicalHolidays = []; + if ($year >= 1990 && $year <= 1994) { + $historicalHolidays['Buß- und Bettag'] = $this->getRepentanceAndPrayerDay($year); + } + if ($year === 2017) { + $historicalHolidays['Reformationstag'] = '10-31'; + } + + return $historicalHolidays; + } + + /** @return array */ + protected function allHolidays(int $year): array + { + + return array_merge([ + 'Neujahr' => '01-01', + 'Tag der deutschen Einheit' => '10-03', + 'Tag der Arbeit' => '05-01', + '1. Weihnachtstag' => '12-25', + '2. Weihnachtstag' => '12-26', + ], $this->variableHolidays($year), $this->historicalHolidays($year), $this->regionHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + + $easter = $this->easter($year); + + return [ + 'Karfreitag' => $easter->subDays(2), + 'Ostermontag' => $easter->addDay(), + 'Himmelfahrt' => $easter->addDays(39), + 'Pfingstmontag' => $easter->addDays(50), + ]; + } + + /** @return array */ + protected function regionHolidays(int $year): array + { + $easter = $this->easter($year); + + switch ($this->region) { + case 'DE-BW': + return [ + 'Heilige Drei Könige' => '01-06', + 'Fronleichnam' => $easter->addDays(60), + 'Allerheiligen' => '11-01', + ]; + case 'DE-BY': + return [ + 'Heilige Drei Könige' => '01-06', + 'Fronleichnam' => $easter->addDays(60), + 'Allerheiligen' => '11-01', + 'Mariä Himmelfahrt' => '08-15', + ]; + + case 'DE-BE': + if ($year >= 2019) { + return [ + 'Internationaler Frauentag' => '03-08', + ]; + } else { + return [ + + ]; + } + case 'DE-BB': + if ($year >= 1991) { + return [ + 'Ostersonntag' => $easter, + 'Reformationstag' => '10-31', + 'Pfingstsonntag' => $easter->addDays(49), + ]; + } else { + return [ + 'Ostersonntag' => $easter, + 'Pfingstsonntag' => $easter->addDays(49), + ]; + } + case 'DE-HB': + case 'DE-HH': + case 'DE-NI': + case 'DE-SH': + if ($year >= 2017) { + return [ + 'Reformationstag' => '10-31', + ]; + } else { + return [ + + ]; + } + + case 'DE-HE': + return [ + 'Ostersonntag' => $easter, + 'Pfingstsonntag' => $easter->addDays(49), + 'Fronleichnam' => $easter->addDays(60), + ]; + case 'DE-MV': + $mvHolidays = []; + if ($year >= 1990) { + $mvHolidays['Reformationstag'] = '10-31'; + } + if ($year >= 2023) { + $mvHolidays['Internationaler Frauentag'] = '03-08'; + } + + return $mvHolidays; + case 'DE-NW': + case 'DE-RP': + + return [ + 'Fronleichnam' => $easter->addDays(60), + 'Allerheiligen' => '11-01', + ]; + case 'DE-SL': + return [ + 'Fronleichnam' => $easter->addDays(60), + 'Allerheiligen' => '11-01', + 'Mariä Himmelfahrt' => '08-15', + ]; + case 'DE-SN': + $snHolidays = []; + if ($year >= 1990) { + $snHolidays['Reformationstag'] = '10-31'; + + } + if ($year > 1994) { + $snHolidays['Buß- und Bettag'] = $this->getRepentanceAndPrayerDay($year); + + } + + return $snHolidays; + case 'DE-ST': + $stHolidays = []; + if ($year >= 1990) { + $stHolidays['Reformationstag'] = '10-31'; + + } + if ($year >= 1991) { + $stHolidays['Heilige Drei Könige'] = '01-06'; + } + case 'DE-TH': + $thHolidays = []; + if ($year >= 1990) { + $thHolidays['Reformationstag'] = '10-31'; + } + if ($year >= 2019) { + $thHolidays['Weltkindertag'] = '09-20'; + } + + return $thHolidays; + + } + + return []; + } +} diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_calculate_german_holidays.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_calculate_german_holidays.snap new file mode 100644 index 000000000..74db923c9 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_calculate_german_holidays.snap @@ -0,0 +1,38 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BB___12_____BB___12_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BB___12_____BB___12_.snap new file mode 100644 index 000000000..03823bf9f --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BB___12_____BB___12_.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostersonntag", + "date": "2024-03-31" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstsonntag", + "date": "2024-05-19" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BE___10_____BE___10_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BE___10_____BE___10_.snap new file mode 100644 index 000000000..bcaf49aa5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BE___10_____BE___10_.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Internationaler Frauentag", + "date": "2024-03-08" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BW___12_____BW___12_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BW___12_____BW___12_.snap new file mode 100644 index 000000000..0c50fb2cc --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BW___12_____BW___12_.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Heilige Drei K\u00f6nige", + "date": "2024-01-06" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Fronleichnam", + "date": "2024-05-30" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Allerheiligen", + "date": "2024-11-01" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BY___13_____BY___13_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BY___13_____BY___13_.snap new file mode 100644 index 000000000..dcd248232 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____BY___13_____BY___13_.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Heilige Drei K\u00f6nige", + "date": "2024-01-06" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Fronleichnam", + "date": "2024-05-30" + }, + { + "name": "Mari\u00e4 Himmelfahrt", + "date": "2024-08-15" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Allerheiligen", + "date": "2024-11-01" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HB___10_____HB___10_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HB___10_____HB___10_.snap new file mode 100644 index 000000000..bb14985fc --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HB___10_____HB___10_.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HE___12_____HE___12_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HE___12_____HE___12_.snap new file mode 100644 index 000000000..3f4e98c2b --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HE___12_____HE___12_.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostersonntag", + "date": "2024-03-31" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstsonntag", + "date": "2024-05-19" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Fronleichnam", + "date": "2024-05-30" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HH___10_____HH___10_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HH___10_____HH___10_.snap new file mode 100644 index 000000000..bb14985fc --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____HH___10_____HH___10_.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____MV___11_____MV___11_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____MV___11_____MV___11_.snap new file mode 100644 index 000000000..e672cac96 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____MV___11_____MV___11_.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Internationaler Frauentag", + "date": "2024-03-08" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NI___10_____NI___10_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NI___10_____NI___10_.snap new file mode 100644 index 000000000..bb14985fc --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NI___10_____NI___10_.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NW___11_____NW___11_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NW___11_____NW___11_.snap new file mode 100644 index 000000000..8ead1399c --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____NW___11_____NW___11_.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Fronleichnam", + "date": "2024-05-30" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Allerheiligen", + "date": "2024-11-01" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____RP___11_____RP___11_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____RP___11_____RP___11_.snap new file mode 100644 index 000000000..8ead1399c --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____RP___11_____RP___11_.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Fronleichnam", + "date": "2024-05-30" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Allerheiligen", + "date": "2024-11-01" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SH___10_____SH___10_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SH___10_____SH___10_.snap new file mode 100644 index 000000000..bb14985fc --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SH___10_____SH___10_.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SL___12_____SL___12_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SL___12_____SL___12_.snap new file mode 100644 index 000000000..41c9b5a7c --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SL___12_____SL___12_.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Fronleichnam", + "date": "2024-05-30" + }, + { + "name": "Mari\u00e4 Himmelfahrt", + "date": "2024-08-15" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Allerheiligen", + "date": "2024-11-01" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SN___11_____SN___11_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SN___11_____SN___11_.snap new file mode 100644 index 000000000..814d58188 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____SN___11_____SN___11_.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "Bu\u00df- und Bettag", + "date": "2024-11-20" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____ST___11_____ST___11_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____ST___11_____ST___11_.snap new file mode 100644 index 000000000..cc02b4ad8 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____ST___11_____ST___11_.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Weltkindertag", + "date": "2024-09-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____TH___11_____TH___11_.snap b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____TH___11_____TH___11_.snap new file mode 100644 index 000000000..cc02b4ad8 --- /dev/null +++ b/tests/.pest/snapshots/Countries/GermanyTest/it_can_get_german_holidays_for_other_regions_with_data_set____TH___11_____TH___11_.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Neujahr", + "date": "2024-01-01" + }, + { + "name": "Karfreitag", + "date": "2024-03-29" + }, + { + "name": "Ostermontag", + "date": "2024-04-01" + }, + { + "name": "Tag der Arbeit", + "date": "2024-05-01" + }, + { + "name": "Himmelfahrt", + "date": "2024-05-09" + }, + { + "name": "Pfingstmontag", + "date": "2024-05-20" + }, + { + "name": "Weltkindertag", + "date": "2024-09-20" + }, + { + "name": "Tag der deutschen Einheit", + "date": "2024-10-03" + }, + { + "name": "Reformationstag", + "date": "2024-10-31" + }, + { + "name": "1. Weihnachtstag", + "date": "2024-12-25" + }, + { + "name": "2. Weihnachtstag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/GermanyTest.php b/tests/Countries/GermanyTest.php new file mode 100644 index 000000000..d1a6cba79 --- /dev/null +++ b/tests/Countries/GermanyTest.php @@ -0,0 +1,80 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); + +it('can calculate german historical reformationstag in year 2017', function () { + CarbonImmutable::setTestNowAndTimezone('2017-01-01'); + + $holiday = Holidays::for('de')->isHoliday('2017-10-31'); + + expect($holiday)->toBeTrue(); + +}); +it('can calculate german historical reformationstag in year 2018 is not a holiday', function () { + CarbonImmutable::setTestNowAndTimezone('2018-01-01'); + + $holiday = Holidays::for('de')->isHoliday('2018-10-31'); + + expect($holiday)->toBeFalse(); + +}); + +it('can calculate german buß- und bettag in year 1990', function () { + CarbonImmutable::setTestNowAndTimezone('1990-01-01'); + + $holiday = Holidays::for('de')->isHoliday('1990-10-03'); + + expect($holiday)->toBeTrue(); + +}); +/* + This test will check for all regional holidays in Germany. Source: https://en.wikipedia.org/wiki/Public_holidays_in_Germany + The total numbers are referenced in the wikipedia article. +*/ +it('can get german holidays for other regions', function (string $region, int $totalHolidays) { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + $holidays = Holidays::for(Germany::make('DE-'.$region))->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(count($holidays))->toBe($totalHolidays); + + expect(formatDates($holidays))->toMatchSnapshot(); +})->with( + [ + ['BW',12], + ['BY',13], + ['BE',10], + ['BB',12], + ['HB',10], + ['HH',10], + ['HE',12], + ['MV',11], + ['NI',10], + ['NW',11], + ['RP',11], + ['SL',12], + ['SN',11], + ['ST',11], + ['SH',10], + ['TH',11] ] +); From eebcfd2a7f787d5378253dd729f179bab09b11f5 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 08:21:46 +0000 Subject: [PATCH 108/127] Fix styling --- tests/Countries/GermanyTest.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/Countries/GermanyTest.php b/tests/Countries/GermanyTest.php index d1a6cba79..3cb388e5b 100644 --- a/tests/Countries/GermanyTest.php +++ b/tests/Countries/GermanyTest.php @@ -61,20 +61,20 @@ expect(formatDates($holidays))->toMatchSnapshot(); })->with( [ - ['BW',12], - ['BY',13], - ['BE',10], - ['BB',12], - ['HB',10], - ['HH',10], - ['HE',12], - ['MV',11], - ['NI',10], - ['NW',11], - ['RP',11], - ['SL',12], - ['SN',11], - ['ST',11], - ['SH',10], - ['TH',11] ] + ['BW', 12], + ['BY', 13], + ['BE', 10], + ['BB', 12], + ['HB', 10], + ['HH', 10], + ['HE', 12], + ['MV', 11], + ['NI', 10], + ['NW', 11], + ['RP', 11], + ['SL', 12], + ['SN', 11], + ['ST', 11], + ['SH', 10], + ['TH', 11]] ); From 7f169c09f46c3dc8edc90c8063001d9428eb2f2b Mon Sep 17 00:00:00 2001 From: Patrick O'Meara Date: Thu, 25 Jan 2024 19:34:56 +1100 Subject: [PATCH 109/127] Add Australian Holidays (#43) * Add Australian Holidays These are the national holidays, that all states observe. * Use the easter method * Add state regional holidays * Clean up the name of whoever's birthday it is. * Added modify call on CarbonImmutable to PHPStan baseline --- phpstan-baseline.neon | 5 + src/Countries/Australia.php | 119 ++++++++++++++++ .../it_can_calculate_australian_holidays.snap | 30 ++++ ...stralian_holidays_for_a_specific_year.snap | 30 ++++ ...alculate_regional_australian_holidays.snap | 54 ++++++++ tests/Countries/AustraliaTest.php | 130 ++++++++++++++++++ tests/Pest.php | 11 ++ 7 files changed, 379 insertions(+) create mode 100644 src/Countries/Australia.php create mode 100644 tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays_for_a_specific_year.snap create mode 100644 tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_regional_australian_holidays.snap create mode 100644 tests/Countries/AustraliaTest.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d237ce635..31f8d0e58 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Cannot call method modify\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" + count: 1 + path: src/Countries/Australia.php + - message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" count: 1 diff --git a/src/Countries/Australia.php b/src/Countries/Australia.php new file mode 100644 index 000000000..87dcb6a6f --- /dev/null +++ b/src/Countries/Australia.php @@ -0,0 +1,119 @@ + '01-01', + 'Australia Day' => '01-26', + 'Anzac Day' => '04-25', + 'Christmas Day' => '12-25', + 'Boxing Day' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year)->setTimezone('Australia/Sydney'); + + return [ + 'Good Friday' => $easter->subDays(2), + 'Easter Monday' => $easter->addDay(), + // https://en.wikipedia.org/wiki/Public_holidays_in_Australia + ...array_filter(match($this->region) { + 'act' => [ + 'Canberra Day' => CarbonImmutable::parse("second monday of march {$year}"), + 'Easter Saturday' => $easter->subDay(), + 'Easter Sunday' => $easter, + 'Reconciliation Day' => CarbonImmutable::create($year, 5, 27)->modify('monday'), + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("second monday of june {$year}"), + 'Labour Day' => CarbonImmutable::parse("first monday of october {$year}"), + ], + 'nsw' => [ + 'Easter Saturday' => $easter->subDay(), + 'Easter Sunday' => $easter, + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("second monday of june {$year}"), + 'Labour Day' => CarbonImmutable::parse("first monday of october {$year}"), + ], + 'nt' => [ + 'Easter Saturday' => $easter->subDay(), + 'May Day' => CarbonImmutable::parse("first monday of may {$year}"), + 'Picnic Day' => CarbonImmutable::parse("first monday of august {$year}"), + ], + 'qld' => [ + 'The day after Good Friday' => $easter->subDay(), + 'Easter Sunday' => $easter, + 'Labour Day' => CarbonImmutable::parse("first monday of may {$year}"), + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("first monday of october {$year}"), + ], + 'sa' => [ + 'Adelaide Cup Day' => $year < 2006 + ? CarbonImmutable::parse("third monday of may {$year}") + : CarbonImmutable::parse("second monday of march {$year}"), + 'The day after Good Friday' => $easter->subDay(), + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("second monday of june {$year}"), + 'Labour Day' => CarbonImmutable::parse("first monday of october {$year}"), + ], + 'tas' => [ + 'Eight Hours Day' => CarbonImmutable::parse("second monday of march {$year}"), + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("second monday of june {$year}"), + ], + 'vic' => [ + 'Labour Day' => CarbonImmutable::parse("second monday of march {$year}"), + 'Saturday before Easter Sunday' => $easter->subDay(), + 'Easter Sunday' => $easter, + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("second monday of june {$year}"), + 'Friday before AFL Grand Final' => $this->fridayBeforeAflGrandFinal($year), + 'Melbourne Cup' => CarbonImmutable::parse("first tuesday of november {$year}"), + ], + 'wa' => [ + 'Labour Day' => CarbonImmutable::parse("first monday of march {$year}"), + 'Easter Sunday' => $easter, + 'Western Australia Day' => CarbonImmutable::parse("first monday of june {$year}"), + $this->sovereignBirthdayKey($year) => CarbonImmutable::parse("last monday of september {$year}"), + ], + default => [], + }), + ]; + } + + // https://business.vic.gov.au/business-information/public-holidays/victorian-public-holidays-2025 + // https://en.wikipedia.org/wiki/List_of_VFL/AFL_premiers#VFL/AFL_premierships + protected function fridayBeforeAflGrandFinal(int $year): ?CarbonImmutable + { + if ($year < 2015) { + return null; + } + + return match ($year) { + 2015 => CarbonImmutable::parse('2015-10-02'), + 2020 => CarbonImmutable::parse('2020-10-23'), + 2022 => CarbonImmutable::parse('2022-09-23'), + default => CarbonImmutable::parse("last friday of september {$year}"), + }; + } + + protected function sovereignBirthdayKey(int $year): string + { + // https://www.abc.net.au/news/2022-09-22/queens-birthday-public-holiday-becomes-kings-birthday/101453408 + $changeYear = $this->region === 'wa' ? 2022 : 2023; + + return $year >= $changeYear ? "King's Birthday" : "Queen's Birthday"; + } +} diff --git a/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays.snap b/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays.snap new file mode 100644 index 000000000..ebc8a6046 --- /dev/null +++ b/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays.snap @@ -0,0 +1,30 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Australia Day", + "date": "2024-01-26" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Anzac Day", + "date": "2024-04-25" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Boxing Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays_for_a_specific_year.snap b/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays_for_a_specific_year.snap new file mode 100644 index 000000000..340c74d77 --- /dev/null +++ b/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_australian_holidays_for_a_specific_year.snap @@ -0,0 +1,30 @@ +[ + { + "name": "New Year's Day", + "date": "2025-01-01" + }, + { + "name": "Australia Day", + "date": "2025-01-26" + }, + { + "name": "Good Friday", + "date": "2025-04-18" + }, + { + "name": "Easter Monday", + "date": "2025-04-21" + }, + { + "name": "Anzac Day", + "date": "2025-04-25" + }, + { + "name": "Christmas Day", + "date": "2025-12-25" + }, + { + "name": "Boxing Day", + "date": "2025-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_regional_australian_holidays.snap b/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_regional_australian_holidays.snap new file mode 100644 index 000000000..6ccbd6ab5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/AustraliaTest/it_can_calculate_regional_australian_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Australia Day", + "date": "2024-01-26" + }, + { + "name": "Labour Day", + "date": "2024-03-11" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Saturday before Easter Sunday", + "date": "2024-03-30" + }, + { + "name": "Easter Sunday", + "date": "2024-03-31" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Anzac Day", + "date": "2024-04-25" + }, + { + "name": "King's Birthday", + "date": "2024-06-10" + }, + { + "name": "Friday before AFL Grand Final", + "date": "2024-09-27" + }, + { + "name": "Melbourne Cup", + "date": "2024-11-05" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Boxing Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/AustraliaTest.php b/tests/Countries/AustraliaTest.php new file mode 100644 index 000000000..e274579df --- /dev/null +++ b/tests/Countries/AustraliaTest.php @@ -0,0 +1,130 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate australian holidays for a specific year', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Melbourne'); + + $holidays = Holidays::for(country: 'au', year: 2025)->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate regional australian holidays', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Melbourne'); + + $holidays = Holidays::for(Australia::make('vic'))->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate the day before afl grand final', function () { + CarbonImmutable::setTestNowAndTimezone('2021-01-22', 'Australia/Melbourne'); + + $holidays = Holidays::for(Australia::make('vic'))->get(); + + expect(findDate($holidays, 'Friday before AFL Grand Final')) + ->toEqual(CarbonImmutable::create(2021, 9, 24)); +}); + +it('can calculate the day before afl grand final during lockdown', function () { + CarbonImmutable::setTestNowAndTimezone('2020-01-22', 'Australia/Melbourne'); + + $holidays = Holidays::for(Australia::make('vic'))->get(); + + expect(findDate($holidays, 'Friday before AFL Grand Final')) + ->toEqual(CarbonImmutable::create(2020, 10, 23)); +}); + +it('does not return the day before afl grand final before 2015', function () { + CarbonImmutable::setTestNowAndTimezone('2014-01-22', 'Australia/Melbourne'); + + $holidays = Holidays::for(Australia::make('vic'))->get(); + + expect(findDate($holidays, 'Friday before AFL Grand Final')) + ->toBeNull(); +}); + +it("returns queen's birthday before her death", function () { + CarbonImmutable::setTestNowAndTimezone('2021-01-22', 'Australia/Perth'); + + $holidays = Holidays::for(Australia::make('wa'))->get(); + + expect(findDate($holidays, "Queen's Birthday")) + ->toEqual(CarbonImmutable::create(2021, 9, 27)); + + expect(findDate($holidays, "King's Birthday")) + ->toBeNull(); +}); + +it("returns king's birthday after her death", function () { + CarbonImmutable::setTestNowAndTimezone('2022-01-22', 'Australia/Perth'); + + $holidays = Holidays::for(Australia::make('wa'))->get(); + + expect(findDate($holidays, "Queen's Birthday")) + ->toBeNull(); + + expect(findDate($holidays, "King's Birthday")) + ->toEqual(CarbonImmutable::create(2022, 9, 26)); +}); + +it('can calculate Adelaide Cup Day before 2006', function () { + CarbonImmutable::setTestNowAndTimezone('2005-01-22', 'Australia/Adelaide'); + + $holidays = Holidays::for(Australia::make('sa'))->get(); + + expect(findDate($holidays, 'Adelaide Cup Day')) + ->toEqual(CarbonImmutable::create(2005, 5, 16)); +}); + +it('can calculate Adelaide Cup Day after 2006', function () { + CarbonImmutable::setTestNowAndTimezone('2007-01-22', 'Australia/Adelaide'); + + $holidays = Holidays::for(Australia::make('sa'))->get(); + + expect(findDate($holidays, 'Adelaide Cup Day')) + ->toEqual(CarbonImmutable::create(2007, 3, 12)); +}); + +it('can calculate Reconciliation Day on 27 May', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Canberra'); + + $holidays = Holidays::for(Australia::make('act'))->get(); + + expect(findDate($holidays, 'Reconciliation Day')) + ->toEqual(CarbonImmutable::create(2024, 5, 27)); +}); + +it('can calculate Reconciliation Day after 27 May', function () { + CarbonImmutable::setTestNowAndTimezone('2025-01-22', 'Australia/Canberra'); + + $holidays = Holidays::for(Australia::make('act'))->get(); + + expect(findDate($holidays, 'Reconciliation Day')) + ->toEqual(CarbonImmutable::create(2025, 6, 2)); +}); diff --git a/tests/Pest.php b/tests/Pest.php index 310516cb7..b17024094 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -20,3 +20,14 @@ function formatDates(array $holidays): array return $holidays; } + +function findDate(array $holidays, string $name): ?Carbon\CarbonImmutable +{ + foreach ($holidays as $holiday) { + if ($holiday['name'] === $name) { + return $holiday['date']; + } + } + + return null; +} From ed1f589369ef9e2bddd0b6f18f6fa2cabdd0723c Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 08:35:24 +0000 Subject: [PATCH 110/127] Fix styling --- src/Countries/Australia.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Australia.php b/src/Countries/Australia.php index 87dcb6a6f..0b43bae4e 100644 --- a/src/Countries/Australia.php +++ b/src/Countries/Australia.php @@ -36,7 +36,7 @@ protected function variableHolidays(int $year): array 'Good Friday' => $easter->subDays(2), 'Easter Monday' => $easter->addDay(), // https://en.wikipedia.org/wiki/Public_holidays_in_Australia - ...array_filter(match($this->region) { + ...array_filter(match ($this->region) { 'act' => [ 'Canberra Day' => CarbonImmutable::parse("second monday of march {$year}"), 'Easter Saturday' => $easter->subDay(), From 4de040f75e624397e5a3f6aa4caddaa15545bccc Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:54:30 +0100 Subject: [PATCH 111/127] remove all timezones from tests country holidays should be properly calculated in every timezone --- tests/Countries/AndorraTest.php | 2 +- tests/Countries/AustraliaTest.php | 24 +++++++++++------------ tests/Countries/AustriaTest.php | 2 +- tests/Countries/BangladeshTest.php | 2 +- tests/Countries/BelarusTest.php | 8 ++++---- tests/Countries/BelgiumTest.php | 2 +- tests/Countries/BoliviaTest.php | 2 +- tests/Countries/BrazilTest.php | 2 +- tests/Countries/CanadaTest.php | 2 +- tests/Countries/ColombiaTest.php | 2 +- tests/Countries/CroatiaTest.php | 2 +- tests/Countries/CzechiaTest.php | 2 +- tests/Countries/DenmarkTest.php | 2 +- tests/Countries/DominicanRepublicTest.php | 2 +- tests/Countries/ElSalvadorTest.php | 2 +- tests/Countries/EstoniaTest.php | 2 +- tests/Countries/FinlandTest.php | 4 ++-- tests/Countries/FranceTest.php | 6 +++--- tests/Countries/GermanyTest.php | 10 +++++----- tests/Countries/GreeceTest.php | 2 +- tests/Countries/GuatemalaTest.php | 2 +- tests/Countries/HaitiTest.php | 2 +- tests/Countries/HungaryTest.php | 2 +- tests/Countries/IrelandTest.php | 2 +- tests/Countries/ItalyTest.php | 2 +- tests/Countries/JapanTest.php | 2 +- tests/Countries/KosovoTest.php | 2 +- tests/Countries/LatviaTest.php | 2 +- tests/Countries/LiechtensteinTest.php | 2 +- tests/Countries/LithuaniaTest.php | 2 +- tests/Countries/LuxembourgTest.php | 2 +- tests/Countries/MalawiTest.php | 2 +- tests/Countries/MexicoTest.php | 2 +- tests/Countries/NetherlandsTest.php | 2 +- tests/Countries/NicaraguaTest.php | 2 +- tests/Countries/NorthMacedoniaTest.php | 2 +- tests/Countries/NorwayTest.php | 2 +- tests/Countries/PanamaTest.php | 2 +- tests/Countries/PeruTest.php | 2 +- tests/Countries/PhilippinesTest.php | 2 +- tests/Countries/PolandTest.php | 2 +- tests/Countries/PortugalTest.php | 2 +- tests/Countries/RomaniaTest.php | 2 +- tests/Countries/SerbiaTest.php | 2 +- tests/Countries/SlovakiaTest.php | 2 +- tests/Countries/SouthAfricaTest.php | 2 +- tests/Countries/TurkeyTest.php | 2 +- tests/Countries/TurkmenistanTest.php | 2 +- tests/Countries/UgandaTest.php | 2 +- tests/Countries/UkraineTest.php | 2 +- tests/Countries/UnitedStatesTest.php | 4 ++-- tests/Countries/VenezuelaTest.php | 2 +- tests/Countries/ZambiaTest.php | 2 +- 53 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/Countries/AndorraTest.php b/tests/Countries/AndorraTest.php index 43f1c49cc..184dad385 100644 --- a/tests/Countries/AndorraTest.php +++ b/tests/Countries/AndorraTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate andorra holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ad')->get(); diff --git a/tests/Countries/AustraliaTest.php b/tests/Countries/AustraliaTest.php index e274579df..be239874d 100644 --- a/tests/Countries/AustraliaTest.php +++ b/tests/Countries/AustraliaTest.php @@ -7,7 +7,7 @@ use Spatie\Holidays\Holidays; it('can calculate australian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Melbourne'); + CarbonImmutable::setTestNow('2024-01-22'); $holidays = Holidays::for(country: 'au')->get(); @@ -19,7 +19,7 @@ }); it('can calculate australian holidays for a specific year', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Melbourne'); + CarbonImmutable::setTestNow('2024-01-22'); $holidays = Holidays::for(country: 'au', year: 2025)->get(); @@ -31,7 +31,7 @@ }); it('can calculate regional australian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Melbourne'); + CarbonImmutable::setTestNow('2024-01-22'); $holidays = Holidays::for(Australia::make('vic'))->get(); @@ -43,7 +43,7 @@ }); it('can calculate the day before afl grand final', function () { - CarbonImmutable::setTestNowAndTimezone('2021-01-22', 'Australia/Melbourne'); + CarbonImmutable::setTestNow('2021-01-22'); $holidays = Holidays::for(Australia::make('vic'))->get(); @@ -52,7 +52,7 @@ }); it('can calculate the day before afl grand final during lockdown', function () { - CarbonImmutable::setTestNowAndTimezone('2020-01-22', 'Australia/Melbourne'); + CarbonImmutable::setTestNow('2020-01-22'); $holidays = Holidays::for(Australia::make('vic'))->get(); @@ -61,7 +61,7 @@ }); it('does not return the day before afl grand final before 2015', function () { - CarbonImmutable::setTestNowAndTimezone('2014-01-22', 'Australia/Melbourne'); + CarbonImmutable::setTestNow('2014-01-22'); $holidays = Holidays::for(Australia::make('vic'))->get(); @@ -70,7 +70,7 @@ }); it("returns queen's birthday before her death", function () { - CarbonImmutable::setTestNowAndTimezone('2021-01-22', 'Australia/Perth'); + CarbonImmutable::setTestNow('2021-01-22', 'Australia/Perth'); $holidays = Holidays::for(Australia::make('wa'))->get(); @@ -82,7 +82,7 @@ }); it("returns king's birthday after her death", function () { - CarbonImmutable::setTestNowAndTimezone('2022-01-22', 'Australia/Perth'); + CarbonImmutable::setTestNow('2022-01-22', 'Australia/Perth'); $holidays = Holidays::for(Australia::make('wa'))->get(); @@ -94,7 +94,7 @@ }); it('can calculate Adelaide Cup Day before 2006', function () { - CarbonImmutable::setTestNowAndTimezone('2005-01-22', 'Australia/Adelaide'); + CarbonImmutable::setTestNow('2005-01-22', 'Australia/Adelaide'); $holidays = Holidays::for(Australia::make('sa'))->get(); @@ -103,7 +103,7 @@ }); it('can calculate Adelaide Cup Day after 2006', function () { - CarbonImmutable::setTestNowAndTimezone('2007-01-22', 'Australia/Adelaide'); + CarbonImmutable::setTestNow('2007-01-22', 'Australia/Adelaide'); $holidays = Holidays::for(Australia::make('sa'))->get(); @@ -112,7 +112,7 @@ }); it('can calculate Reconciliation Day on 27 May', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-22', 'Australia/Canberra'); + CarbonImmutable::setTestNow('2024-01-22', 'Australia/Canberra'); $holidays = Holidays::for(Australia::make('act'))->get(); @@ -121,7 +121,7 @@ }); it('can calculate Reconciliation Day after 27 May', function () { - CarbonImmutable::setTestNowAndTimezone('2025-01-22', 'Australia/Canberra'); + CarbonImmutable::setTestNow('2025-01-22', 'Australia/Canberra'); $holidays = Holidays::for(Australia::make('act'))->get(); diff --git a/tests/Countries/AustriaTest.php b/tests/Countries/AustriaTest.php index 9018307f2..2e196c8ce 100644 --- a/tests/Countries/AustriaTest.php +++ b/tests/Countries/AustriaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate austrian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'at')->get(); diff --git a/tests/Countries/BangladeshTest.php b/tests/Countries/BangladeshTest.php index b5b0f0b59..d978a795d 100644 --- a/tests/Countries/BangladeshTest.php +++ b/tests/Countries/BangladeshTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate bangladesh holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'bd')->get(); diff --git a/tests/Countries/BelarusTest.php b/tests/Countries/BelarusTest.php index 5fc33f7e7..2f8d1be47 100644 --- a/tests/Countries/BelarusTest.php +++ b/tests/Countries/BelarusTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate belarus holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'by')->get(); @@ -18,7 +18,7 @@ }); it('can calculate belarus holidays in English', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'by', locale: 'en')->get(); @@ -30,7 +30,7 @@ }); it('can calculate belarus holidays in Belarus Lacinka', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'by', locale: 'be-latn')->get(); @@ -42,7 +42,7 @@ }); it('can calculate belarus holidays in Russian', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'by', locale: 'ru')->get(); diff --git a/tests/Countries/BelgiumTest.php b/tests/Countries/BelgiumTest.php index 822834377..173922950 100644 --- a/tests/Countries/BelgiumTest.php +++ b/tests/Countries/BelgiumTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate belgian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'be')->get(); diff --git a/tests/Countries/BoliviaTest.php b/tests/Countries/BoliviaTest.php index e1305657f..2c50b0130 100644 --- a/tests/Countries/BoliviaTest.php +++ b/tests/Countries/BoliviaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate bolivian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'bo')->get(); diff --git a/tests/Countries/BrazilTest.php b/tests/Countries/BrazilTest.php index 91be74d40..39668d09c 100644 --- a/tests/Countries/BrazilTest.php +++ b/tests/Countries/BrazilTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate brazil holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'br')->get(); diff --git a/tests/Countries/CanadaTest.php b/tests/Countries/CanadaTest.php index 0619c4ecc..8d4e8ca23 100644 --- a/tests/Countries/CanadaTest.php +++ b/tests/Countries/CanadaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate canadian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ca')->get(); diff --git a/tests/Countries/ColombiaTest.php b/tests/Countries/ColombiaTest.php index 623ffd94b..7a97c0542 100644 --- a/tests/Countries/ColombiaTest.php +++ b/tests/Countries/ColombiaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate colombian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'co')->get(); diff --git a/tests/Countries/CroatiaTest.php b/tests/Countries/CroatiaTest.php index a78f5258a..e394ccba5 100644 --- a/tests/Countries/CroatiaTest.php +++ b/tests/Countries/CroatiaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate croatian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'hr')->get(); diff --git a/tests/Countries/CzechiaTest.php b/tests/Countries/CzechiaTest.php index 5b9f09bb3..b6b027f04 100644 --- a/tests/Countries/CzechiaTest.php +++ b/tests/Countries/CzechiaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate czech holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'cz')->get(); diff --git a/tests/Countries/DenmarkTest.php b/tests/Countries/DenmarkTest.php index dc01757ce..64034ba09 100644 --- a/tests/Countries/DenmarkTest.php +++ b/tests/Countries/DenmarkTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate danish holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'da')->get(); diff --git a/tests/Countries/DominicanRepublicTest.php b/tests/Countries/DominicanRepublicTest.php index 954e2a589..166348751 100644 --- a/tests/Countries/DominicanRepublicTest.php +++ b/tests/Countries/DominicanRepublicTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate dominican republic holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'do')->get(); diff --git a/tests/Countries/ElSalvadorTest.php b/tests/Countries/ElSalvadorTest.php index 892a8f791..d6260641c 100644 --- a/tests/Countries/ElSalvadorTest.php +++ b/tests/Countries/ElSalvadorTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate el salvador holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'sv')->get(); diff --git a/tests/Countries/EstoniaTest.php b/tests/Countries/EstoniaTest.php index c7ee1aa0b..5f1c0ee79 100644 --- a/tests/Countries/EstoniaTest.php +++ b/tests/Countries/EstoniaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate estonian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01', 'Europe/Tallinn'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ee')->get(); diff --git a/tests/Countries/FinlandTest.php b/tests/Countries/FinlandTest.php index 565dc1623..ac347ba0e 100644 --- a/tests/Countries/FinlandTest.php +++ b/tests/Countries/FinlandTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate finnish holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'fi')->get(); @@ -19,7 +19,7 @@ }); it('can get finnish holidays in swedish', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'fi', locale: 'sv')->get(); diff --git a/tests/Countries/FranceTest.php b/tests/Countries/FranceTest.php index 358f8b1c0..300881b1e 100644 --- a/tests/Countries/FranceTest.php +++ b/tests/Countries/FranceTest.php @@ -7,7 +7,7 @@ use Spatie\Holidays\Holidays; it('can calculate french holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'fr')->get(); @@ -19,7 +19,7 @@ }); it('can calculate french easter based region holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(France::make('FR-57'))->get(); @@ -31,7 +31,7 @@ }); it('can calculate french date based regional holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(France::make('FR-BL'))->get(); diff --git a/tests/Countries/GermanyTest.php b/tests/Countries/GermanyTest.php index 3cb388e5b..b6a4f710f 100644 --- a/tests/Countries/GermanyTest.php +++ b/tests/Countries/GermanyTest.php @@ -7,7 +7,7 @@ use Spatie\Holidays\Holidays; it('can calculate german holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'de')->get(); @@ -20,7 +20,7 @@ }); it('can calculate german historical reformationstag in year 2017', function () { - CarbonImmutable::setTestNowAndTimezone('2017-01-01'); + CarbonImmutable::setTestNow('2017-01-01'); $holiday = Holidays::for('de')->isHoliday('2017-10-31'); @@ -28,7 +28,7 @@ }); it('can calculate german historical reformationstag in year 2018 is not a holiday', function () { - CarbonImmutable::setTestNowAndTimezone('2018-01-01'); + CarbonImmutable::setTestNow('2018-01-01'); $holiday = Holidays::for('de')->isHoliday('2018-10-31'); @@ -37,7 +37,7 @@ }); it('can calculate german buß- und bettag in year 1990', function () { - CarbonImmutable::setTestNowAndTimezone('1990-01-01'); + CarbonImmutable::setTestNow('1990-01-01'); $holiday = Holidays::for('de')->isHoliday('1990-10-03'); @@ -49,7 +49,7 @@ The total numbers are referenced in the wikipedia article. */ it('can get german holidays for other regions', function (string $region, int $totalHolidays) { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(Germany::make('DE-'.$region))->get(); expect($holidays) diff --git a/tests/Countries/GreeceTest.php b/tests/Countries/GreeceTest.php index 26805abbe..924065235 100644 --- a/tests/Countries/GreeceTest.php +++ b/tests/Countries/GreeceTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate hellenic holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'el')->get(); diff --git a/tests/Countries/GuatemalaTest.php b/tests/Countries/GuatemalaTest.php index 106ce7d4d..572dfbced 100644 --- a/tests/Countries/GuatemalaTest.php +++ b/tests/Countries/GuatemalaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate guatemalan holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'gt')->get(); diff --git a/tests/Countries/HaitiTest.php b/tests/Countries/HaitiTest.php index 9e5632765..8a31192ea 100644 --- a/tests/Countries/HaitiTest.php +++ b/tests/Countries/HaitiTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate haiti holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ht')->get(); diff --git a/tests/Countries/HungaryTest.php b/tests/Countries/HungaryTest.php index f1c20ab25..4df502bb0 100644 --- a/tests/Countries/HungaryTest.php +++ b/tests/Countries/HungaryTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate hungarian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'hu')->get(); diff --git a/tests/Countries/IrelandTest.php b/tests/Countries/IrelandTest.php index 6ed63548f..1b3ff2c31 100644 --- a/tests/Countries/IrelandTest.php +++ b/tests/Countries/IrelandTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate irish holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ie')->get(); diff --git a/tests/Countries/ItalyTest.php b/tests/Countries/ItalyTest.php index bd42933b6..55af7f42d 100644 --- a/tests/Countries/ItalyTest.php +++ b/tests/Countries/ItalyTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate italian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'it')->get(); diff --git a/tests/Countries/JapanTest.php b/tests/Countries/JapanTest.php index 3a948815e..3404f3a87 100644 --- a/tests/Countries/JapanTest.php +++ b/tests/Countries/JapanTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate japanese holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'jp')->get(); diff --git a/tests/Countries/KosovoTest.php b/tests/Countries/KosovoTest.php index 2621722ff..313bd3c0e 100644 --- a/tests/Countries/KosovoTest.php +++ b/tests/Countries/KosovoTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate kosovo holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'xk')->get(); diff --git a/tests/Countries/LatviaTest.php b/tests/Countries/LatviaTest.php index bce7acb68..1995326af 100644 --- a/tests/Countries/LatviaTest.php +++ b/tests/Countries/LatviaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate latvian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01', 'Europe/Riga'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'lv')->get(); diff --git a/tests/Countries/LiechtensteinTest.php b/tests/Countries/LiechtensteinTest.php index 00b62a5c6..3d385c0c3 100644 --- a/tests/Countries/LiechtensteinTest.php +++ b/tests/Countries/LiechtensteinTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate liechtenstein holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'li')->get(); diff --git a/tests/Countries/LithuaniaTest.php b/tests/Countries/LithuaniaTest.php index 310f58f5b..91fbd0c1b 100644 --- a/tests/Countries/LithuaniaTest.php +++ b/tests/Countries/LithuaniaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate lithuanian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01', 'Europe/Vilnius'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'lt')->get(); diff --git a/tests/Countries/LuxembourgTest.php b/tests/Countries/LuxembourgTest.php index 48c69782c..13b500dc0 100644 --- a/tests/Countries/LuxembourgTest.php +++ b/tests/Countries/LuxembourgTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate luxembourgish holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'lu')->get(); diff --git a/tests/Countries/MalawiTest.php b/tests/Countries/MalawiTest.php index bc2710322..0d30d5ad8 100644 --- a/tests/Countries/MalawiTest.php +++ b/tests/Countries/MalawiTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate malawi holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'mw')->get(); diff --git a/tests/Countries/MexicoTest.php b/tests/Countries/MexicoTest.php index dfd62a71e..c6be2b64e 100644 --- a/tests/Countries/MexicoTest.php +++ b/tests/Countries/MexicoTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate mexican holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'mx')->get(); diff --git a/tests/Countries/NetherlandsTest.php b/tests/Countries/NetherlandsTest.php index 993201976..b743adae2 100644 --- a/tests/Countries/NetherlandsTest.php +++ b/tests/Countries/NetherlandsTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate dutch holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'nl')->get(); diff --git a/tests/Countries/NicaraguaTest.php b/tests/Countries/NicaraguaTest.php index 840a0609a..d079f1cfd 100644 --- a/tests/Countries/NicaraguaTest.php +++ b/tests/Countries/NicaraguaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate nicaragua holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ni')->get(); diff --git a/tests/Countries/NorthMacedoniaTest.php b/tests/Countries/NorthMacedoniaTest.php index b68507ff4..5021d229e 100644 --- a/tests/Countries/NorthMacedoniaTest.php +++ b/tests/Countries/NorthMacedoniaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate macedonian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'mk')->get(); diff --git a/tests/Countries/NorwayTest.php b/tests/Countries/NorwayTest.php index b9a342763..aba873f40 100644 --- a/tests/Countries/NorwayTest.php +++ b/tests/Countries/NorwayTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate norwegian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'no')->get(); diff --git a/tests/Countries/PanamaTest.php b/tests/Countries/PanamaTest.php index f848a26f2..215cf15ff 100644 --- a/tests/Countries/PanamaTest.php +++ b/tests/Countries/PanamaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate panama holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'pa')->get(); diff --git a/tests/Countries/PeruTest.php b/tests/Countries/PeruTest.php index aff6670eb..127694482 100644 --- a/tests/Countries/PeruTest.php +++ b/tests/Countries/PeruTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate peru holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'pe')->get(); diff --git a/tests/Countries/PhilippinesTest.php b/tests/Countries/PhilippinesTest.php index 4fd997173..22526a812 100644 --- a/tests/Countries/PhilippinesTest.php +++ b/tests/Countries/PhilippinesTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate philippine holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ph')->get(); diff --git a/tests/Countries/PolandTest.php b/tests/Countries/PolandTest.php index 25a75ebc7..ed8e5a333 100644 --- a/tests/Countries/PolandTest.php +++ b/tests/Countries/PolandTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate polish holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'pl')->get(); diff --git a/tests/Countries/PortugalTest.php b/tests/Countries/PortugalTest.php index 7c2ed381f..db49ca87b 100644 --- a/tests/Countries/PortugalTest.php +++ b/tests/Countries/PortugalTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate portuguese holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'pt')->get(); diff --git a/tests/Countries/RomaniaTest.php b/tests/Countries/RomaniaTest.php index 80c177a98..95584b37d 100644 --- a/tests/Countries/RomaniaTest.php +++ b/tests/Countries/RomaniaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate romanian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ro')->get(); diff --git a/tests/Countries/SerbiaTest.php b/tests/Countries/SerbiaTest.php index 1a44fbb44..4f8f640ef 100644 --- a/tests/Countries/SerbiaTest.php +++ b/tests/Countries/SerbiaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate serbian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'sr')->get(); diff --git a/tests/Countries/SlovakiaTest.php b/tests/Countries/SlovakiaTest.php index cb08ebd5a..65ab74a03 100644 --- a/tests/Countries/SlovakiaTest.php +++ b/tests/Countries/SlovakiaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate slovak holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'sk')->get(); diff --git a/tests/Countries/SouthAfricaTest.php b/tests/Countries/SouthAfricaTest.php index fe98169c5..86454c506 100644 --- a/tests/Countries/SouthAfricaTest.php +++ b/tests/Countries/SouthAfricaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate south africa holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'za')->get(); diff --git a/tests/Countries/TurkeyTest.php b/tests/Countries/TurkeyTest.php index 4deb524c9..129d4c4b6 100644 --- a/tests/Countries/TurkeyTest.php +++ b/tests/Countries/TurkeyTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate turkey holidays', function ($year) { - CarbonImmutable::setTestNowAndTimezone($year.'-01-01'); + CarbonImmutable::setTestNow($year.'-01-01'); $holidays = Holidays::for(country: 'tr')->get(); diff --git a/tests/Countries/TurkmenistanTest.php b/tests/Countries/TurkmenistanTest.php index 7f29d6635..c551f5720 100644 --- a/tests/Countries/TurkmenistanTest.php +++ b/tests/Countries/TurkmenistanTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate turkmen holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'tm')->get(); diff --git a/tests/Countries/UgandaTest.php b/tests/Countries/UgandaTest.php index 82ab1f7f6..93dd2ddcf 100644 --- a/tests/Countries/UgandaTest.php +++ b/tests/Countries/UgandaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate ugandan holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ug')->get(); diff --git a/tests/Countries/UkraineTest.php b/tests/Countries/UkraineTest.php index 04e9b3115..cabb8dd1c 100644 --- a/tests/Countries/UkraineTest.php +++ b/tests/Countries/UkraineTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate ukrainian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'ua')->get(); diff --git a/tests/Countries/UnitedStatesTest.php b/tests/Countries/UnitedStatesTest.php index bdf277d2f..32ebff2bf 100644 --- a/tests/Countries/UnitedStatesTest.php +++ b/tests/Countries/UnitedStatesTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate united states holidays after 2021', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'us')->get(); @@ -19,7 +19,7 @@ }); it('can calculate united states holidays before 2021', function () { - CarbonImmutable::setTestNowAndTimezone('2020-01-01'); + CarbonImmutable::setTestNow('2020-01-01'); $holidays = Holidays::for(country: 'us')->get(); diff --git a/tests/Countries/VenezuelaTest.php b/tests/Countries/VenezuelaTest.php index 5b2cf5ea2..77c7682d1 100644 --- a/tests/Countries/VenezuelaTest.php +++ b/tests/Countries/VenezuelaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate venezuelan holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 've')->get(); diff --git a/tests/Countries/ZambiaTest.php b/tests/Countries/ZambiaTest.php index 83e732256..c67b3982d 100644 --- a/tests/Countries/ZambiaTest.php +++ b/tests/Countries/ZambiaTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate zambian holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'zm')->get(); From 06c5f38d480cd703e9567cbcb80a3833429526e4 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:54:44 +0100 Subject: [PATCH 112/127] try a different orthodox easter calculation --- src/Countries/Country.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index b6cfab347..3294bc536 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -56,6 +56,19 @@ protected function easter(int $year): CarbonImmutable protected function orthodoxEaster(int $year): CarbonImmutable { + $a = $year % 4; + $b = $year % 7; + $c = $year % 19; + $d = (19 * $c + 15) % 30; + $e = (2 * $a + 4 * $b - $d + 34) % 7; + $month = floor(($d + $e + 114) / 31); + $day = (($d + $e + 114) % 31) + 1; + + $easterDate = mktime(0, 0, 0, $month, $day + 13, $year); + + return CarbonImmutable::create($year, $month, $day); + + $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; From 799196ff730b37f9b61ecc74f2ba4081df36fcfa Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:13:27 +0100 Subject: [PATCH 113/127] fix calculating orthodox easter --- src/Countries/Country.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 3294bc536..9e9a85533 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -56,23 +56,13 @@ protected function easter(int $year): CarbonImmutable protected function orthodoxEaster(int $year): CarbonImmutable { - $a = $year % 4; - $b = $year % 7; - $c = $year % 19; - $d = (19 * $c + 15) % 30; - $e = (2 * $a + 4 * $b - $d + 34) % 7; - $month = floor(($d + $e + 114) / 31); - $day = (($d + $e + 114) % 31) + 1; - - $easterDate = mktime(0, 0, 0, $month, $day + 13, $year); - - return CarbonImmutable::create($year, $month, $day); - - - $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); - $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; + // Paschal full moon date + // Not covered edge case: + // when the full moon is on a 3 April, Easter is the next Sunday + $easter = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-04-03") + ->startOfDay(); - return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); + return $easter->addDays(easter_days($year, CAL_EASTER_ALWAYS_JULIAN)); } public static function find(string $countryCode): ?Country From 9b0988e48754925c78597b5e03e76057b57f935c Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 10:13:54 +0000 Subject: [PATCH 114/127] Fix styling --- src/Countries/Australia.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Australia.php b/src/Countries/Australia.php index 87dcb6a6f..0b43bae4e 100644 --- a/src/Countries/Australia.php +++ b/src/Countries/Australia.php @@ -36,7 +36,7 @@ protected function variableHolidays(int $year): array 'Good Friday' => $easter->subDays(2), 'Easter Monday' => $easter->addDay(), // https://en.wikipedia.org/wiki/Public_holidays_in_Australia - ...array_filter(match($this->region) { + ...array_filter(match ($this->region) { 'act' => [ 'Canberra Day' => CarbonImmutable::parse("second monday of march {$year}"), 'Easter Saturday' => $easter->subDay(), From eb9833e7f6faf9ca91eaed6a97371a87e282cfad Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:15:15 +0100 Subject: [PATCH 115/127] move to baseline --- phpstan-baseline.neon | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 31f8d0e58..ec51df55b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -12,7 +12,7 @@ parameters: - message: "#^Cannot call method startOfDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" - count: 1 + count: 2 path: src/Countries/Country.php - @@ -20,11 +20,6 @@ parameters: count: 1 path: src/Countries/Country.php - - - message: "#^Parameter \\#1 \\$timestamp of static method Carbon\\\\CarbonImmutable\\:\\:createFromTimestamp\\(\\) expects float\\|int\\|string, int\\|false given\\.$#" - count: 1 - path: src/Countries/Country.php - - message: "#^Parameter \\#2 \\$callback of function uasort expects callable\\(bool\\|Carbon\\\\CarbonImmutable, bool\\|Carbon\\\\CarbonImmutable\\)\\: int, Closure\\(Carbon\\\\CarbonImmutable, Carbon\\\\CarbonImmutable\\)\\: int\\<\\-1, 1\\> given\\.$#" count: 1 From 03fe5c205528416b95b0e3b0a45a80d6b1090275 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:46:41 +0100 Subject: [PATCH 116/127] add a test case to make sure orthodox easter is calculated correctly --- tests/CountryTest.php | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/CountryTest.php diff --git a/tests/CountryTest.php b/tests/CountryTest.php new file mode 100644 index 000000000..598698254 --- /dev/null +++ b/tests/CountryTest.php @@ -0,0 +1,51 @@ +setAccessible(true); + + $easter = $reflectionMethod->invoke($country, $year); + + expect($easter->format('Y-m-d'))->toBe($date); +})->with([ + [1997, "1997-04-27"], + [1998, "1998-04-19"], + [1999, "1999-04-11"], + [2000, "2000-04-30"], + [2001, "2001-04-15"], + [2002, "2002-05-05"], + [2003, "2003-04-27"], + [2004, "2004-04-11"], + [2005, "2005-05-01"], + [2006, "2006-04-23"], + [2007, "2007-04-08"], + [2008, "2008-04-27"], + [2009, "2009-04-19"], + [2010, "2010-04-04"], + [2011, "2011-04-24"], + [2012, "2012-04-15"], + [2013, "2013-05-05"], + [2014, "2014-04-20"], + [2015, "2015-04-12"], + [2016, "2016-05-01"], + [2017, "2017-04-16"], + [2018, "2018-04-08"], + [2019, "2019-04-28"], + [2020, "2020-04-19"], + [2021, "2021-05-02"], + [2022, "2022-04-24"], + [2023, "2023-04-16"], + [2024, "2024-05-05"], + [2025, "2025-04-20"], + [2026, "2026-04-12"], + [2027, "2027-05-02"], + [2028, "2028-04-16"], + [2029, "2029-04-08"], +]); From 76a87d7b3459193e920e48102ef7de0d42f75a7c Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 10:47:02 +0000 Subject: [PATCH 117/127] Fix styling --- tests/CountryTest.php | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/CountryTest.php b/tests/CountryTest.php index 598698254..513b7c419 100644 --- a/tests/CountryTest.php +++ b/tests/CountryTest.php @@ -15,37 +15,37 @@ expect($easter->format('Y-m-d'))->toBe($date); })->with([ - [1997, "1997-04-27"], - [1998, "1998-04-19"], - [1999, "1999-04-11"], - [2000, "2000-04-30"], - [2001, "2001-04-15"], - [2002, "2002-05-05"], - [2003, "2003-04-27"], - [2004, "2004-04-11"], - [2005, "2005-05-01"], - [2006, "2006-04-23"], - [2007, "2007-04-08"], - [2008, "2008-04-27"], - [2009, "2009-04-19"], - [2010, "2010-04-04"], - [2011, "2011-04-24"], - [2012, "2012-04-15"], - [2013, "2013-05-05"], - [2014, "2014-04-20"], - [2015, "2015-04-12"], - [2016, "2016-05-01"], - [2017, "2017-04-16"], - [2018, "2018-04-08"], - [2019, "2019-04-28"], - [2020, "2020-04-19"], - [2021, "2021-05-02"], - [2022, "2022-04-24"], - [2023, "2023-04-16"], - [2024, "2024-05-05"], - [2025, "2025-04-20"], - [2026, "2026-04-12"], - [2027, "2027-05-02"], - [2028, "2028-04-16"], - [2029, "2029-04-08"], + [1997, '1997-04-27'], + [1998, '1998-04-19'], + [1999, '1999-04-11'], + [2000, '2000-04-30'], + [2001, '2001-04-15'], + [2002, '2002-05-05'], + [2003, '2003-04-27'], + [2004, '2004-04-11'], + [2005, '2005-05-01'], + [2006, '2006-04-23'], + [2007, '2007-04-08'], + [2008, '2008-04-27'], + [2009, '2009-04-19'], + [2010, '2010-04-04'], + [2011, '2011-04-24'], + [2012, '2012-04-15'], + [2013, '2013-05-05'], + [2014, '2014-04-20'], + [2015, '2015-04-12'], + [2016, '2016-05-01'], + [2017, '2017-04-16'], + [2018, '2018-04-08'], + [2019, '2019-04-28'], + [2020, '2020-04-19'], + [2021, '2021-05-02'], + [2022, '2022-04-24'], + [2023, '2023-04-16'], + [2024, '2024-05-05'], + [2025, '2025-04-20'], + [2026, '2026-04-12'], + [2027, '2027-05-02'], + [2028, '2028-04-16'], + [2029, '2029-04-08'], ]); From 1fa7a39e20b2938ddd46b70f07b9eaf123a24740 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:50:10 +0100 Subject: [PATCH 118/127] use our invade package instead of Reflection --- composer.json | 1 + tests/CountryTest.php | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 9f8a2f7fb..8e0f585dc 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "laravel/prompts": "^0.1.15", "pestphp/pest": "^2.31", "phpstan/phpstan": "^1.10.56", + "spatie/invade": "^2.0", "spatie/ray": "^1.40.1", "symfony/var-dumper": "^6.4" }, diff --git a/tests/CountryTest.php b/tests/CountryTest.php index 513b7c419..6699ab606 100644 --- a/tests/CountryTest.php +++ b/tests/CountryTest.php @@ -2,16 +2,12 @@ namespace Spatie\Holidays\Tests; -use ReflectionMethod; use Spatie\Holidays\Countries\Belgium; it('can calculate orthodox easter', function (int $year, string $date) { $country = Belgium::make(); - $reflectionMethod = new ReflectionMethod('Spatie\Holidays\Countries\Belgium', 'orthodoxEaster'); - $reflectionMethod->setAccessible(true); - - $easter = $reflectionMethod->invoke($country, $year); + $easter = invade($country)->orthodoxEaster($year); expect($easter->format('Y-m-d'))->toBe($date); })->with([ From 18cd8b263d179875853938342e9296708a27366e Mon Sep 17 00:00:00 2001 From: Onyile Bassey Felix Date: Thu, 25 Jan 2024 12:02:57 +0100 Subject: [PATCH 119/127] Update Australia.php (#178) --- src/Countries/Australia.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Countries/Australia.php b/src/Countries/Australia.php index 0b43bae4e..82273158e 100644 --- a/src/Countries/Australia.php +++ b/src/Countries/Australia.php @@ -92,7 +92,6 @@ protected function variableHolidays(int $year): array }), ]; } - // https://business.vic.gov.au/business-information/public-holidays/victorian-public-holidays-2025 // https://en.wikipedia.org/wiki/List_of_VFL/AFL_premiers#VFL/AFL_premierships protected function fridayBeforeAflGrandFinal(int $year): ?CarbonImmutable @@ -108,7 +107,6 @@ protected function fridayBeforeAflGrandFinal(int $year): ?CarbonImmutable default => CarbonImmutable::parse("last friday of september {$year}"), }; } - protected function sovereignBirthdayKey(int $year): string { // https://www.abc.net.au/news/2022-09-22/queens-birthday-public-holiday-becomes-kings-birthday/101453408 From 37b07173ed8c1df13919048015dad9e62ba6ff00 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 11:03:24 +0000 Subject: [PATCH 120/127] Fix styling --- src/Countries/Australia.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Countries/Australia.php b/src/Countries/Australia.php index 82273158e..0b43bae4e 100644 --- a/src/Countries/Australia.php +++ b/src/Countries/Australia.php @@ -92,6 +92,7 @@ protected function variableHolidays(int $year): array }), ]; } + // https://business.vic.gov.au/business-information/public-holidays/victorian-public-holidays-2025 // https://en.wikipedia.org/wiki/List_of_VFL/AFL_premiers#VFL/AFL_premierships protected function fridayBeforeAflGrandFinal(int $year): ?CarbonImmutable @@ -107,6 +108,7 @@ protected function fridayBeforeAflGrandFinal(int $year): ?CarbonImmutable default => CarbonImmutable::parse("last friday of september {$year}"), }; } + protected function sovereignBirthdayKey(int $year): string { // https://www.abc.net.au/news/2022-09-22/queens-birthday-public-holiday-becomes-kings-birthday/101453408 From 59e6ae1ce14691f8d03ec04154901244f4668d1f Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:16:27 +0100 Subject: [PATCH 121/127] fix warning in case a file is not found --- src/Concerns/Translatable.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php index 0c65b5f7a..237c8905a 100644 --- a/src/Concerns/Translatable.php +++ b/src/Concerns/Translatable.php @@ -13,8 +13,13 @@ protected function translate(string $country, string $name, ?string $locale = nu } $countryName = strtolower($country); + $filePath = __DIR__."/../../lang/{$countryName}/{$locale}/holidays.json"; - $content = file_get_contents(__DIR__."/../../lang/{$countryName}/{$locale}/holidays.json"); + if (file_exists($filePath)) { + $content = file_get_contents($filePath); + } else { + throw InvalidLocale::notFound($country, $locale); + } if ($content === false) { throw InvalidLocale::notFound($country, $locale); From 0eb53b7b84c9a7a9c1538999529c23816733a881 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 11:17:39 +0000 Subject: [PATCH 122/127] Update CHANGELOG --- CHANGELOG.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14dc75264..326828cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,46 @@ All notable changes to `holidays` will be documented in this file. +## 1.3.0 - 2024-01-25 + +### What's Changed + +* Add Ukrainian holidays by @kapi14 in https://github.com/spatie/holidays/pull/112 +* Added Turkey holidays by @thecaliskan in https://github.com/spatie/holidays/pull/70 +* Added has helper by @thecaliskan in https://github.com/spatie/holidays/pull/170 +* Add Slovakia holidays by @patressz in https://github.com/spatie/holidays/pull/102 +* Add support for multi languages by @Nielsvanpach in https://github.com/spatie/holidays/pull/177 +* Add latvian holidays by @IvarsSaudinis in https://github.com/spatie/holidays/pull/169 +* Added Colombia Holidays by @alvleont in https://github.com/spatie/holidays/pull/55 +* Add Finnish Holidays by @ConnySjoblom in https://github.com/spatie/holidays/pull/85 +* Add Japan support by @mkokio in https://github.com/spatie/holidays/pull/160 +* Add United States Holidays by @arcdigital in https://github.com/spatie/holidays/pull/26 +* Add Serbian holidays by @knubbe82 in https://github.com/spatie/holidays/pull/107 +* Add El Salvador Holidays by @vlltr in https://github.com/spatie/holidays/pull/93 +* Belarus Holidays by @Jampire in https://github.com/spatie/holidays/pull/156 +* Adding German holidays by @arnebr in https://github.com/spatie/holidays/pull/8 +* Add Australian Holidays by @patrickomeara in https://github.com/spatie/holidays/pull/43 +* Update Australia.php by @OnyileFelix1 in https://github.com/spatie/holidays/pull/178 +* Bug fix: calculating orthodox easter by @Nielsvanpach in https://github.com/spatie/holidays/pull/180 + +### New Contributors + +* @kapi14 made their first contribution in https://github.com/spatie/holidays/pull/112 +* @patressz made their first contribution in https://github.com/spatie/holidays/pull/102 +* @IvarsSaudinis made their first contribution in https://github.com/spatie/holidays/pull/169 +* @alvleont made their first contribution in https://github.com/spatie/holidays/pull/55 +* @ConnySjoblom made their first contribution in https://github.com/spatie/holidays/pull/85 +* @mkokio made their first contribution in https://github.com/spatie/holidays/pull/160 +* @arcdigital made their first contribution in https://github.com/spatie/holidays/pull/26 +* @knubbe82 made their first contribution in https://github.com/spatie/holidays/pull/107 +* @vlltr made their first contribution in https://github.com/spatie/holidays/pull/93 +* @Jampire made their first contribution in https://github.com/spatie/holidays/pull/156 +* @arnebr made their first contribution in https://github.com/spatie/holidays/pull/8 +* @patrickomeara made their first contribution in https://github.com/spatie/holidays/pull/43 +* @OnyileFelix1 made their first contribution in https://github.com/spatie/holidays/pull/178 + +**Full Changelog**: https://github.com/spatie/holidays/compare/1.2.0...1.3.0 + ## 1.2.0 - 2024-01-23 ### What's Changed From c73c665cc6e2bd70557c3c019dcbf8a4b92a1c41 Mon Sep 17 00:00:00 2001 From: Rkishahaha <67111239+Rkishahaha@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:30:05 +0100 Subject: [PATCH 123/127] Add Montenegro holidays (#171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Montenegro holidays * Add English and Serbian translations for Montenegro holidays --------- Co-authored-by: Marko Ršumović --- lang/montenegro/en/holidays.json | 18 +++++ lang/montenegro/sr/holidays.json | 18 +++++ src/Countries/Montenegro.php | 49 ++++++++++++++ .../it_can_calculate_montenegro_holidays.snap | 66 +++++++++++++++++++ tests/Countries/MontenegroTest.php | 18 +++++ 5 files changed, 169 insertions(+) create mode 100644 lang/montenegro/en/holidays.json create mode 100644 lang/montenegro/sr/holidays.json create mode 100644 src/Countries/Montenegro.php create mode 100644 tests/.pest/snapshots/Countries/MontenegroTest/it_can_calculate_montenegro_holidays.snap create mode 100644 tests/Countries/MontenegroTest.php diff --git a/lang/montenegro/en/holidays.json b/lang/montenegro/en/holidays.json new file mode 100644 index 000000000..8c7424593 --- /dev/null +++ b/lang/montenegro/en/holidays.json @@ -0,0 +1,18 @@ +{ + "Nova godina - prvi dan": "New Year - first day", + "Nova godina - drugi dan": "New Year - second day", + "Badnji dan": "Christmas Eve", + "Božić - prvi dan": "Christmas - first day", + "Božić - drugi dan": "Christmas - second day", + "Praznik rada - prvi dan": "Labour Day - first day", + "Praznik rada - drugi dan": "Labour Day - second day", + "Veliki petak": "Good Friday", + "Vaskrs": "Easter", + "Vaskršnji ponedjeljak": "Easter Monday", + "Dan nezavisnosti - prvi dan": "Independence Day - first day", + "Dan nezavisnosti - drugi dan": "Independence Day - second day", + "Dan državnosti - prvi dan": "National Day - first day", + "Dan državnosti - drugi dan": "National Day - second day", + "Njegošev dan - prvi dan": "Njegoš's Day - first day", + "Njegošev dan - drugi dan": "Njegoš's Day - second day" +} \ No newline at end of file diff --git a/lang/montenegro/sr/holidays.json b/lang/montenegro/sr/holidays.json new file mode 100644 index 000000000..e09ad680a --- /dev/null +++ b/lang/montenegro/sr/holidays.json @@ -0,0 +1,18 @@ +{ + "Nova godina - prvi dan": "Nova godina - prvi dan", + "Nova godina - drugi dan": "Nova godina - drugi dan", + "Badnji dan": "Badnji dan", + "Božić - prvi dan": "Božić - prvi dan", + "Božić - drugi dan": "Božić - drugi dan", + "Praznik rada - prvi dan": "Praznik rada - prvi dan", + "Praznik rada - drugi dan": "Praznik rada - drugi dan", + "Veliki petak": "Veliki petak", + "Vaskrs": "Vaskrs", + "Vaskršnji ponedjeljak": "Vaskršnji ponedeljak", + "Dan nezavisnosti - prvi dan": "Dan nezavisnosti - prvi dan", + "Dan nezavisnosti - drugi dan": "Dan nezavisnosti - drugi dan", + "Dan državnosti - prvi dan": "Dan državnosti - prvi dan", + "Dan državnosti - drugi dan": "Dan državnosti - drugi dan", + "Njegošev dan - prvi dan": "Njegošev dan - prvi dan", + "Njegošev dan - drugi dan": "Njegošev dan - drugi dan" +} \ No newline at end of file diff --git a/src/Countries/Montenegro.php b/src/Countries/Montenegro.php new file mode 100644 index 000000000..537a4f9bd --- /dev/null +++ b/src/Countries/Montenegro.php @@ -0,0 +1,49 @@ + '01-01', + 'Nova godina - drugi dan' => '01-02', + 'Badnji dan' => '01-06', + 'Božić - prvi dan' => '01-07', + 'Božić - drugi dan' => '01-08', + 'Praznik rada - prvi dan' => '05-01', + 'Praznik rada - drugi dan' => '05-02', + 'Dan nezavisnosti - prvi dan' => '05-21', + 'Dan nezavisnosti - drugi dan' => '05-22', + 'Dan državnosti - prvi dan' => '07-13', + 'Dan državnosti - drugi dan' => '07-14', + 'Njegošev dan - prvi dan' => '11-13', + 'Njegošev dan - drugi dan' => '11-14', + + ], $this->variableHolidays($year)); + } + + /** @return array */ + public function variableHolidays(int $year) : array + { + // Orthodox Easter calculation needs to be in the same timezone as the country + $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone('Europe/Podgorica'); + $goodFriday = $orthodoxEaster->copy()->subDays(2); + $orthodoxEasterMonday = $orthodoxEaster->copy()->addDay(); + + return [ + 'Vaskrs' => $orthodoxEaster, + 'Vaskršnji ponedjeljak' => $orthodoxEasterMonday, + 'Veliki petak' => $goodFriday, + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/MontenegroTest/it_can_calculate_montenegro_holidays.snap b/tests/.pest/snapshots/Countries/MontenegroTest/it_can_calculate_montenegro_holidays.snap new file mode 100644 index 000000000..1e39c5b16 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MontenegroTest/it_can_calculate_montenegro_holidays.snap @@ -0,0 +1,66 @@ +[ + { + "name": "Nova godina - prvi dan", + "date": "2024-01-01" + }, + { + "name": "Nova godina - drugi dan", + "date": "2024-01-02" + }, + { + "name": "Badnji dan", + "date": "2024-01-06" + }, + { + "name": "Bo\u017ei\u0107 - prvi dan", + "date": "2024-01-07" + }, + { + "name": "Bo\u017ei\u0107 - drugi dan", + "date": "2024-01-08" + }, + { + "name": "Praznik rada - prvi dan", + "date": "2024-05-01" + }, + { + "name": "Praznik rada - drugi dan", + "date": "2024-05-02" + }, + { + "name": "Veliki petak", + "date": "2024-05-03" + }, + { + "name": "Vaskrs", + "date": "2024-05-05" + }, + { + "name": "Vaskr\u0161nji ponedjeljak", + "date": "2024-05-06" + }, + { + "name": "Dan nezavisnosti - prvi dan", + "date": "2024-05-21" + }, + { + "name": "Dan nezavisnosti - drugi dan", + "date": "2024-05-22" + }, + { + "name": "Dan dr\u017eavnosti - prvi dan", + "date": "2024-07-13" + }, + { + "name": "Dan dr\u017eavnosti - drugi dan", + "date": "2024-07-14" + }, + { + "name": "Njego\u0161ev dan - prvi dan", + "date": "2024-11-13" + }, + { + "name": "Njego\u0161ev dan - drugi dan", + "date": "2024-11-14" + } +] \ No newline at end of file diff --git a/tests/Countries/MontenegroTest.php b/tests/Countries/MontenegroTest.php new file mode 100644 index 000000000..d28c000b4 --- /dev/null +++ b/tests/Countries/MontenegroTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); \ No newline at end of file From 941fbfbda35c717bccbc41643244c80b84eb2c4d Mon Sep 17 00:00:00 2001 From: Monteiro Futila Domingos <91145941+monteirofutila@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:30:16 +0100 Subject: [PATCH 124/127] Add Angola Holidays (#89) --- src/Countries/Angola.php | 42 ++++++++++++++++ .../it_can_calculate_angola_holidays.snap | 50 +++++++++++++++++++ tests/Countries/AngolaTest.php | 18 +++++++ 3 files changed, 110 insertions(+) create mode 100644 src/Countries/Angola.php create mode 100644 tests/.pest/snapshots/Countries/AngolaTest/it_can_calculate_angola_holidays.snap create mode 100644 tests/Countries/AngolaTest.php diff --git a/src/Countries/Angola.php b/src/Countries/Angola.php new file mode 100644 index 000000000..e83aa55ed --- /dev/null +++ b/src/Countries/Angola.php @@ -0,0 +1,42 @@ + '01-01', + 'Dia do Inicio da Luta Armada de Libertação Nacional' => '02-04', + 'Dia Internacional da Mulher' => '03-08', + 'Dia da Paz' => '04-04', + 'Dia Internacional do Trabalhador' => '05-01', + 'Dia do Fundador da Nação e do Herói Nacional' => '09-17', + 'Dia dos Finados' => '11-02', + 'Dia da Independência Nacional' => '11-11', + 'Dia do Natal' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Africa/Luanda'); + + return [ + 'Carnaval' => $easter->subDays(47), + 'Sexta Feira Santa' => $easter->subDays(2), + 'Páscoa' => $easter, + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/AngolaTest/it_can_calculate_angola_holidays.snap b/tests/.pest/snapshots/Countries/AngolaTest/it_can_calculate_angola_holidays.snap new file mode 100644 index 000000000..a97d32a98 --- /dev/null +++ b/tests/.pest/snapshots/Countries/AngolaTest/it_can_calculate_angola_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Dia de Ano Novo", + "date": "2024-01-01" + }, + { + "name": "Dia do Inicio da Luta Armada de Liberta\u00e7\u00e3o Nacional", + "date": "2024-02-04" + }, + { + "name": "Carnaval", + "date": "2024-02-13" + }, + { + "name": "Dia Internacional da Mulher", + "date": "2024-03-08" + }, + { + "name": "Sexta Feira Santa", + "date": "2024-03-29" + }, + { + "name": "P\u00e1scoa", + "date": "2024-03-31" + }, + { + "name": "Dia da Paz", + "date": "2024-04-04" + }, + { + "name": "Dia Internacional do Trabalhador", + "date": "2024-05-01" + }, + { + "name": "Dia do Fundador da Na\u00e7\u00e3o e do Her\u00f3i Nacional", + "date": "2024-09-17" + }, + { + "name": "Dia dos Finados", + "date": "2024-11-02" + }, + { + "name": "Dia da Independ\u00eancia Nacional", + "date": "2024-11-11" + }, + { + "name": "Dia do Natal", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/AngolaTest.php b/tests/Countries/AngolaTest.php new file mode 100644 index 000000000..ae0e07518 --- /dev/null +++ b/tests/Countries/AngolaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From d084b1c55347e958aa451516f0a24fffa2ab9df5 Mon Sep 17 00:00:00 2001 From: Nielsvanpach Date: Thu, 25 Jan 2024 11:30:35 +0000 Subject: [PATCH 125/127] Fix styling --- src/Countries/Montenegro.php | 98 +++++++++++++++--------------- tests/Countries/MontenegroTest.php | 36 +++++------ 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/Countries/Montenegro.php b/src/Countries/Montenegro.php index 537a4f9bd..2423f1e81 100644 --- a/src/Countries/Montenegro.php +++ b/src/Countries/Montenegro.php @@ -1,49 +1,49 @@ - '01-01', - 'Nova godina - drugi dan' => '01-02', - 'Badnji dan' => '01-06', - 'Božić - prvi dan' => '01-07', - 'Božić - drugi dan' => '01-08', - 'Praznik rada - prvi dan' => '05-01', - 'Praznik rada - drugi dan' => '05-02', - 'Dan nezavisnosti - prvi dan' => '05-21', - 'Dan nezavisnosti - drugi dan' => '05-22', - 'Dan državnosti - prvi dan' => '07-13', - 'Dan državnosti - drugi dan' => '07-14', - 'Njegošev dan - prvi dan' => '11-13', - 'Njegošev dan - drugi dan' => '11-14', - - ], $this->variableHolidays($year)); - } - - /** @return array */ - public function variableHolidays(int $year) : array - { - // Orthodox Easter calculation needs to be in the same timezone as the country - $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone('Europe/Podgorica'); - $goodFriday = $orthodoxEaster->copy()->subDays(2); - $orthodoxEasterMonday = $orthodoxEaster->copy()->addDay(); - - return [ - 'Vaskrs' => $orthodoxEaster, - 'Vaskršnji ponedjeljak' => $orthodoxEasterMonday, - 'Veliki petak' => $goodFriday, - ]; - } -} + '01-01', + 'Nova godina - drugi dan' => '01-02', + 'Badnji dan' => '01-06', + 'Božić - prvi dan' => '01-07', + 'Božić - drugi dan' => '01-08', + 'Praznik rada - prvi dan' => '05-01', + 'Praznik rada - drugi dan' => '05-02', + 'Dan nezavisnosti - prvi dan' => '05-21', + 'Dan nezavisnosti - drugi dan' => '05-22', + 'Dan državnosti - prvi dan' => '07-13', + 'Dan državnosti - drugi dan' => '07-14', + 'Njegošev dan - prvi dan' => '11-13', + 'Njegošev dan - drugi dan' => '11-14', + + ], $this->variableHolidays($year)); + } + + /** @return array */ + public function variableHolidays(int $year): array + { + // Orthodox Easter calculation needs to be in the same timezone as the country + $orthodoxEaster = $this->orthodoxEaster($year)->setTimezone('Europe/Podgorica'); + $goodFriday = $orthodoxEaster->copy()->subDays(2); + $orthodoxEasterMonday = $orthodoxEaster->copy()->addDay(); + + return [ + 'Vaskrs' => $orthodoxEaster, + 'Vaskršnji ponedjeljak' => $orthodoxEasterMonday, + 'Veliki petak' => $goodFriday, + ]; + } +} diff --git a/tests/Countries/MontenegroTest.php b/tests/Countries/MontenegroTest.php index d28c000b4..9f5078b93 100644 --- a/tests/Countries/MontenegroTest.php +++ b/tests/Countries/MontenegroTest.php @@ -1,18 +1,18 @@ -get(); - - expect($holidays) - ->toBeArray() - ->not()->toBeEmpty(); - - expect(formatDates($holidays))->toMatchSnapshot(); -}); \ No newline at end of file +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 9f20ab2c4e6e671ffaa0875a4152f7b52a3ca3a4 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:33:32 +0100 Subject: [PATCH 126/127] correctly calculate easter + fix el salvador --- src/Countries/Angola.php | 3 +-- src/Countries/ElSalvador.php | 5 ++--- src/Countries/Finland.php | 3 +-- src/Countries/Norway.php | 3 +-- src/Countries/Uganda.php | 2 +- .../it_can_calculate_el_salvador_holidays.snap | 6 +++--- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Countries/Angola.php b/src/Countries/Angola.php index e83aa55ed..0ef3bb72a 100644 --- a/src/Countries/Angola.php +++ b/src/Countries/Angola.php @@ -30,8 +30,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Africa/Luanda'); + $easter = $this->easter($year); return [ 'Carnaval' => $easter->subDays(47), diff --git a/src/Countries/ElSalvador.php b/src/Countries/ElSalvador.php index c3a84a224..7766745b7 100644 --- a/src/Countries/ElSalvador.php +++ b/src/Countries/ElSalvador.php @@ -28,13 +28,12 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('America/El_Salvador'); + $easter = $this->easter($year); return [ 'Jueves Santo' => $easter->subDays(3), 'Viernes Santo' => $easter->subDays(2), - 'Sábado de Gloria' => $easter->subDays(1), + 'Sábado de Gloria' => $easter->subDay(), ]; } } diff --git a/src/Countries/Finland.php b/src/Countries/Finland.php index 103fda86f..69fa1fd39 100644 --- a/src/Countries/Finland.php +++ b/src/Countries/Finland.php @@ -32,8 +32,7 @@ protected function fixedHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Helsinki'); + $easter = $this->easter($year); $midsummerDay = CarbonImmutable::createFromDate($year, 6, 20) ->next(CarbonImmutable::SATURDAY); diff --git a/src/Countries/Norway.php b/src/Countries/Norway.php index c4d09737b..f2115d0c1 100644 --- a/src/Countries/Norway.php +++ b/src/Countries/Norway.php @@ -25,8 +25,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Oslo'); + $easter = $this->easter($year); $holidays = [ 'Skjærtorsdag' => $easter->subDays(3), diff --git a/src/Countries/Uganda.php b/src/Countries/Uganda.php index 90a0af5bf..bbff49416 100644 --- a/src/Countries/Uganda.php +++ b/src/Countries/Uganda.php @@ -32,7 +32,7 @@ protected function allHolidays(int $year): array */ private function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Africa/Nairobi'); + $easter = $this->easter($year); return [ 'Good Friday' => $easter->subDays(2), diff --git a/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap b/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap index 2586f7686..63c794a4e 100644 --- a/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap +++ b/tests/.pest/snapshots/Countries/ElSalvadorTest/it_can_calculate_el_salvador_holidays.snap @@ -5,15 +5,15 @@ }, { "name": "Jueves Santo", - "date": "2024-03-27" + "date": "2024-03-28" }, { "name": "Viernes Santo", - "date": "2024-03-28" + "date": "2024-03-29" }, { "name": "S\u00e1bado de Gloria", - "date": "2024-03-29" + "date": "2024-03-30" }, { "name": "D\u00eda del Trabajo", From b5bb47f88c44f40e578981d854a48423c4e60bd9 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:34:54 +0100 Subject: [PATCH 127/127] run code styling on PRs --- .github/workflows/fix-php-code-style-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index 30e62c774..99b82e963 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,6 +1,6 @@ name: Fix PHP code style issues -on: [push] +on: [push, pull_request] permissions: contents: write