From 9df73f865671e3f7ca7bb1d9c50ad5e44205b35b Mon Sep 17 00:00:00 2001 From: Wessam Ahmed Date: Wed, 7 Feb 2024 12:39:54 +0200 Subject: [PATCH] Add Egyptian holidays (#155) * Add Egyptian holidays * For consistency * Minor enhancements * Rename holiday * Minor * Minor * Pint * Rename test * Rename method * Early return * Docblock * Docblock * Add New Year's * Minor * Add holidays statically/Turkey solution * Fix translations * Minor * Remove snapshot * This can be misunderstood * Add more translations --------- Co-authored-by: Wessam Ahmed --- lang/egypt/ar/holidays.json | 46 ++- lang/egypt/en/holidays.json | 33 ++ src/Countries/Egypt.php | 365 ++++++++++++++++-- .../it_can_calculate_egypt_holidays.snap | 86 ----- .../it_can_calculate_egyptian_holidays.snap | 130 +++++++ tests/Countries/EgyptTest.php | 9 +- 6 files changed, 536 insertions(+), 133 deletions(-) create mode 100644 lang/egypt/en/holidays.json delete mode 100644 tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egypt_holidays.snap create mode 100644 tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egyptian_holidays.snap diff --git a/lang/egypt/ar/holidays.json b/lang/egypt/ar/holidays.json index 2ca7af8d3..efdf7779f 100644 --- a/lang/egypt/ar/holidays.json +++ b/lang/egypt/ar/holidays.json @@ -1,23 +1,33 @@ { - "New Year\n's Day": "يوم رأس السنة", - "Coptic Christmas": "عيد الميلاد القبطي", - "Revolution Day January 25": "عيد ثورة 25 يناير", + "New Year\\'s Day": "رأس السنة الميلادية", + "Coptic Christmas Day": "عيد الميلاد المجيد", + "Revolution Day 2011": "ثورة ٢٥ يناير وعيد الشرطة", "March Equinox": "اعتدال مارس", - "Sinai Liberation": "تحرير سيناء", - "Labor": "العمل", - "Coptic Good": "الصالح القبطي", - "Coptic Holy": "المقدس القبطي", - "Coptic Easter": "عيد الفصح القبطي", - "Spring Festival": "مهرجان الربيع", - "June Solstice": "انقلاب يونيو", - "June 30 Revolution": "ثورة 30 يونيو", - "Day off for June 30 Revolution": "يوم عطلة بمناسبة ثورة 30 يونيو", - "Revolution Day July 23": "عيد ثورة 23 يوليو", - "Day off for Revolution Day July 23": "يوم عطلة بمناسبة عيد ثورة 23 يوليو", + "Sinai Liberation Day": "عيد تحرير سيناء (٢٥ أبريل ١٩٨٢)", + "Labour Day": "عيد العمال", + "Coptic Good Friday": "الصالح القبطي", + "Coptic Holy Saturday": "المقدس القبطي", + "Coptic Easter Sunday": "عيد الفصح القبطي", + "Spring Festival": "عيد شم النسيم", + "June Solstice": "الانقلاب الشمسي في يونيو", + "June 30 Revolution Day": "عيد ثورة 30 يونيو", + "Day off for June 30 Revolution Day": "بمناسبة عيد ثورة 30 يونيو", + "Revolution Day": "عيد ثورة 23 يوليو", + "Day off for Revolution Day": "بمناسبة عيد ثورة 23 يوليو", "Flooding of the Nile": "فيضان النيل", "Nayrouz": "النيروز", "September Equinox": "الاعتدال في سبتمبر", - "Armed Forces": "القوات المسلحة", - "Day off for Armed Forces": "يوم عطلة للقوات المسلحة", - "December Solstice": "الانقلاب الشمسي في ديسمبر" -} \ No newline at end of file + "Armed Forces Day": "عيد القوات المسلحة (٦ أكتوبر ١٩٧٣)", + "Day off for Armed Forces Day": "يوم عطلة للقوات المسلحة", + "December Solstice": "الانقلاب الشمسي في ديسمبر", + "Eid al-Fitr": "عيد الفطر المبارك", + "Eid al-Fitr Day 2": "عيد الفطر المبارك", + "Eid al-Fitr Day 3": "عيد الفطر المبارك", + "Eid al-Adha": "عيد الأضحى المبارك", + "Eid al-Adha Day 2": "عيد الأضحى المبارك", + "Eid al-Adha Day 3": "عيد الأضحى المبارك", + "Eid al-Adha Day 4": "عيد الأضحى المبارك", + "Islamic New Year": "رأس السنة الهجرية", + "Birthday of the Prophet Muhammad": "المولد النبوي الشريف", + "Arafat Day": "يوم عرفة (وقفة عيد الأضحى)" +} diff --git a/lang/egypt/en/holidays.json b/lang/egypt/en/holidays.json new file mode 100644 index 000000000..a503639ee --- /dev/null +++ b/lang/egypt/en/holidays.json @@ -0,0 +1,33 @@ +{ + "New Year\\'s Day": "New Year\\'s Day", + "Coptic Christmas Day": "Coptic Christmas Day", + "Revolution Day 2011": "Revolution Day 2011", + "March Equinox": "March Equinox", + "Sinai Liberation Day": "Sinai Liberation Day", + "Labour Day": "Labour Day", + "Coptic Good Friday": "Coptic Good Friday", + "Coptic Holy Saturday": "Coptic Holy Saturday", + "Coptic Easter Sunday": "Coptic Easter Sunday", + "Spring Festival": "Spring Festival", + "June Solstice": "June Solstice", + "June 30 Revolution Day": "June 30 Revolution Day", + "Day off for June 30 Revolution Day": "Day off for June 30 Revolution Day", + "Revolution Day": "Revolution Day", + "Day off for Revolution Day": "Day off for Revolution Day", + "Flooding of the Nile": "Flooding of the Nile", + "Nayrouz": "Nayrouz", + "September Equinox": "September Equinox", + "Armed Forces Day": "Armed Forces Day", + "Day off for Armed Forces Day": "Day off for Armed Forces", + "December Solstice": "December Solstice", + "Eid al-Fitr": "Eid al-Fitr", + "Eid al-Fitr Day 2": "Eid al-Fitr", + "Eid al-Fitr Day 3": "Eid al-Fitr", + "Eid al-Adha": "Eid al-Adha", + "Eid al-Adha Day 2": "Eid al-Adha", + "Eid al-Adha Day 3": "Eid al-Adha", + "Eid al-Adha Day 4": "Eid al-Adha", + "Islamic New Year": "Islamic New Year (Muharram)", + "Birthday of the Prophet Muhammad": "Birthday of the Prophet Muhammad", + "Arafat Day": "Arafat Day", +} diff --git a/src/Countries/Egypt.php b/src/Countries/Egypt.php index 4154b53f4..52ec78672 100644 --- a/src/Countries/Egypt.php +++ b/src/Countries/Egypt.php @@ -3,45 +3,360 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; +use RuntimeException; class Egypt extends Country { + protected const EID_AL_FITR_HOLIDAYS = [ + 2005 => '11-04', + 2006 => '10-24', + 2007 => '10-13', + 2008 => '10-02', + 2009 => '09-21', + 2010 => '09-10', + 2011 => '08-30', + 2012 => '08-19', + 2013 => '08-08', + 2014 => '07-28', + 2015 => '07-17', + 2016 => '07-07', + 2017 => '06-26', + 2018 => '06-15', + 2019 => '06-05', + 2020 => '05-24', + 2021 => '05-13', + 2022 => '05-02', + 2023 => '04-20', + 2024 => '04-10', + 2025 => '03-31', + 2026 => '03-21', + 2027 => '03-10', + 2028 => '02-27', + 2029 => '02-15', + 2030 => '02-04', + 2031 => '01-25', + 2032 => '01-15', + 2033 => '01-03', + 2034 => '12-13', + 2035 => '12-02', + 2036 => '11-20', + 2037 => '11-09', + ]; + + protected const ARAFAT_DAY_HOLIDAYS = [ + 2005 => '01-21', + 2006 => '01-10', + 2007 => '01-01', + 2008 => '12-09', + 2009 => '11-26', + 2010 => '11-15', + 2011 => '11-05', + 2012 => '10-25', + 2013 => '10-15', + 2014 => '10-04', + 2015 => '09-23', + 2016 => '09-11', + 2017 => '08-31', + 2018 => '08-20', + 2019 => '08-10', + 2020 => '07-30', + 2021 => '07-19', + 2022 => '07-09', + 2023 => '06-27', + 2024 => '06-16', + 2025 => '06-06', + 2026 => '05-26', + 2027 => '05-16', + 2028 => '05-05', + 2029 => '04-24', + 2030 => '04-13', + 2031 => '04-02', + 2032 => '03-21', + 2033 => '03-11', + 2034 => '03-01', + 2035 => '02-18', + 2036 => '02-07', + 2037 => '01-26', + ]; + + protected const EID_AL_ADHA_HOLIDAYS = [ + 2005 => '01-22', + 2006 => '01-11', + 2007 => '01-02', + 2008 => '12-10', + 2009 => '11-27', + 2010 => '11-16', + 2011 => '11-06', + 2012 => '10-26', + 2013 => '10-16', + 2014 => '10-05', + 2015 => '09-24', + 2016 => '09-12', + 2017 => '08-31', + 2018 => '08-21', + 2019 => '08-11', + 2020 => '07-31', + 2021 => '07-20', + 2022 => '07-09', + 2023 => '06-28', + 2024 => '06-17', + 2025 => '06-07', + 2026 => '05-27', + 2027 => '05-17', + 2028 => '05-06', + 2029 => '04-25', + 2030 => '04-14', + 2031 => '04-03', + 2032 => '03-22', + 2033 => '03-12', + 2034 => '03-02', + 2035 => '02-19', + 2036 => '02-08', + 2037 => '01-27', + ]; + + protected const ISLAMIC_NEW_YEAR_HOLIDAYS = [ + 2005 => '02-10', + 2006 => '01-31', + 2007 => '01-20', + 2008 => '01-10', + 2009 => '12-18', + 2010 => '12-07', + 2011 => '11-27', + 2012 => '11-15', + 2013 => '11-05', + 2014 => '10-25', + 2015 => '10-14', + 2016 => '10-03', + 2017 => '09-22', + 2018 => '09-11', + 2019 => '08-31', + 2020 => '08-20', + 2021 => '08-09', + 2022 => '07-30', + 2023 => '07-19', + 2024 => '07-08', + 2025 => '06-06', + 2026 => '06-17', + 2027 => '06-07', + 2028 => '05-26', + 2029 => '05-15', + 2030 => '05-05', + 2031 => '04-24', + 2032 => '04-12', + 2033 => '04-01', + 2034 => '03-22', + 2035 => '03-12', + 2036 => '02-29', + 2037 => '02-17', + ]; + + protected const ASHURA_HOLIDAYS = [ + 2005 => '02-19', + 2006 => '02-09', + 2007 => '01-29', + 2008 => '01-19', + 2009 => '12-27', + 2010 => '12-16', + 2011 => '12-06', + 2012 => '11-25', + 2013 => '11-15', + 2014 => '11-04', + 2015 => '10-24', + 2016 => '10-13', + 2017 => '10-02', + 2018 => '09-21', + 2019 => '09-10', + 2020 => '08-30', + 2021 => '08-19', + 2022 => '08-08', + 2023 => '07-28', + 2024 => '07-17', + 2025 => '07-07', + 2026 => '06-26', + 2027 => '06-15', + 2028 => '06-04', + 2029 => '05-24', + 2030 => '05-13', + 2031 => '05-02', + 2032 => '04-20', + 2033 => '04-10', + 2034 => '03-30', + 2035 => '03-19', + 2036 => '03-08', + 2037 => '02-25', + ]; + + protected const PROPHET_MUHAMMAD_BIRTHDAY_HOLIDAYS = [ + 2005 => '04-21', + 2006 => '04-11', + 2007 => '03-31', + 2008 => '03-20', + 2009 => '03-09', + 2010 => '02-26', + 2011 => '02-16', + 2012 => '02-05', + 2013 => '01-24', + 2014 => '01-13', + 2015 => '12-23', + 2016 => '12-12', + 2017 => '12-01', + 2018 => '11-20', + 2019 => '11-09', + 2020 => '10-29', + 2021 => '10-21', + 2022 => '10-08', + 2023 => '09-28', + 2024 => '09-16', + 2025 => '09-06', + 2026 => '08-26', + 2027 => '08-15', + 2028 => '08-04', + 2029 => '07-25', + 2030 => '07-14', + 2031 => '07-03', + 2032 => '06-21', + 2033 => '06-10', + 2034 => '05-31', + 2035 => '05-21', + 2036 => '05-09', + 2037 => '04-29', + ]; + public function countryCode(): string { return 'eg'; } + /** + * @return array + */ protected function allHolidays(int $year): array { + $fixedHolidays = $this->fixedHolidays($year); + $variableHolidays = $this->variableHolidays($year); + return array_merge([ - 'New Year\'s Day' => '01-01', - 'Coptic Christmas' => '01-07', - 'Revolution Day January 25' => '01-25', - 'March Equinox' => '03-20', - 'Sinai Liberation' => '04-25', - 'Labor' => '05-01', - 'Coptic Good' => '05-03', - 'Coptic Holy' => '05-04', - 'Coptic Easter' => '05-05', - 'Spring Festival' => '05-06', - 'June Solstice' => '06-20', - 'June 30 Revolution' => '06-30', - 'Day off for June 30 Revolution' => '07-04', - 'Revolution Day July 23' => '07-23', - 'Day off for Revolution Day July 23' => '07-25', - 'Flooding of the Nile' => '08-15', - 'Nayrouz' => '09-11', - 'September Equinox' => '09-22', - 'Armed Forces' => '10-06', - 'Day off for Armed Forces' => '10-10', - 'December Solstice' => '12-21', - ], $this->variableHolidays($year)); + // These are fixed, but seasonal holidays that aren't observed in Egypt + 'New Year\'s Day' => CarbonImmutable::create($year, 1, 1), + 'Flooding of the Nile' => CarbonImmutable::create($year, 8, 15), + 'March Equinox' => CarbonImmutable::create($year, 3, 20), + 'June Solstice' => CarbonImmutable::create($year, 6, 21), + 'September Equinox' => CarbonImmutable::create($year, 9, 22), + 'Nayrouz' => CarbonImmutable::create($year, 9, 11), + 'December Solstice' => CarbonImmutable::create($year, 12, 21), + ], $fixedHolidays, $variableHolidays); } - /** @return array */ + /** + * @return array + */ protected function variableHolidays(int $year): array { - // The variable holidays all follow the lunar calendar, so their dates are not confirmed. - return []; + $orthodoxEaster = $this->orthodoxEaster($year); + + $eidAlFitrDates = $this->getIslamicHolidayDatesForYear(self::EID_AL_FITR_HOLIDAYS, $year, 'Eid al-Fitr', 3); + $eidAlAdhaDates = $this->getIslamicHolidayDatesForYear(self::EID_AL_ADHA_HOLIDAYS, $year, 'Eid al-Adha', 4); + $arafatDayDates = $this->getIslamicHolidayDatesForYear(self::ARAFAT_DAY_HOLIDAYS, $year, 'Arafat Day'); + $islamicNewYearDates = $this->getIslamicHolidayDatesForYear(self::ISLAMIC_NEW_YEAR_HOLIDAYS, $year, 'Islamic New Year'); + $ashuraDates = $this->getIslamicHolidayDatesForYear(self::ASHURA_HOLIDAYS, $year, 'Ashura'); + $prophetMuhammadBirthdayDates = $this->getIslamicHolidayDatesForYear(self::PROPHET_MUHAMMAD_BIRTHDAY_HOLIDAYS, $year, 'Birthday of the Prophet Muhammad'); + + return array_merge([ + 'Coptic Good Friday' => $orthodoxEaster->subDays(2)->toImmutable(), + 'Coptic Holy Saturday' => $orthodoxEaster->subDays()->toImmutable(), + 'Coptic Easter Sunday' => $orthodoxEaster->toImmutable(), + ], $eidAlFitrDates, $eidAlAdhaDates, $arafatDayDates, $islamicNewYearDates, $ashuraDates, $prophetMuhammadBirthdayDates); + } + + /** + * Prepare holiday dates for the given year. + * + * @param array $holidayDates Array mapping years to dates. + * @param int $year The year for which to prepare holiday dates. + * @param string $holidayName The name of the holiday. + * @param int $duration The duration of the holiday in days. + * @return array An array of holiday dates. + */ + private function getIslamicHolidayDatesForYear(array $holidayDates, int $year, string $holidayName, int $duration = 1): array + { + $dates = []; + + /** + * No reliable sources exist for Islamic holidays observed in Egypt prior to 2005. + * So we'll only calculate holidays from 2005 onwards. + * + * @see https://www.timeanddate.com/holidays/egypt + */ + if (isset($holidayDates[$year])) { + $startDay = CarbonImmutable::createFromFormat('Y-m-d', sprintf('%s-%s', $year, $holidayDates[$year])); + + if (! $startDay instanceof CarbonImmutable) { + throw new RuntimeException('Date could not be created.'); + } + + if ($duration === 1) { + // For single-day holidays, use the holiday name without "Day" + $dates[$holidayName] = $startDay; + } else { + // For multi-day holidays, append "Day N" for the second day onwards + for ($i = 0; $i < $duration; $i++) { + $dayLabel = $i === 0 ? $holidayName : sprintf('%s Day %d', $holidayName, $i + 1); + $dates[$dayLabel] = $startDay->addDays($i); + } + } + } + + return $dates; + } + + /** + * @return array + */ + private function fixedHolidays(int $year): array + { + $holidays = [ + 'Coptic Christmas Day' => CarbonImmutable::create($year, 1, 7), + 'Revolution Day 2011' => CarbonImmutable::create($year, 1, 25), + 'Sinai Liberation Day' => CarbonImmutable::create($year, 4, 25), + 'Labour Day' => CarbonImmutable::create($year, 5, 1), + 'June 30 Revolution Day' => CarbonImmutable::create($year, 6, 30), + 'Revolution Day' => CarbonImmutable::create($year, 7, 23), + 'Armed Forces Day' => CarbonImmutable::create($year, 10, 6), + 'Spring Festival' => $this->orthodoxEaster($year)->addDay()->toImmutable(), + ]; + + foreach ($holidays as $name => $date) { + $holidays = array_merge($holidays, $this->adjustForWeekend($name, $date)); + } + + return $holidays; + } + + /** + * @return array + */ + private function adjustForWeekend(string $name, CarbonImmutable|false $date): array + { + $adjustedHolidays = []; + + if (! $date instanceof CarbonImmutable) { + return []; + } + + // Explicitly define this logic to avoid timezone confusion on the CarbonInterface::next() method + if ($date->isFriday() || $date->isSaturday()) { + // If the holiday falls on a weekend (Friday or Saturday), it is observed on the following Sunday + $adjustedHolidays['Day off for '.$name] = $date->next(CarbonInterface::SUNDAY); + } elseif ($date->isSunday() || $date->isThursday()) { + // If the holiday falls on a Sunday or Thursday, it is observed on the same day + $adjustedHolidays[$name] = $date; + } else { + // If the holiday falls on a weekday (Monday, Tuesday, Wednesday), it is observed on the following Thursday + $adjustedHolidays['Day off for '.$name] = $date->next(CarbonInterface::THURSDAY); + } + + return $adjustedHolidays; } } diff --git a/tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egypt_holidays.snap b/tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egypt_holidays.snap deleted file mode 100644 index 97a3a8144..000000000 --- a/tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egypt_holidays.snap +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "name": "New Year's Day", - "date": "2024-01-01" - }, - { - "name": "Coptic Christmas", - "date": "2024-01-07" - }, - { - "name": "Revolution Day January 25", - "date": "2024-01-25" - }, - { - "name": "March Equinox", - "date": "2024-03-20" - }, - { - "name": "Sinai Liberation", - "date": "2024-04-25" - }, - { - "name": "Labor", - "date": "2024-05-01" - }, - { - "name": "Coptic Good", - "date": "2024-05-03" - }, - { - "name": "Coptic Holy", - "date": "2024-05-04" - }, - { - "name": "Coptic Easter", - "date": "2024-05-05" - }, - { - "name": "Spring Festival", - "date": "2024-05-06" - }, - { - "name": "June Solstice", - "date": "2024-06-20" - }, - { - "name": "June 30 Revolution", - "date": "2024-06-30" - }, - { - "name": "Day off for June 30 Revolution", - "date": "2024-07-04" - }, - { - "name": "Revolution Day July 23", - "date": "2024-07-23" - }, - { - "name": "Day off for Revolution Day July 23", - "date": "2024-07-25" - }, - { - "name": "Flooding of the Nile", - "date": "2024-08-15" - }, - { - "name": "Nayrouz", - "date": "2024-09-11" - }, - { - "name": "September Equinox", - "date": "2024-09-22" - }, - { - "name": "Armed Forces", - "date": "2024-10-06" - }, - { - "name": "Day off for Armed Forces", - "date": "2024-10-10" - }, - { - "name": "December Solstice", - "date": "2024-12-21" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egyptian_holidays.snap b/tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egyptian_holidays.snap new file mode 100644 index 000000000..2bd487894 --- /dev/null +++ b/tests/.pest/snapshots/Countries/EgyptTest/it_can_calculate_egyptian_holidays.snap @@ -0,0 +1,130 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Coptic Christmas Day", + "date": "2024-01-07" + }, + { + "name": "Revolution Day 2011", + "date": "2024-01-25" + }, + { + "name": "March Equinox", + "date": "2024-03-20" + }, + { + "name": "Eid al-Fitr", + "date": "2024-04-10" + }, + { + "name": "Eid al-Fitr Day 2", + "date": "2024-04-11" + }, + { + "name": "Eid al-Fitr Day 3", + "date": "2024-04-12" + }, + { + "name": "Sinai Liberation Day", + "date": "2024-04-25" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Day off for Labour Day", + "date": "2024-05-02" + }, + { + "name": "Coptic Good Friday", + "date": "2024-05-03" + }, + { + "name": "Coptic Holy Saturday", + "date": "2024-05-04" + }, + { + "name": "Coptic Easter Sunday", + "date": "2024-05-05" + }, + { + "name": "Spring Festival", + "date": "2024-05-06" + }, + { + "name": "Day off for Spring Festival", + "date": "2024-05-09" + }, + { + "name": "Arafat Day", + "date": "2024-06-16" + }, + { + "name": "Eid al-Adha", + "date": "2024-06-17" + }, + { + "name": "Eid al-Adha Day 2", + "date": "2024-06-18" + }, + { + "name": "Eid al-Adha Day 3", + "date": "2024-06-19" + }, + { + "name": "Eid al-Adha Day 4", + "date": "2024-06-20" + }, + { + "name": "June Solstice", + "date": "2024-06-21" + }, + { + "name": "June 30 Revolution Day", + "date": "2024-06-30" + }, + { + "name": "Islamic New Year", + "date": "2024-07-08" + }, + { + "name": "Ashura", + "date": "2024-07-17" + }, + { + "name": "Revolution Day", + "date": "2024-07-23" + }, + { + "name": "Day off for Revolution Day", + "date": "2024-07-25" + }, + { + "name": "Flooding of the Nile", + "date": "2024-08-15" + }, + { + "name": "Nayrouz", + "date": "2024-09-11" + }, + { + "name": "Birthday of the Prophet Muhammad", + "date": "2024-09-16" + }, + { + "name": "September Equinox", + "date": "2024-09-22" + }, + { + "name": "Armed Forces Day", + "date": "2024-10-06" + }, + { + "name": "December Solstice", + "date": "2024-12-21" + } +] \ No newline at end of file diff --git a/tests/Countries/EgyptTest.php b/tests/Countries/EgyptTest.php index 24f5d9ea5..842b8b4ef 100644 --- a/tests/Countries/EgyptTest.php +++ b/tests/Countries/EgyptTest.php @@ -5,13 +5,14 @@ use Carbon\CarbonImmutable; use Spatie\Holidays\Holidays; -it('can calculate egypt holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); +it('can calculate egyptian holidays', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01', 'Africa/Cairo'); $holidays = Holidays::for(country: 'eg')->get(); expect($holidays) ->toBeArray() - ->not()->toBeEmpty() - ->and(formatDates($holidays))->toMatchSnapshot(); + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); });