From 51240b6c97bec1c9bc1d4cfedf1f7b55a50eb1b9 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Thu, 18 Jan 2024 00:07:51 +0800 Subject: [PATCH 01/18] add Malaysia holiday date --- src/Countries/Malaysia.php | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Countries/Malaysia.php diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php new file mode 100644 index 000000000..b69d37990 --- /dev/null +++ b/src/Countries/Malaysia.php @@ -0,0 +1,40 @@ + '01-01', + 'Hari Wilayah Persekutuan' => '02-01', + 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => '04-15', + 'Hari Pekerja' => '05-01', + 'Hari Hol Pahang' => '05-22', + 'Pesta Keamatan' => '05-30', + 'Hari Sarawak' => '07-22', + 'Hari Kebangsaan' => '08-31', + 'Hari Malaysia' => '09-16', + 'Hari Krismas' => '12-25', + ], $this->variableHolidays($year)); + } + + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Asia/Kuala_Lumpur'); + + return [ + 'Good Friday' => $easter->subDays(2), + ]; + } +} From ea09603aab0fb4664eac5f35173ba6ce91407700 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Thu, 18 Jan 2024 00:08:18 +0800 Subject: [PATCH 02/18] run test on Malaysia --- .../it_can_calculate_Malaysia_holidays.snap | 46 +++++++++++++++++++ tests/Countries/MalaysiaTest.php | 18 ++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap create mode 100644 tests/Countries/MalaysiaTest.php diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap new file mode 100644 index 000000000..9e0b01aed --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah", + "date": "2024-04-15" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Hol Pahang", + "date": "2024-05-22" + }, + { + "name": "Pesta Keamatan", + "date": "2024-05-30" + }, + { + "name": "Hari Sarawak", + "date": "2024-07-22" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/MalaysiaTest.php b/tests/Countries/MalaysiaTest.php new file mode 100644 index 000000000..36c766ff1 --- /dev/null +++ b/tests/Countries/MalaysiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 92ae7b416f1d3b1f76c868aa9e6b5b92890fb6db Mon Sep 17 00:00:00 2001 From: Pisyek Date: Thu, 18 Jan 2024 00:13:32 +0800 Subject: [PATCH 03/18] fix typo and add pesta kaamatan second day --- src/Countries/Malaysia.php | 3 ++- .../MalaysiaTest/it_can_calculate_Malaysia_holidays.snap | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index b69d37990..80cf57ffe 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -20,7 +20,8 @@ protected function allHolidays(int $year): array 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => '04-15', 'Hari Pekerja' => '05-01', 'Hari Hol Pahang' => '05-22', - 'Pesta Keamatan' => '05-30', + 'Pesta Kaamatan' => '05-30', + 'Pesta Kaamatan Hari Kedua' => '05-31', 'Hari Sarawak' => '07-22', 'Hari Kebangsaan' => '08-31', 'Hari Malaysia' => '09-16', diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap index 9e0b01aed..da2872962 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap @@ -24,9 +24,13 @@ "date": "2024-05-22" }, { - "name": "Pesta Keamatan", + "name": "Pesta Kaamatan", "date": "2024-05-30" }, + { + "name": "Pesta Kaamatan Hari Kedua", + "date": "2024-05-31" + }, { "name": "Hari Sarawak", "date": "2024-07-22" From 9fb9fcd6b4f7d4bb7024e93ec240fe60e492b7f4 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Tue, 23 Jan 2024 09:40:48 +0800 Subject: [PATCH 04/18] add region support --- src/Countries/Malaysia.php | 445 +++++++++++++++++++++++++++++++++++-- 1 file changed, 429 insertions(+), 16 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 80cf57ffe..de6f52f5c 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -3,9 +3,18 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; +use DateTime; +use DateTimeZone; +use IntlDateFormatter; class Malaysia extends Country { + protected $timezone = 'Asia/Kuala_Lumpur'; + + protected function __construct( + protected ?string $region = null, + ) { + } public function countryCode(): string { @@ -14,28 +23,432 @@ public function countryCode(): string protected function allHolidays(int $year): array { - return array_merge([ - 'Tahun Baru' => '01-01', - 'Hari Wilayah Persekutuan' => '02-01', - 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => '04-15', - 'Hari Pekerja' => '05-01', - 'Hari Hol Pahang' => '05-22', - 'Pesta Kaamatan' => '05-30', - 'Pesta Kaamatan Hari Kedua' => '05-31', - 'Hari Sarawak' => '07-22', - 'Hari Kebangsaan' => '08-31', - 'Hari Malaysia' => '09-16', - 'Hari Krismas' => '12-25', - ], $this->variableHolidays($year)); + return array_merge( + $this->fixHolidays($year), + $this->variableHolidays($year) + ); + } + + protected function fixHolidays(int $year): array + { + return [ + 'Hari Pekerja' => CarbonImmutable::createFromDate($year, 5, 1, $this->timezone), + 'Hari Kebangsaan' => CarbonImmutable::createFromDate($year, 8, 31, $this->timezone), + 'Hari Malaysia' => CarbonImmutable::createFromDate($year, 9, 16, $this->timezone), + 'Hari Krismas' => CarbonImmutable::createFromDate($year, 12, 25, $this->timezone), + ]; } protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Asia/Kuala_Lumpur'); + $variableHolidays = [ + 'Tahun Baru Cina' => $this->chineseCalendar('01-01', $year), + 'Tahun Baru Cina Hari Kedua' => $this->chineseCalendar('01-02', $year), + 'Hari Raya Aidilfitri' => $this->islamicCalendar('01/10', $year), + 'Hari Raya Aidilfitri Hari Kedua' => $this->islamicCalendar('02/10', $year), + 'Hari Wesak' => $this->hariWesak($year), + 'Hari Raya Aidiladha' => $this->hariAidiladha($year), + 'Awal Muharram' => $this->awalMuharram($year), + 'Maulidur Rasul' => $this->maulidurRasul($year), + ]; + + $regionHolidays = $this->holidaysByRegion($year); + + if ($this->hariKeputeraanYDP($year)) { + $variableHolidays['Hari Keputeraan Yang Di-Pertuan Agong'] = $this->hariKeputeraanYDP($year); + } + + return array_merge($variableHolidays, $regionHolidays); + } + + // return holiday by region, if not set return all + protected function holidaysByRegion(int $year): array + { + return match ($this->region) { + 'jhr' => $this->regionJohor($year), + 'kdh' => $this->regionKedah($year), + 'ktn' => $this->regionKelantan($year), + 'kul' => $this->regionKualaLumpur($year), + 'lbn' => $this->regionLabuan($year), + 'mlk' => $this->regionMelaka($year), + 'nsn' => $this->regionNegeri9($year), + 'phg' => $this->regionPahang($year), + 'png' => $this->regionPenang($year), + 'prk' => $this->regionPerak($year), + 'pls' => $this->regionPerlis($year), + 'pjy' => $this->regionPutrajaya($year), + 'sbh' => $this->regionSabah($year), + 'swk' => $this->regionSarawak($year), + 'sgr' => $this->regionSelangor($year), + 'trg' => $this->regionTerengganu($year), + default => array_merge( + $this->regionJohor($year), + $this->regionKedah($year), + $this->regionKelantan($year), + $this->regionKualaLumpur($year), + $this->regionLabuan($year), + $this->regionMelaka($year), + $this->regionNegeri9($year), + $this->regionPahang($year), + $this->regionPenang($year), + $this->regionPerak($year), + $this->regionPerlis($year), + $this->regionPutrajaya($year), + $this->regionSabah($year), + $this->regionSarawak($year), + $this->regionSelangor($year), + $this->regionTerengganu($year), + ), + }; + } + + protected function regionJohor(int $year): array + { + $johorHolidays = [ + 'Hari Keputeraan Sultan Johor' => CarbonImmutable::createFromDate($year, 3, 23, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Awal Ramadan' => $this->awalRamadan($year), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + + $hariHolJohor = match ($year) { + 2020 => CarbonImmutable::createFromDate($year, 9, 24, $this->timezone), + 2021 => CarbonImmutable::createFromDate($year, 9, 13, $this->timezone), + 2022 => CarbonImmutable::createFromDate($year, 9, 3, $this->timezone), + 2023 => CarbonImmutable::createFromDate($year, 8, 23, $this->timezone), + 2024 => CarbonImmutable::createFromDate($year, 8, 11, $this->timezone), + 2025 => CarbonImmutable::createFromDate($year, 7, 31, $this->timezone), + 2026 => CarbonImmutable::createFromDate($year, 7, 21, $this->timezone), + default => null, + }; + + if ($hariHolJohor) { + $johorHolidays['Hari Hol Johor'] = $hariHolJohor; + } + + return $johorHolidays; + } + + protected function regionKedah(int $year): array + { + return [ + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Israk dan Mikraj' => $this->israkMikraj($year), + 'Awal Ramadan' => $this->awalRamadan($year), + 'Hari Keputeraan Sultan Kedah' => CarbonImmutable::parse("third sunday of june {$year}", $this->timezone), + 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDay(), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionKelantan(int $year): array + { + $kelantanHolidays = [ + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Arafah' => $this->hariArafah($year), + 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDay(), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + + $kingBirthday = match (true) { + in_array($year, range(2010, 2022)) => CarbonImmutable::createFromDate($year, 11, 11, $this->timezone), + in_array($year, range(2023, 2026)) => CarbonImmutable::createFromDate($year, 9, 29, $this->timezone), + default => null, + + }; + + if ($kingBirthday) { + $kelantanHolidays['Hari Keputeraan Sultan Kelantan'] = $kingBirthday; + } + + $kingBirthdaySecondDay = match (true) { + in_array($year, range(2010, 2022)) => CarbonImmutable::createFromDate($year, 11, 12, $this->timezone), + in_array($year, range(2023, 2026)) => CarbonImmutable::createFromDate($year, 9, 30, $this->timezone), + default => null, + }; + + if ($kingBirthdaySecondDay) { + $kelantanHolidays['Hari Keputeraan Sultan Kelantan Hari Kedua'] = $kingBirthdaySecondDay; + } + + return $kelantanHolidays; + } + + protected function regionKualaLumpur(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionLabuan(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), + 'Pesta Kaamatan' => $this->pestaKaamatan($year), + 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDay(), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionMelaka(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Awal Ramadan' => $this->awalRamadan($year), + 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15, $this->timezone), + 'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24, $this->timezone), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionNegeri9(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Israk dan Mikraj' => $this->israkMikraj($year), + 'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14, $this->timezone), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + protected function regionPahang(int $year): array + { return [ - 'Good Friday' => $easter->subDays(2), + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22, $this->timezone), + 'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30, $this->timezone), + 'Hari Deepavali' => $this->hariDeepavali($year), ]; } + + protected function regionPenang(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7, $this->timezone), + 'Harijadi Yang di-Pertua Negeri Pulau Pinang' => CarbonImmutable::parse("second saturday of july {$year}", $this->timezone), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionPerak(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}", $this->timezone), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionPerlis(int $year): array + { + return [ + 'Israk dan Mikraj' => $this->israkMikraj($year), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Keputeraan Raja Perlis' => CarbonImmutable::createFromDate($year, 5, 17, $this->timezone), + 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDays(1), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionPutrajaya(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + protected function regionSabah(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Pesta Kaamatan' => $this->pestaKaamatan($year), + 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDays(1), + 'Good Friday' => $this->goodFriday($year), + 'Harijadi Yang di-Pertua Negeri Sabah' => CarbonImmutable::parse("first saturday of october {$year}", $this->timezone), + 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Natal' => CarbonImmutable::createFromDate($year, 12, 24, $this->timezone), + ]; + } + + protected function regionSarawak(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Sarawak' => CarbonImmutable::createFromDate($year, 7, 22, $this->timezone), + 'Hari Gawai' => CarbonImmutable::createFromDate($year, 6, 1, $this->timezone), + 'Hari Gawai Kedua' => CarbonImmutable::createFromDate($year, 6, 2, $this->timezone), + 'Harijadi Yang di-Pertua Negeri Sarawak' => CarbonImmutable::parse("second saturday of october {$year}", $this->timezone), + 'Good Friday' => $this->goodFriday($year), + ]; + } + + protected function regionSelangor(int $year): array + { + return [ + 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Keputeraan Sultan Selangor' => CarbonImmutable::createFromDate($year, 12, 11, $this->timezone), + ]; + } + + protected function regionTerengganu(int $year): array + { + return [ + 'Israk dan Mikraj' => $this->israkMikraj($year), + 'Hari Ulang Tahun Pertabalan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 3, 4, $this->timezone), + 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Keputeraan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 4, 26, $this->timezone), + 'Hari Arafah' => $this->hariArafah($year), + 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDays(1), + 'Hari Deepavali' => $this->hariDeepavali($year), + ]; + } + + /** + * $input as in 'month-day' string; '12-31' + */ + protected function chineseCalendar(string $input, int $year): CarbonImmutable + { + $formatter = new IntlDateFormatter( + locale: 'zh-CN@calendar=chinese', + dateType: IntlDateFormatter::SHORT, + timeType: IntlDateFormatter::NONE, + timezone: $this->timezone, + calendar: IntlDateFormatter::TRADITIONAL + ); + + $timestamp = $formatter->parse(sprintf('%s-%s', $year, $input)); + + return CarbonImmutable::createFromTimestamp($timestamp, $this->timezone); + } + + protected function getIslamicFormatter(): IntlDateFormatter + { + return new IntlDateFormatter( + locale: 'ms_MY@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); + } + + /** + * $input as in 'day-month'; 01-10 for syawal + */ + protected function islamicCalendar(string $input, int $year, $nextYear = false): CarbonImmutable + { + $hijrYear = $this->getHijriYear(year: $year, nextYear: $nextYear); + $formatter = $this->getIslamicFormatter(); + + $timeStamp = $formatter->parse($input . '/' . $hijrYear . ' AH'); + $dateTime = date_create()->setTimeStamp($timeStamp)->setTimezone(new DateTimeZone($this->timezone)); + + return CarbonImmutable::createFromTimestamp($timeStamp, $this->timezone); + } + + protected function hariWilayah(int $year): CarbonImmutable + { + return CarbonImmutable::createFromDate($year, 2, 1, $this->timezone); + } + + protected function israkMikraj(int $year): CarbonImmutable + { + return $this->islamicCalendar('27/7', $year); + } + + protected function awalRamadan(int $year): CarbonImmutable + { + return $this->islamicCalendar('1/9', $year); + } + + protected function pestaKaamatan(int $year): CarbonImmutable + { + return CarbonImmutable::createFromDate($year, 5, 30, $this->timezone); + } + + protected function goodFriday(int $year): CarbonImmutable + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone($this->timezone); + + return $easter->subDays(2); + } + + protected function nuzulQuran(int $year): CarbonImmutable + { + return $this->islamicCalendar('17/9', $year); + } + + protected function hariKeputeraanYDP(int $year): ?CarbonImmutable + { + return match (true) { + in_array($year, range(2001, 2026)) => CarbonImmutable::parse("first saturday of october {$year}", $this->timezone), + default => null, + }; + } + + protected function hariArafah(int $year): CarbonImmutable + { + return $this->islamicCalendar('9/12', $year); + } + + protected function hariAidiladha(int $year): CarbonImmutable + { + return $this->islamicCalendar('10/12', $year); + } + + protected function awalMuharram(int $year): CarbonImmutable + { + return $this->islamicCalendar('1/1', $year, true); + } + + protected function maulidurRasul(int $year): CarbonImmutable + { + return $this->islamicCalendar('12/3', $year, true); + } + + protected function hariWesak(int $year) + { + return '01-01'; + } + + protected function hariThaipusam(int $year) + { + return '01-01'; + } + + protected function hariDeepavali(int $year) + { + return '01-01'; + } } From b1d6058bf46242a6255aa0d9993e1b5a641c77ea Mon Sep 17 00:00:00 2001 From: Pisyek Date: Tue, 23 Jan 2024 09:49:47 +0800 Subject: [PATCH 05/18] update malaysia test snapshot --- .../it_can_calculate_Malaysia_holidays.snap | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap index da2872962..dc7caab73 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap @@ -1,24 +1,84 @@ [ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, { "name": "Tahun Baru", "date": "2024-01-01" }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan", + "date": "2024-01-14" + }, { "name": "Hari Wilayah Persekutuan", "date": "2024-02-01" }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Ulang Tahun Pertabalan Sultan Terengganu", + "date": "2024-03-04" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Keputeraan Sultan Johor", + "date": "2024-03-23" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, { "name": "Good Friday", "date": "2024-03-29" }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, { "name": "Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah", "date": "2024-04-15" }, + { + "name": "Hari Keputeraan Sultan Terengganu", + "date": "2024-04-26" + }, { "name": "Hari Pekerja", "date": "2024-05-01" }, + { + "name": "Hari Keputeraan Raja Perlis", + "date": "2024-05-17" + }, { "name": "Hari Hol Pahang", "date": "2024-05-22" @@ -31,18 +91,102 @@ "name": "Pesta Kaamatan Hari Kedua", "date": "2024-05-31" }, + { + "name": "Hari Gawai", + "date": "2024-06-01" + }, + { + "name": "Hari Gawai Kedua", + "date": "2024-06-02" + }, + { + "name": "Hari Keputeraan Sultan Kedah", + "date": "2024-06-16" + }, + { + "name": "Hari Arafah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Hari Bandar Warisan Dunia Georgetown", + "date": "2024-07-07" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Pulau Pinang", + "date": "2024-07-13" + }, { "name": "Hari Sarawak", "date": "2024-07-22" }, + { + "name": "Hari Keputeraan Sultan Pahang", + "date": "2024-07-30" + }, + { + "name": "Hari Hol Johor", + "date": "2024-08-11" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Melaka", + "date": "2024-08-24" + }, { "name": "Hari Kebangsaan", "date": "2024-08-31" }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, { "name": "Hari Malaysia", "date": "2024-09-16" }, + { + "name": "Hari Keputeraan Sultan Kelantan", + "date": "2024-09-29" + }, + { + "name": "Hari Keputeraan Sultan Kelantan Hari Kedua", + "date": "2024-09-30" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Sabah", + "date": "2024-10-05" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Sarawak", + "date": "2024-10-12" + }, + { + "name": "Hari Keputeraan Sultan Perak", + "date": "2024-11-01" + }, + { + "name": "Hari Keputeraan Sultan Selangor", + "date": "2024-12-11" + }, + { + "name": "Hari Natal", + "date": "2024-12-24" + }, { "name": "Hari Krismas", "date": "2024-12-25" From 617f4a4aa59fb35e1999a1620863f8380f938d64 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Wed, 24 Jan 2024 10:00:02 +0800 Subject: [PATCH 06/18] update code to meet PHPStan analysis --- src/Countries/Malaysia.php | 107 +++++++++++++++++++++++++++++---- src/Exceptions/InvalidYear.php | 5 ++ 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index de6f52f5c..4b02c1c82 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -5,11 +5,13 @@ use Carbon\CarbonImmutable; use DateTime; use DateTimeZone; +use Exception; use IntlDateFormatter; +use Spatie\Holidays\Exceptions\InvalidYear; class Malaysia extends Country { - protected $timezone = 'Asia/Kuala_Lumpur'; + protected string $timezone = 'Asia/Kuala_Lumpur'; protected function __construct( protected ?string $region = null, @@ -29,6 +31,10 @@ protected function allHolidays(int $year): array ); } + /** + * @param int $year + * @return array + */ protected function fixHolidays(int $year): array { return [ @@ -39,6 +45,10 @@ protected function fixHolidays(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function variableHolidays(int $year): array { $variableHolidays = [ @@ -61,7 +71,12 @@ protected function variableHolidays(int $year): array return array_merge($variableHolidays, $regionHolidays); } - // return holiday by region, if not set return all + /** + * return holiday by region, if not set return all + * + * @param int $year + * @return array + */ protected function holidaysByRegion(int $year): array { return match ($this->region) { @@ -102,6 +117,10 @@ protected function holidaysByRegion(int $year): array }; } + /** + * @param int $year + * @return array + */ protected function regionJohor(int $year): array { $johorHolidays = [ @@ -129,6 +148,10 @@ protected function regionJohor(int $year): array return $johorHolidays; } + /** + * @param int $year + * @return array + */ protected function regionKedah(int $year): array { return [ @@ -141,6 +164,10 @@ protected function regionKedah(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionKelantan(int $year): array { $kelantanHolidays = [ @@ -174,6 +201,10 @@ protected function regionKelantan(int $year): array return $kelantanHolidays; } + /** + * @param int $year + * @return array + */ protected function regionKualaLumpur(int $year): array { return [ @@ -185,6 +216,10 @@ protected function regionKualaLumpur(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionLabuan(int $year): array { return [ @@ -197,6 +232,10 @@ protected function regionLabuan(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionMelaka(int $year): array { return [ @@ -208,6 +247,10 @@ protected function regionMelaka(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionNegeri9(int $year): array { return [ @@ -219,6 +262,10 @@ protected function regionNegeri9(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionPahang(int $year): array { return [ @@ -230,6 +277,10 @@ protected function regionPahang(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionPenang(int $year): array { return [ @@ -242,6 +293,10 @@ protected function regionPenang(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionPerak(int $year): array { return [ @@ -253,6 +308,10 @@ protected function regionPerak(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionPerlis(int $year): array { return [ @@ -264,6 +323,10 @@ protected function regionPerlis(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionPutrajaya(int $year): array { return [ @@ -275,6 +338,10 @@ protected function regionPutrajaya(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionSabah(int $year): array { return [ @@ -288,6 +355,10 @@ protected function regionSabah(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionSarawak(int $year): array { return [ @@ -300,6 +371,10 @@ protected function regionSarawak(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionSelangor(int $year): array { return [ @@ -311,6 +386,10 @@ protected function regionSelangor(int $year): array ]; } + /** + * @param int $year + * @return array + */ protected function regionTerengganu(int $year): array { return [ @@ -337,7 +416,7 @@ protected function chineseCalendar(string $input, int $year): CarbonImmutable calendar: IntlDateFormatter::TRADITIONAL ); - $timestamp = $formatter->parse(sprintf('%s-%s', $year, $input)); + $timestamp = (int) $formatter->parse(sprintf('%s-%s', $year, $input)); return CarbonImmutable::createFromTimestamp($timestamp, $this->timezone); } @@ -353,26 +432,28 @@ 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'); $dateTime = DateTime::createFromFormat('d/m/Y', '01/01/' . ($nextYear ? $year + 1 : $year)); - return (int) $formatter->format($dateTime); + if (!$dateTime) { + throw InvalidYear::invalidHijriYear(); + } + + return (int) $formatter->format($dateTime->getTimestamp()); } /** * $input as in 'day-month'; 01-10 for syawal */ - protected function islamicCalendar(string $input, int $year, $nextYear = false): CarbonImmutable + protected function islamicCalendar(string $input, int $year, bool $nextYear = false): CarbonImmutable { $hijrYear = $this->getHijriYear(year: $year, nextYear: $nextYear); $formatter = $this->getIslamicFormatter(); - - $timeStamp = $formatter->parse($input . '/' . $hijrYear . ' AH'); - $dateTime = date_create()->setTimeStamp($timeStamp)->setTimezone(new DateTimeZone($this->timezone)); - + $timeStamp = (int) $formatter->parse($input . '/' . $hijrYear . ' AH'); + return CarbonImmutable::createFromTimestamp($timeStamp, $this->timezone); } @@ -437,17 +518,17 @@ protected function maulidurRasul(int $year): CarbonImmutable return $this->islamicCalendar('12/3', $year, true); } - protected function hariWesak(int $year) + protected function hariWesak(int $year): string { return '01-01'; } - protected function hariThaipusam(int $year) + protected function hariThaipusam(int $year): string { return '01-01'; } - protected function hariDeepavali(int $year) + protected function hariDeepavali(int $year): string { return '01-01'; } diff --git a/src/Exceptions/InvalidYear.php b/src/Exceptions/InvalidYear.php index 13fd335ad..9760c41cd 100644 --- a/src/Exceptions/InvalidYear.php +++ b/src/Exceptions/InvalidYear.php @@ -20,4 +20,9 @@ public static function range(string $country, int $start, int $end): self { return new self("Only years between {$start} and {$end} are supported for {$country}."); } + + public static function invalidHijriYear(): self + { + return new self('Unable to get the Hijri year.'); + } } From 4a38cea07384bf2703a1ed599eec58d704f1d6f2 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Thu, 25 Jan 2024 19:21:46 +0800 Subject: [PATCH 07/18] add Malaysia region validation --- src/Countries/Malaysia.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 4b02c1c82..7a29f78c7 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -4,15 +4,34 @@ use Carbon\CarbonImmutable; use DateTime; -use DateTimeZone; -use Exception; use IntlDateFormatter; +use Spatie\Holidays\Exceptions\InvalidRegion; use Spatie\Holidays\Exceptions\InvalidYear; class Malaysia extends Country { protected string $timezone = 'Asia/Kuala_Lumpur'; + /** @var array $regions */ + protected array $regions = [ + 'jhr', + 'kdh', + 'ktn', + 'kul', + 'lbn', + 'mlk', + 'nsn', + 'phg', + 'png', + 'prk', + 'pls', + 'pjy', + 'sbh', + 'swk', + 'sgr', + 'trg', + ]; + protected function __construct( protected ?string $region = null, ) { @@ -62,6 +81,10 @@ protected function variableHolidays(int $year): array 'Maulidur Rasul' => $this->maulidurRasul($year), ]; + if ($this->region && !$this->validRegion($this->region)) { + throw InvalidRegion::regionNotFound(); + } + $regionHolidays = $this->holidaysByRegion($year); if ($this->hariKeputeraanYDP($year)) { @@ -71,6 +94,11 @@ protected function variableHolidays(int $year): array return array_merge($variableHolidays, $regionHolidays); } + protected function validRegion(string $region): bool + { + return in_array($region, $this->regions); + } + /** * return holiday by region, if not set return all * From 81c6b61ba6659d3c61238c2d04ccabe64d0babc8 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Thu, 25 Jan 2024 20:08:19 +0800 Subject: [PATCH 08/18] update fix holiday to string and easter function --- src/Countries/Malaysia.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 7a29f78c7..7b46d9163 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -52,15 +52,15 @@ protected function allHolidays(int $year): array /** * @param int $year - * @return array + * @return array */ protected function fixHolidays(int $year): array { return [ - 'Hari Pekerja' => CarbonImmutable::createFromDate($year, 5, 1, $this->timezone), - 'Hari Kebangsaan' => CarbonImmutable::createFromDate($year, 8, 31, $this->timezone), - 'Hari Malaysia' => CarbonImmutable::createFromDate($year, 9, 16, $this->timezone), - 'Hari Krismas' => CarbonImmutable::createFromDate($year, 12, 25, $this->timezone), + 'Hari Pekerja' => '05-01', + 'Hari Kebangsaan' => '08-31', + 'Hari Malaysia' => '09-16', + 'Hari Krismas' => '12-25', ]; } @@ -507,8 +507,7 @@ protected function pestaKaamatan(int $year): CarbonImmutable protected function goodFriday(int $year): CarbonImmutable { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone($this->timezone); + $easter = $this->easter($year); return $easter->subDays(2); } From 42fedf75604c8cf7d70508db009c4dd27e097118 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Thu, 25 Jan 2024 21:18:10 +0800 Subject: [PATCH 09/18] update Malaysia test with region and invalid region --- ...th_data_set____jhr___18_____jhr___18_.snap | 74 +++++++++++++++++ ...th_data_set____kdh___19_____kdh___19_.snap | 78 ++++++++++++++++++ ...th_data_set____ktn___19_____ktn___19_.snap | 78 ++++++++++++++++++ ...th_data_set____kul___18_____kul___18_.snap | 74 +++++++++++++++++ ...th_data_set____lbn___19_____lbn___19_.snap | 78 ++++++++++++++++++ ...th_data_set____mlk___18_____mlk___18_.snap | 74 +++++++++++++++++ ...th_data_set____nsn___18_____nsn___18_.snap | 74 +++++++++++++++++ ...th_data_set____phg___18_____phg___18_.snap | 74 +++++++++++++++++ ...th_data_set____pjy___18_____pjy___18_.snap | 74 +++++++++++++++++ ...th_data_set____pls___18_____pls___18_.snap | 74 +++++++++++++++++ ...th_data_set____png___19_____png___19_.snap | 78 ++++++++++++++++++ ...th_data_set____prk___18_____prk___18_.snap | 74 +++++++++++++++++ ...th_data_set____sbh___20_____sbh___20_.snap | 82 +++++++++++++++++++ ...th_data_set____sgr___18_____sgr___18_.snap | 74 +++++++++++++++++ ...th_data_set____swk___19_____swk___19_.snap | 78 ++++++++++++++++++ ...th_data_set____trg___20_____trg___20_.snap | 82 +++++++++++++++++++ ...th_data_set____jhr___18_____jhr___18_.snap | 74 +++++++++++++++++ ...th_data_set____kdh___19_____kdh___19_.snap | 78 ++++++++++++++++++ ...th_data_set____ktn___19_____ktn___19_.snap | 78 ++++++++++++++++++ ...th_data_set____kul___18_____kul___18_.snap | 74 +++++++++++++++++ ...th_data_set____lbn___19_____lbn___19_.snap | 78 ++++++++++++++++++ ...th_data_set____mlk___18_____mlk___18_.snap | 74 +++++++++++++++++ ...th_data_set____nsn___18_____nsn___18_.snap | 74 +++++++++++++++++ ...th_data_set____phg___18_____phg___18_.snap | 74 +++++++++++++++++ ...th_data_set____pjy___18_____pjy___18_.snap | 74 +++++++++++++++++ ...th_data_set____pls___18_____pls___18_.snap | 74 +++++++++++++++++ ...th_data_set____png___19_____png___19_.snap | 78 ++++++++++++++++++ ...th_data_set____prk___18_____prk___18_.snap | 74 +++++++++++++++++ ...th_data_set____sbh___20_____sbh___20_.snap | 82 +++++++++++++++++++ ...th_data_set____sgr___18_____sgr___18_.snap | 74 +++++++++++++++++ ...th_data_set____swk___19_____swk___19_.snap | 78 ++++++++++++++++++ ...th_data_set____trg___20_____trg___20_.snap | 82 +++++++++++++++++++ tests/Countries/MalaysiaTest.php | 53 ++++++++++++ 33 files changed, 2493 insertions(+) create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap create mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap new file mode 100644 index 000000000..67f604b75 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Keputeraan Sultan Johor", + "date": "2024-03-23" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Hol Johor", + "date": "2024-08-11" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap new file mode 100644 index 000000000..ebaa4e4ce --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Keputeraan Sultan Kedah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap new file mode 100644 index 000000000..debc0b87f --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Arafah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Sultan Kelantan", + "date": "2024-09-29" + }, + { + "name": "Hari Keputeraan Sultan Kelantan Hari Kedua", + "date": "2024-09-30" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap new file mode 100644 index 000000000..135d293e7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap new file mode 100644 index 000000000..b03b63f19 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Pesta Kaamatan", + "date": "2024-05-30" + }, + { + "name": "Pesta Kaamatan Hari Kedua", + "date": "2024-05-31" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap new file mode 100644 index 000000000..1c778ea95 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah", + "date": "2024-04-15" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Melaka", + "date": "2024-08-24" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap new file mode 100644 index 000000000..6055bba36 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan", + "date": "2024-01-14" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap new file mode 100644 index 000000000..61c83b9ce --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Hol Pahang", + "date": "2024-05-22" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Keputeraan Sultan Pahang", + "date": "2024-07-30" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap new file mode 100644 index 000000000..135d293e7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap new file mode 100644 index 000000000..0c2e9a635 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Keputeraan Raja Perlis", + "date": "2024-05-17" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap new file mode 100644 index 000000000..3ee6974d1 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Bandar Warisan Dunia Georgetown", + "date": "2024-07-07" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Pulau Pinang", + "date": "2024-07-13" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap new file mode 100644 index 000000000..b4ec4d614 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Keputeraan Sultan Perak", + "date": "2024-11-01" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap new file mode 100644 index 000000000..91d2b3a25 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap @@ -0,0 +1,82 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Pesta Kaamatan", + "date": "2024-05-30" + }, + { + "name": "Pesta Kaamatan Hari Kedua", + "date": "2024-05-31" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Sabah", + "date": "2024-10-05" + }, + { + "name": "Hari Natal", + "date": "2024-12-24" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap new file mode 100644 index 000000000..3223f13b3 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Keputeraan Sultan Selangor", + "date": "2024-12-11" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap new file mode 100644 index 000000000..51ac14f11 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Gawai", + "date": "2024-06-01" + }, + { + "name": "Hari Gawai Kedua", + "date": "2024-06-02" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Sarawak", + "date": "2024-07-22" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Sarawak", + "date": "2024-10-12" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap new file mode 100644 index 000000000..0d78398d4 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap @@ -0,0 +1,82 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Ulang Tahun Pertabalan Sultan Terengganu", + "date": "2024-03-04" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Keputeraan Sultan Terengganu", + "date": "2024-04-26" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Arafah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap new file mode 100644 index 000000000..67f604b75 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Keputeraan Sultan Johor", + "date": "2024-03-23" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Hol Johor", + "date": "2024-08-11" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap new file mode 100644 index 000000000..ebaa4e4ce --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Keputeraan Sultan Kedah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap new file mode 100644 index 000000000..debc0b87f --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Arafah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Sultan Kelantan", + "date": "2024-09-29" + }, + { + "name": "Hari Keputeraan Sultan Kelantan Hari Kedua", + "date": "2024-09-30" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap new file mode 100644 index 000000000..135d293e7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap new file mode 100644 index 000000000..b03b63f19 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Pesta Kaamatan", + "date": "2024-05-30" + }, + { + "name": "Pesta Kaamatan Hari Kedua", + "date": "2024-05-31" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap new file mode 100644 index 000000000..1c778ea95 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Awal Ramadan", + "date": "2024-03-11" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah", + "date": "2024-04-15" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Melaka", + "date": "2024-08-24" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap new file mode 100644 index 000000000..6055bba36 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan", + "date": "2024-01-14" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap new file mode 100644 index 000000000..61c83b9ce --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Hol Pahang", + "date": "2024-05-22" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Keputeraan Sultan Pahang", + "date": "2024-07-30" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap new file mode 100644 index 000000000..135d293e7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Hari Wilayah Persekutuan", + "date": "2024-02-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap new file mode 100644 index 000000000..0c2e9a635 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Keputeraan Raja Perlis", + "date": "2024-05-17" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap new file mode 100644 index 000000000..3ee6974d1 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Bandar Warisan Dunia Georgetown", + "date": "2024-07-07" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Pulau Pinang", + "date": "2024-07-13" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap new file mode 100644 index 000000000..b4ec4d614 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Keputeraan Sultan Perak", + "date": "2024-11-01" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap new file mode 100644 index 000000000..91d2b3a25 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap @@ -0,0 +1,82 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Pesta Kaamatan", + "date": "2024-05-30" + }, + { + "name": "Pesta Kaamatan Hari Kedua", + "date": "2024-05-31" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Sabah", + "date": "2024-10-05" + }, + { + "name": "Hari Natal", + "date": "2024-12-24" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap new file mode 100644 index 000000000..3223f13b3 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Hari Thaipusam", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Keputeraan Sultan Selangor", + "date": "2024-12-11" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap new file mode 100644 index 000000000..51ac14f11 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap @@ -0,0 +1,78 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru", + "date": "2024-01-01" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Gawai", + "date": "2024-06-01" + }, + { + "name": "Hari Gawai Kedua", + "date": "2024-06-02" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Sarawak", + "date": "2024-07-22" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Harijadi Yang di-Pertua Negeri Sarawak", + "date": "2024-10-12" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap new file mode 100644 index 000000000..0d78398d4 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap @@ -0,0 +1,82 @@ +[ + { + "name": "Hari Wesak", + "date": "2024-01-01" + }, + { + "name": "Hari Deepavali", + "date": "2024-01-01" + }, + { + "name": "Israk dan Mikraj", + "date": "2024-02-07" + }, + { + "name": "Tahun Baru Cina", + "date": "2024-02-10" + }, + { + "name": "Tahun Baru Cina Hari Kedua", + "date": "2024-02-11" + }, + { + "name": "Hari Ulang Tahun Pertabalan Sultan Terengganu", + "date": "2024-03-04" + }, + { + "name": "Hari Nurul Al-Quran", + "date": "2024-03-27" + }, + { + "name": "Hari Raya Aidilfitri", + "date": "2024-04-10" + }, + { + "name": "Hari Raya Aidilfitri Hari Kedua", + "date": "2024-04-11" + }, + { + "name": "Hari Keputeraan Sultan Terengganu", + "date": "2024-04-26" + }, + { + "name": "Hari Pekerja", + "date": "2024-05-01" + }, + { + "name": "Hari Arafah", + "date": "2024-06-16" + }, + { + "name": "Hari Raya Aidiladha", + "date": "2024-06-17" + }, + { + "name": "Hari Raya Aidiladha Hari Kedua", + "date": "2024-06-18" + }, + { + "name": "Awal Muharram", + "date": "2024-07-08" + }, + { + "name": "Hari Kebangsaan", + "date": "2024-08-31" + }, + { + "name": "Maulidur Rasul", + "date": "2024-09-16" + }, + { + "name": "Hari Malaysia", + "date": "2024-09-16" + }, + { + "name": "Hari Keputeraan Yang Di-Pertuan Agong", + "date": "2024-10-05" + }, + { + "name": "Hari Krismas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/MalaysiaTest.php b/tests/Countries/MalaysiaTest.php index 36c766ff1..775e66c55 100644 --- a/tests/Countries/MalaysiaTest.php +++ b/tests/Countries/MalaysiaTest.php @@ -3,6 +3,8 @@ namespace Spatie\Holidays\Tests\Countries; use Carbon\CarbonImmutable; +use Spatie\Holidays\Countries\Malaysia; +use Spatie\Holidays\Exceptions\InvalidRegion; use Spatie\Holidays\Holidays; it('can calculate Malaysia holidays', function () { @@ -16,3 +18,54 @@ expect(formatDates($holidays))->toMatchSnapshot(); }); + +it('can calculate total holidays by regions', function (string $region, $totalHolidays) { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(Malaysia::make($region))->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(count($holidays))->toBe($totalHolidays); + + expect(formatDates($holidays))->toMatchSnapshot(); +})->with([ + ['jhr', 18], + ['kdh', 19], + ['ktn', 19], + ['kul', 18], + ['lbn', 19], + ['mlk', 18], + ['nsn', 18], + ['phg', 18], + ['png', 19], + ['prk', 18], + ['pls', 18], + ['pjy', 18], + ['sbh', 20], + ['swk', 19], + ['sgr', 18], + ['trg', 20], +]); + +it('can calculate Hari Raya is in year 2023', function () { + CarbonImmutable::setTestNow('2023-01-01'); + + $holiday = Holidays::for('my')->isHoliday('2023-04-22'); + + expect($holiday)->toBeTrue(); +}); + +it('can calculate Tahun Baru Cina in year 2023', function () { + CarbonImmutable::setTestNow('2023-01-01'); + + $holiday = Holidays::for('my')->isHoliday('2023-01-22'); + + expect($holiday)->toBeTrue(); +}); + +it('cannot calculate invalid region', function () { + $holiday = Holidays::for(Malaysia::make('invalid-region'))->get(); +})->throws(InvalidRegion::class); From 749cd0dad43122cb40cd268771278264bc009de6 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Sat, 27 Jan 2024 15:32:03 +0800 Subject: [PATCH 10/18] refactor new year holiday into function --- src/Countries/Malaysia.php | 89 +++++++++++++++----------------------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 7b46d9163..182fea474 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -44,28 +44,15 @@ public function countryCode(): string protected function allHolidays(int $year): array { - return array_merge( - $this->fixHolidays($year), - $this->variableHolidays($year) - ); + return array_merge([ + 'Hari Pekerja' => '05-01', + 'Hari Kebangsaan' => '08-31', + 'Hari Malaysia' => '09-16', + 'Hari Krismas' => '12-25', + ], $this->variableHolidays($year), $this->regionHolidays($year)); } /** - * @param int $year - * @return array - */ - protected function fixHolidays(int $year): array - { - return [ - 'Hari Pekerja' => '05-01', - 'Hari Kebangsaan' => '08-31', - 'Hari Malaysia' => '09-16', - 'Hari Krismas' => '12-25', - ]; - } - - /** - * @param int $year * @return array */ protected function variableHolidays(int $year): array @@ -81,17 +68,23 @@ protected function variableHolidays(int $year): array 'Maulidur Rasul' => $this->maulidurRasul($year), ]; - if ($this->region && !$this->validRegion($this->region)) { - throw InvalidRegion::regionNotFound(); + if ($this->hariKeputeraanYDP($year)) { + $variableHolidays['Hari Keputeraan Yang Di-Pertuan Agong'] = $this->hariKeputeraanYDP($year); } - $regionHolidays = $this->holidaysByRegion($year); + return $variableHolidays; + } - if ($this->hariKeputeraanYDP($year)) { - $variableHolidays['Hari Keputeraan Yang Di-Pertuan Agong'] = $this->hariKeputeraanYDP($year); + /** + * @return array + */ + protected function regionHolidays(int $year): array + { + if ($this->region && !$this->validRegion($this->region)) { + throw InvalidRegion::regionNotFound(); } - return array_merge($variableHolidays, $regionHolidays); + return $this->holidaysByRegion($year); } protected function validRegion(string $region): bool @@ -102,7 +95,6 @@ protected function validRegion(string $region): bool /** * return holiday by region, if not set return all * - * @param int $year * @return array */ protected function holidaysByRegion(int $year): array @@ -146,7 +138,6 @@ protected function holidaysByRegion(int $year): array } /** - * @param int $year * @return array */ protected function regionJohor(int $year): array @@ -177,7 +168,6 @@ protected function regionJohor(int $year): array } /** - * @param int $year * @return array */ protected function regionKedah(int $year): array @@ -193,7 +183,6 @@ protected function regionKedah(int $year): array } /** - * @param int $year * @return array */ protected function regionKelantan(int $year): array @@ -230,13 +219,12 @@ protected function regionKelantan(int $year): array } /** - * @param int $year * @return array */ protected function regionKualaLumpur(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), @@ -245,13 +233,12 @@ protected function regionKualaLumpur(int $year): array } /** - * @param int $year * @return array */ protected function regionLabuan(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDay(), @@ -261,13 +248,12 @@ protected function regionLabuan(int $year): array } /** - * @param int $year * @return array */ protected function regionMelaka(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Awal Ramadan' => $this->awalRamadan($year), 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15, $this->timezone), 'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24, $this->timezone), @@ -276,13 +262,12 @@ protected function regionMelaka(int $year): array } /** - * @param int $year * @return array */ protected function regionNegeri9(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Thaipusam' => $this->hariThaipusam($year), 'Israk dan Mikraj' => $this->israkMikraj($year), 'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14, $this->timezone), @@ -291,13 +276,12 @@ protected function regionNegeri9(int $year): array } /** - * @param int $year * @return array */ protected function regionPahang(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22, $this->timezone), 'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30, $this->timezone), @@ -306,13 +290,12 @@ protected function regionPahang(int $year): array } /** - * @param int $year * @return array */ protected function regionPenang(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7, $this->timezone), @@ -322,13 +305,12 @@ protected function regionPenang(int $year): array } /** - * @param int $year * @return array */ protected function regionPerak(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}", $this->timezone), @@ -337,7 +319,6 @@ protected function regionPerak(int $year): array } /** - * @param int $year * @return array */ protected function regionPerlis(int $year): array @@ -352,13 +333,12 @@ protected function regionPerlis(int $year): array } /** - * @param int $year * @return array */ protected function regionPutrajaya(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), @@ -367,13 +347,12 @@ protected function regionPutrajaya(int $year): array } /** - * @param int $year * @return array */ protected function regionSabah(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDays(1), 'Good Friday' => $this->goodFriday($year), @@ -384,13 +363,12 @@ protected function regionSabah(int $year): array } /** - * @param int $year - * @return array + * @return array */ protected function regionSarawak(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Sarawak' => CarbonImmutable::createFromDate($year, 7, 22, $this->timezone), 'Hari Gawai' => CarbonImmutable::createFromDate($year, 6, 1, $this->timezone), 'Hari Gawai Kedua' => CarbonImmutable::createFromDate($year, 6, 2, $this->timezone), @@ -400,13 +378,12 @@ protected function regionSarawak(int $year): array } /** - * @param int $year * @return array */ protected function regionSelangor(int $year): array { return [ - 'Tahun Baru' => CarbonImmutable::createFromDate($year, 1, 1, $this->timezone), + 'Tahun Baru' => $this->newYear(), 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Deepavali' => $this->hariDeepavali($year), @@ -415,7 +392,6 @@ protected function regionSelangor(int $year): array } /** - * @param int $year * @return array */ protected function regionTerengganu(int $year): array @@ -431,6 +407,11 @@ protected function regionTerengganu(int $year): array ]; } + private function newYear(): string + { + return '01-01'; + } + /** * $input as in 'month-day' string; '12-31' */ From 1b9b65c66d8bb846026b72927524a536cc019d22 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Mon, 29 Jan 2024 23:14:51 +0800 Subject: [PATCH 11/18] update invalid region exception --- src/Countries/Malaysia.php | 2 +- tests/Countries/MalaysiaTest.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 182fea474..d2d916061 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -81,7 +81,7 @@ protected function variableHolidays(int $year): array protected function regionHolidays(int $year): array { if ($this->region && !$this->validRegion($this->region)) { - throw InvalidRegion::regionNotFound(); + throw InvalidRegion::unsupportedRegion($this->region); } return $this->holidaysByRegion($year); diff --git a/tests/Countries/MalaysiaTest.php b/tests/Countries/MalaysiaTest.php index 775e66c55..f14ea6043 100644 --- a/tests/Countries/MalaysiaTest.php +++ b/tests/Countries/MalaysiaTest.php @@ -28,8 +28,6 @@ ->toBeArray() ->not()->toBeEmpty(); - expect(count($holidays))->toBe($totalHolidays); - expect(formatDates($holidays))->toMatchSnapshot(); })->with([ ['jhr', 18], From a08764df770e59585edc84305a43c04292bcdb94 Mon Sep 17 00:00:00 2001 From: Pisyek Date: Mon, 29 Jan 2024 23:29:29 +0800 Subject: [PATCH 12/18] refactor chinese calendar to use trait --- src/Countries/Malaysia.php | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index d2d916061..b26043eb7 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -5,11 +5,14 @@ use Carbon\CarbonImmutable; use DateTime; use IntlDateFormatter; +use Spatie\Holidays\Calendars\ChineseCalendar; use Spatie\Holidays\Exceptions\InvalidRegion; use Spatie\Holidays\Exceptions\InvalidYear; class Malaysia extends Country { + use ChineseCalendar; + protected string $timezone = 'Asia/Kuala_Lumpur'; /** @var array $regions */ @@ -57,9 +60,11 @@ protected function allHolidays(int $year): array */ protected function variableHolidays(int $year): array { + $this->setChineseCalendarTimezone($this->timezone); + $variableHolidays = [ - 'Tahun Baru Cina' => $this->chineseCalendar('01-01', $year), - 'Tahun Baru Cina Hari Kedua' => $this->chineseCalendar('01-02', $year), + 'Tahun Baru Cina' => $this->chineseToGregorianDate('01-01', $year), + 'Tahun Baru Cina Hari Kedua' => $this->chineseToGregorianDate('01-02', $year), 'Hari Raya Aidilfitri' => $this->islamicCalendar('01/10', $year), 'Hari Raya Aidilfitri Hari Kedua' => $this->islamicCalendar('02/10', $year), 'Hari Wesak' => $this->hariWesak($year), @@ -412,24 +417,6 @@ private function newYear(): string return '01-01'; } - /** - * $input as in 'month-day' string; '12-31' - */ - protected function chineseCalendar(string $input, int $year): CarbonImmutable - { - $formatter = new IntlDateFormatter( - locale: 'zh-CN@calendar=chinese', - dateType: IntlDateFormatter::SHORT, - timeType: IntlDateFormatter::NONE, - timezone: $this->timezone, - calendar: IntlDateFormatter::TRADITIONAL - ); - - $timestamp = (int) $formatter->parse(sprintf('%s-%s', $year, $input)); - - return CarbonImmutable::createFromTimestamp($timestamp, $this->timezone); - } - protected function getIslamicFormatter(): IntlDateFormatter { return new IntlDateFormatter( From 894d89802efc3a404fd5f88430b19e5b4051b3a5 Mon Sep 17 00:00:00 2001 From: pisyek Date: Fri, 2 Feb 2024 16:51:33 +0800 Subject: [PATCH 13/18] update invalid region exception --- src/Countries/Malaysia.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index b26043eb7..d3a49fd82 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -86,7 +86,7 @@ protected function variableHolidays(int $year): array protected function regionHolidays(int $year): array { if ($this->region && !$this->validRegion($this->region)) { - throw InvalidRegion::unsupportedRegion($this->region); + throw InvalidRegion::notFound($this->region); } return $this->holidaysByRegion($year); From 2f0efd397774c70f88f707b565405c2dbd58a115 Mon Sep 17 00:00:00 2001 From: pisyek Date: Fri, 2 Feb 2024 16:59:30 +0800 Subject: [PATCH 14/18] refactor CNY and Aidilfitri holiday function --- src/Countries/Malaysia.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index d3a49fd82..ef49d3396 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -63,10 +63,10 @@ protected function variableHolidays(int $year): array $this->setChineseCalendarTimezone($this->timezone); $variableHolidays = [ - 'Tahun Baru Cina' => $this->chineseToGregorianDate('01-01', $year), - 'Tahun Baru Cina Hari Kedua' => $this->chineseToGregorianDate('01-02', $year), - 'Hari Raya Aidilfitri' => $this->islamicCalendar('01/10', $year), - 'Hari Raya Aidilfitri Hari Kedua' => $this->islamicCalendar('02/10', $year), + 'Tahun Baru Cina' => $this->lunarNewYear($year), + 'Tahun Baru Cina Hari Kedua' => $this->lunarNewYear($year)->addDays(1), + 'Hari Raya Aidilfitri' => $this->hariAidilfitri($year), + 'Hari Raya Aidilfitri Hari Kedua' => $this->hariAidilfitri($year)->addDays(1), 'Hari Wesak' => $this->hariWesak($year), 'Hari Raya Aidiladha' => $this->hariAidiladha($year), 'Awal Muharram' => $this->awalMuharram($year), @@ -417,6 +417,11 @@ private function newYear(): string return '01-01'; } + private function lunarNewYear(int $year): CarbonImmutable + { + return $this->chineseToGregorianDate('01-01', $year); + } + protected function getIslamicFormatter(): IntlDateFormatter { return new IntlDateFormatter( @@ -453,6 +458,11 @@ protected function islamicCalendar(string $input, int $year, bool $nextYear = fa return CarbonImmutable::createFromTimestamp($timeStamp, $this->timezone); } + protected function hariAidilfitri(int $year): CarbonImmutable + { + return $this->islamicCalendar('01/10', $year); + } + protected function hariWilayah(int $year): CarbonImmutable { return CarbonImmutable::createFromDate($year, 2, 1, $this->timezone); From a7964dd0e1f97a1ee646b41d446b59af4b6cee72 Mon Sep 17 00:00:00 2001 From: pisyek Date: Fri, 9 Feb 2024 10:48:52 +0800 Subject: [PATCH 15/18] refactor new year holiday to string --- src/Countries/Malaysia.php | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index ef49d3396..1814111a5 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -229,7 +229,7 @@ protected function regionKelantan(int $year): array protected function regionKualaLumpur(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), @@ -243,7 +243,7 @@ protected function regionKualaLumpur(int $year): array protected function regionLabuan(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDay(), @@ -258,7 +258,7 @@ protected function regionLabuan(int $year): array protected function regionMelaka(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Awal Ramadan' => $this->awalRamadan($year), 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15, $this->timezone), 'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24, $this->timezone), @@ -272,7 +272,7 @@ protected function regionMelaka(int $year): array protected function regionNegeri9(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Israk dan Mikraj' => $this->israkMikraj($year), 'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14, $this->timezone), @@ -286,7 +286,7 @@ protected function regionNegeri9(int $year): array protected function regionPahang(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22, $this->timezone), 'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30, $this->timezone), @@ -300,7 +300,7 @@ protected function regionPahang(int $year): array protected function regionPenang(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7, $this->timezone), @@ -315,7 +315,7 @@ protected function regionPenang(int $year): array protected function regionPerak(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}", $this->timezone), @@ -343,7 +343,7 @@ protected function regionPerlis(int $year): array protected function regionPutrajaya(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), @@ -357,7 +357,7 @@ protected function regionPutrajaya(int $year): array protected function regionSabah(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDays(1), 'Good Friday' => $this->goodFriday($year), @@ -373,7 +373,7 @@ protected function regionSabah(int $year): array protected function regionSarawak(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Sarawak' => CarbonImmutable::createFromDate($year, 7, 22, $this->timezone), 'Hari Gawai' => CarbonImmutable::createFromDate($year, 6, 1, $this->timezone), 'Hari Gawai Kedua' => CarbonImmutable::createFromDate($year, 6, 2, $this->timezone), @@ -388,7 +388,7 @@ protected function regionSarawak(int $year): array protected function regionSelangor(int $year): array { return [ - 'Tahun Baru' => $this->newYear(), + 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), 'Hari Deepavali' => $this->hariDeepavali($year), @@ -412,11 +412,6 @@ protected function regionTerengganu(int $year): array ]; } - private function newYear(): string - { - return '01-01'; - } - private function lunarNewYear(int $year): CarbonImmutable { return $this->chineseToGregorianDate('01-01', $year); From 39c8095acd66cb4988613c9c9d84d2cd9106efdf Mon Sep 17 00:00:00 2001 From: pisyek Date: Fri, 9 Feb 2024 12:30:51 +0800 Subject: [PATCH 16/18] refactor islamic calendar to trait --- src/Calendars/IslamicCalendar.php | 58 +++++ src/Countries/Malaysia.php | 203 ++++++------------ .../it_can_calculate_Malaysia_holidays.snap | 4 +- ...th_data_set____jhr___18_____jhr___18_.snap | 4 +- ...th_data_set____kdh___19_____kdh___19_.snap | 4 +- ...th_data_set____ktn___19_____ktn___19_.snap | 4 +- ...th_data_set____kul___18_____kul___18_.snap | 4 +- ...th_data_set____lbn___19_____lbn___19_.snap | 4 +- ...th_data_set____mlk___18_____mlk___18_.snap | 4 +- ...th_data_set____nsn___18_____nsn___18_.snap | 4 +- ...th_data_set____phg___18_____phg___18_.snap | 4 +- ...th_data_set____pjy___18_____pjy___18_.snap | 4 +- ...th_data_set____pls___18_____pls___18_.snap | 4 +- ...th_data_set____png___19_____png___19_.snap | 4 +- ...th_data_set____prk___18_____prk___18_.snap | 4 +- ...th_data_set____sbh___20_____sbh___20_.snap | 4 +- ...th_data_set____sgr___18_____sgr___18_.snap | 4 +- ...th_data_set____swk___19_____swk___19_.snap | 4 +- ...th_data_set____trg___20_____trg___20_.snap | 4 +- ...th_data_set____jhr___18_____jhr___18_.snap | 74 ------- ...th_data_set____kdh___19_____kdh___19_.snap | 78 ------- ...th_data_set____ktn___19_____ktn___19_.snap | 78 ------- ...th_data_set____kul___18_____kul___18_.snap | 74 ------- ...th_data_set____lbn___19_____lbn___19_.snap | 78 ------- ...th_data_set____mlk___18_____mlk___18_.snap | 74 ------- ...th_data_set____nsn___18_____nsn___18_.snap | 74 ------- ...th_data_set____phg___18_____phg___18_.snap | 74 ------- ...th_data_set____pjy___18_____pjy___18_.snap | 74 ------- ...th_data_set____pls___18_____pls___18_.snap | 74 ------- ...th_data_set____png___19_____png___19_.snap | 78 ------- ...th_data_set____prk___18_____prk___18_.snap | 74 ------- ...th_data_set____sbh___20_____sbh___20_.snap | 82 ------- ...th_data_set____sgr___18_____sgr___18_.snap | 74 ------- ...th_data_set____swk___19_____swk___19_.snap | 78 ------- ...th_data_set____trg___20_____trg___20_.snap | 82 ------- tests/Countries/MalaysiaTest.php | 29 --- 36 files changed, 157 insertions(+), 1421 deletions(-) create mode 100644 src/Calendars/IslamicCalendar.php delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap delete mode 100644 tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap diff --git a/src/Calendars/IslamicCalendar.php b/src/Calendars/IslamicCalendar.php new file mode 100644 index 000000000..7a86e7e26 --- /dev/null +++ b/src/Calendars/IslamicCalendar.php @@ -0,0 +1,58 @@ +islamicCalendarTimezone = $islamicCalendarTimezone; + + return $this; + } + + protected function getIslamicCalendarFormatter(): IntlDateFormatter + { + return new IntlDateFormatter( + 'en_US@calendar=islamic-civil', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'UTC', + IntlDateFormatter::TRADITIONAL, + 'yyyy-MM-dd' + ); + } + + protected function getHijriYear(int $year, bool $nextYear = false): int + { + $formatter = $this->getIslamicCalendarFormatter(); + $formatter->setPattern('yyyy'); + $dateTime = DateTime::createFromFormat('d/m/Y', '01/01/' . ($nextYear ? $year + 1 : $year)); + + if (!$dateTime) { + throw InvalidYear::invalidHijriYear(); + } + + return (int) $formatter->format($dateTime->getTimestamp()); + } + + protected function islamicToGregorianDate(string $input, int $year, bool $nextYear = false): CarbonImmutable + { + $hijriYear = $this->getHijriYear(year: $year, nextYear: $nextYear); + $formatter = $this->getIslamicCalendarFormatter(); + $timestamp = (int) $formatter->parse(sprintf('%s-%s', $hijriYear, $input)); + + return (new CarbonImmutable()) + ->setTimeStamp($timestamp) + ->setTimezone(new DateTimeZone($this->islamicCalendarTimezone)); + } +} \ No newline at end of file diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 1814111a5..45e6f30c1 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -6,6 +6,7 @@ use DateTime; use IntlDateFormatter; use Spatie\Holidays\Calendars\ChineseCalendar; +use Spatie\Holidays\Calendars\IslamicCalendar; use Spatie\Holidays\Exceptions\InvalidRegion; use Spatie\Holidays\Exceptions\InvalidYear; @@ -13,6 +14,8 @@ class Malaysia extends Country { use ChineseCalendar; + use IslamicCalendar; + protected string $timezone = 'Asia/Kuala_Lumpur'; /** @var array $regions */ @@ -65,12 +68,12 @@ protected function variableHolidays(int $year): array $variableHolidays = [ 'Tahun Baru Cina' => $this->lunarNewYear($year), 'Tahun Baru Cina Hari Kedua' => $this->lunarNewYear($year)->addDays(1), - 'Hari Raya Aidilfitri' => $this->hariAidilfitri($year), - 'Hari Raya Aidilfitri Hari Kedua' => $this->hariAidilfitri($year)->addDays(1), + 'Hari Raya Aidilfitri' => $this->islamicToGregorianDate('10-01', $year), + 'Hari Raya Aidilfitri Hari Kedua' => $this->islamicToGregorianDate('10-02', $year), 'Hari Wesak' => $this->hariWesak($year), - 'Hari Raya Aidiladha' => $this->hariAidiladha($year), - 'Awal Muharram' => $this->awalMuharram($year), - 'Maulidur Rasul' => $this->maulidurRasul($year), + 'Hari Raya Aidiladha' => $this->islamicToGregorianDate('12-10', $year), + 'Awal Muharram' => $this->islamicToGregorianDate('01-01', $year, true), + 'Maulidur Rasul' => $this->islamicToGregorianDate('03-12', $year, true), ]; if ($this->hariKeputeraanYDP($year)) { @@ -148,20 +151,20 @@ protected function holidaysByRegion(int $year): array protected function regionJohor(int $year): array { $johorHolidays = [ - 'Hari Keputeraan Sultan Johor' => CarbonImmutable::createFromDate($year, 3, 23, $this->timezone), + 'Hari Keputeraan Sultan Johor' => '03-23', 'Hari Thaipusam' => $this->hariThaipusam($year), - 'Awal Ramadan' => $this->awalRamadan($year), + 'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; $hariHolJohor = match ($year) { - 2020 => CarbonImmutable::createFromDate($year, 9, 24, $this->timezone), - 2021 => CarbonImmutable::createFromDate($year, 9, 13, $this->timezone), - 2022 => CarbonImmutable::createFromDate($year, 9, 3, $this->timezone), - 2023 => CarbonImmutable::createFromDate($year, 8, 23, $this->timezone), - 2024 => CarbonImmutable::createFromDate($year, 8, 11, $this->timezone), - 2025 => CarbonImmutable::createFromDate($year, 7, 31, $this->timezone), - 2026 => CarbonImmutable::createFromDate($year, 7, 21, $this->timezone), + 2020 => CarbonImmutable::createFromDate($year, 9, 24), + 2021 => CarbonImmutable::createFromDate($year, 9, 13), + 2022 => CarbonImmutable::createFromDate($year, 9, 3), + 2023 => CarbonImmutable::createFromDate($year, 8, 23), + 2024 => CarbonImmutable::createFromDate($year, 8, 11), + 2025 => CarbonImmutable::createFromDate($year, 7, 31), + 2026 => CarbonImmutable::createFromDate($year, 7, 21), default => null, }; @@ -179,10 +182,10 @@ protected function regionKedah(int $year): array { return [ 'Hari Thaipusam' => $this->hariThaipusam($year), - 'Israk dan Mikraj' => $this->israkMikraj($year), - 'Awal Ramadan' => $this->awalRamadan($year), - 'Hari Keputeraan Sultan Kedah' => CarbonImmutable::parse("third sunday of june {$year}", $this->timezone), - 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDay(), + 'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year), + 'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year), + 'Hari Keputeraan Sultan Kedah' => CarbonImmutable::parse("third sunday of june {$year}"), + 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -193,15 +196,15 @@ protected function regionKedah(int $year): array protected function regionKelantan(int $year): array { $kelantanHolidays = [ - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), - 'Hari Arafah' => $this->hariArafah($year), - 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDay(), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), + 'Hari Arafah' => $this->islamicToGregorianDate('12-09', $year), + 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; $kingBirthday = match (true) { - in_array($year, range(2010, 2022)) => CarbonImmutable::createFromDate($year, 11, 11, $this->timezone), - in_array($year, range(2023, 2026)) => CarbonImmutable::createFromDate($year, 9, 29, $this->timezone), + in_array($year, range(2010, 2022)) => CarbonImmutable::createFromDate($year, 11, 11), + in_array($year, range(2023, 2026)) => CarbonImmutable::createFromDate($year, 9, 29), default => null, }; @@ -211,8 +214,8 @@ protected function regionKelantan(int $year): array } $kingBirthdaySecondDay = match (true) { - in_array($year, range(2010, 2022)) => CarbonImmutable::createFromDate($year, 11, 12, $this->timezone), - in_array($year, range(2023, 2026)) => CarbonImmutable::createFromDate($year, 9, 30, $this->timezone), + in_array($year, range(2010, 2022)) => CarbonImmutable::createFromDate($year, 11, 12), + in_array($year, range(2023, 2026)) => CarbonImmutable::createFromDate($year, 9, 30), default => null, }; @@ -232,7 +235,7 @@ protected function regionKualaLumpur(int $year): array 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -247,7 +250,7 @@ protected function regionLabuan(int $year): array 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDay(), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -259,9 +262,9 @@ protected function regionMelaka(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Awal Ramadan' => $this->awalRamadan($year), - 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15, $this->timezone), - 'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24, $this->timezone), + 'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year), + 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15), + 'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -274,8 +277,8 @@ protected function regionNegeri9(int $year): array return [ 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), - 'Israk dan Mikraj' => $this->israkMikraj($year), - 'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14, $this->timezone), + 'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year), + 'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -287,9 +290,9 @@ protected function regionPahang(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), - 'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22, $this->timezone), - 'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30, $this->timezone), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), + 'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22), + 'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -302,9 +305,9 @@ protected function regionPenang(int $year): array return [ 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), - 'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7, $this->timezone), - 'Harijadi Yang di-Pertua Negeri Pulau Pinang' => CarbonImmutable::parse("second saturday of july {$year}", $this->timezone), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), + 'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7), + 'Harijadi Yang di-Pertua Negeri Pulau Pinang' => CarbonImmutable::parse("second saturday of july {$year}"), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -317,8 +320,8 @@ protected function regionPerak(int $year): array return [ 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), - 'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}", $this->timezone), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), + 'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}"), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -329,10 +332,10 @@ protected function regionPerak(int $year): array protected function regionPerlis(int $year): array { return [ - 'Israk dan Mikraj' => $this->israkMikraj($year), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), - 'Hari Keputeraan Raja Perlis' => CarbonImmutable::createFromDate($year, 5, 17, $this->timezone), - 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDays(1), + 'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), + 'Hari Keputeraan Raja Perlis' => CarbonImmutable::createFromDate($year, 5, 17), + 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -346,7 +349,7 @@ protected function regionPutrajaya(int $year): array 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -361,9 +364,9 @@ protected function regionSabah(int $year): array 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDays(1), 'Good Friday' => $this->goodFriday($year), - 'Harijadi Yang di-Pertua Negeri Sabah' => CarbonImmutable::parse("first saturday of october {$year}", $this->timezone), + 'Harijadi Yang di-Pertua Negeri Sabah' => CarbonImmutable::parse("first saturday of october {$year}"), 'Hari Deepavali' => $this->hariDeepavali($year), - 'Hari Natal' => CarbonImmutable::createFromDate($year, 12, 24, $this->timezone), + 'Hari Natal' => CarbonImmutable::createFromDate($year, 12, 24), ]; } @@ -374,10 +377,10 @@ protected function regionSarawak(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Sarawak' => CarbonImmutable::createFromDate($year, 7, 22, $this->timezone), - 'Hari Gawai' => CarbonImmutable::createFromDate($year, 6, 1, $this->timezone), - 'Hari Gawai Kedua' => CarbonImmutable::createFromDate($year, 6, 2, $this->timezone), - 'Harijadi Yang di-Pertua Negeri Sarawak' => CarbonImmutable::parse("second saturday of october {$year}", $this->timezone), + 'Hari Sarawak' => CarbonImmutable::createFromDate($year, 7, 22), + 'Hari Gawai' => CarbonImmutable::createFromDate($year, 6, 1), + 'Hari Gawai Kedua' => CarbonImmutable::createFromDate($year, 6, 2), + 'Harijadi Yang di-Pertua Negeri Sarawak' => CarbonImmutable::parse("second saturday of october {$year}"), 'Good Friday' => $this->goodFriday($year), ]; } @@ -390,9 +393,9 @@ protected function regionSelangor(int $year): array return [ 'Tahun Baru' => '01-01', 'Hari Thaipusam' => $this->hariThaipusam($year), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Deepavali' => $this->hariDeepavali($year), - 'Hari Keputeraan Sultan Selangor' => CarbonImmutable::createFromDate($year, 12, 11, $this->timezone), + 'Hari Keputeraan Sultan Selangor' => CarbonImmutable::createFromDate($year, 12, 11), ]; } @@ -402,12 +405,12 @@ protected function regionSelangor(int $year): array protected function regionTerengganu(int $year): array { return [ - 'Israk dan Mikraj' => $this->israkMikraj($year), - 'Hari Ulang Tahun Pertabalan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 3, 4, $this->timezone), - 'Hari Nurul Al-Quran' => $this->nuzulQuran($year), - 'Hari Keputeraan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 4, 26, $this->timezone), - 'Hari Arafah' => $this->hariArafah($year), - 'Hari Raya Aidiladha Hari Kedua' => $this->hariAidiladha($year)->addDays(1), + 'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year), + 'Hari Ulang Tahun Pertabalan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 3, 4), + 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), + 'Hari Keputeraan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 4, 26), + 'Hari Arafah' => $this->islamicToGregorianDate('12-09', $year), + 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), 'Hari Deepavali' => $this->hariDeepavali($year), ]; } @@ -417,65 +420,14 @@ private function lunarNewYear(int $year): CarbonImmutable return $this->chineseToGregorianDate('01-01', $year); } - protected function getIslamicFormatter(): IntlDateFormatter - { - return new IntlDateFormatter( - locale: 'ms_MY@calendar=islamic-civil', - dateType: IntlDateFormatter::MEDIUM, - timeType: IntlDateFormatter::NONE, - timezone: $this->timezone, - calendar: IntlDateFormatter::TRADITIONAL - ); - } - - protected function getHijriYear(int $year, bool $nextYear = false): int - { - $formatter = $this->getIslamicFormatter(); - $formatter->setPattern('yyyy'); - $dateTime = DateTime::createFromFormat('d/m/Y', '01/01/' . ($nextYear ? $year + 1 : $year)); - - if (!$dateTime) { - throw InvalidYear::invalidHijriYear(); - } - - return (int) $formatter->format($dateTime->getTimestamp()); - } - - /** - * $input as in 'day-month'; 01-10 for syawal - */ - protected function islamicCalendar(string $input, int $year, bool $nextYear = false): CarbonImmutable - { - $hijrYear = $this->getHijriYear(year: $year, nextYear: $nextYear); - $formatter = $this->getIslamicFormatter(); - $timeStamp = (int) $formatter->parse($input . '/' . $hijrYear . ' AH'); - - return CarbonImmutable::createFromTimestamp($timeStamp, $this->timezone); - } - - protected function hariAidilfitri(int $year): CarbonImmutable - { - return $this->islamicCalendar('01/10', $year); - } - protected function hariWilayah(int $year): CarbonImmutable { - return CarbonImmutable::createFromDate($year, 2, 1, $this->timezone); - } - - protected function israkMikraj(int $year): CarbonImmutable - { - return $this->islamicCalendar('27/7', $year); - } - - protected function awalRamadan(int $year): CarbonImmutable - { - return $this->islamicCalendar('1/9', $year); + return CarbonImmutable::createFromDate($year, 2, 1); } protected function pestaKaamatan(int $year): CarbonImmutable { - return CarbonImmutable::createFromDate($year, 5, 30, $this->timezone); + return CarbonImmutable::createFromDate($year, 5, 30); } protected function goodFriday(int $year): CarbonImmutable @@ -485,39 +437,14 @@ protected function goodFriday(int $year): CarbonImmutable return $easter->subDays(2); } - protected function nuzulQuran(int $year): CarbonImmutable - { - return $this->islamicCalendar('17/9', $year); - } - protected function hariKeputeraanYDP(int $year): ?CarbonImmutable { return match (true) { - in_array($year, range(2001, 2026)) => CarbonImmutable::parse("first saturday of october {$year}", $this->timezone), + in_array($year, range(2001, 2026)) => CarbonImmutable::parse("first saturday of october {$year}"), default => null, }; } - protected function hariArafah(int $year): CarbonImmutable - { - return $this->islamicCalendar('9/12', $year); - } - - protected function hariAidiladha(int $year): CarbonImmutable - { - return $this->islamicCalendar('10/12', $year); - } - - protected function awalMuharram(int $year): CarbonImmutable - { - return $this->islamicCalendar('1/1', $year, true); - } - - protected function maulidurRasul(int $year): CarbonImmutable - { - return $this->islamicCalendar('12/3', $year, true); - } - protected function hariWesak(int $year): string { return '01-01'; diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap index dc7caab73..7efe998eb 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_Malaysia_holidays.snap @@ -148,11 +148,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap index 67f604b75..c074f8649 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap index ebaa4e4ce..ac9344582 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap @@ -60,11 +60,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap index debc0b87f..1ec56d1e4 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap @@ -52,11 +52,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap index 135d293e7..5d46c6579 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap index b03b63f19..451be4205 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap @@ -60,11 +60,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap index 1c778ea95..95481d83a 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap index 6055bba36..58466ece3 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap index 61c83b9ce..8113ddb81 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap index 135d293e7..5d46c6579 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap index 0c2e9a635..edac07a13 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap index 3ee6974d1..5e9afe375 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap @@ -60,11 +60,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap index b4ec4d614..08a427c6d 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap @@ -52,11 +52,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap index 91d2b3a25..2c13e1b00 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap index 3223f13b3..cbcd01511 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap @@ -52,11 +52,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap index 51ac14f11..04678ca20 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap @@ -56,11 +56,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap index 0d78398d4..1d774b431 100644 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap +++ b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_calculate_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap @@ -64,11 +64,11 @@ "date": "2024-08-31" }, { - "name": "Maulidur Rasul", + "name": "Hari Malaysia", "date": "2024-09-16" }, { - "name": "Hari Malaysia", + "name": "Maulidur Rasul", "date": "2024-09-16" }, { diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap deleted file mode 100644 index 67f604b75..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____jhr___18_____jhr___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Awal Ramadan", - "date": "2024-03-11" - }, - { - "name": "Hari Keputeraan Sultan Johor", - "date": "2024-03-23" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Hol Johor", - "date": "2024-08-11" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap deleted file mode 100644 index ebaa4e4ce..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kdh___19_____kdh___19_.snap +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Israk dan Mikraj", - "date": "2024-02-07" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Awal Ramadan", - "date": "2024-03-11" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Keputeraan Sultan Kedah", - "date": "2024-06-16" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Hari Raya Aidiladha Hari Kedua", - "date": "2024-06-18" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap deleted file mode 100644 index debc0b87f..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____ktn___19_____ktn___19_.snap +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Arafah", - "date": "2024-06-16" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Hari Raya Aidiladha Hari Kedua", - "date": "2024-06-18" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Sultan Kelantan", - "date": "2024-09-29" - }, - { - "name": "Hari Keputeraan Sultan Kelantan Hari Kedua", - "date": "2024-09-30" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap deleted file mode 100644 index 135d293e7..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____kul___18_____kul___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Hari Wilayah Persekutuan", - "date": "2024-02-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap deleted file mode 100644 index b03b63f19..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____lbn___19_____lbn___19_.snap +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Hari Wilayah Persekutuan", - "date": "2024-02-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Pesta Kaamatan", - "date": "2024-05-30" - }, - { - "name": "Pesta Kaamatan Hari Kedua", - "date": "2024-05-31" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap deleted file mode 100644 index 1c778ea95..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____mlk___18_____mlk___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Awal Ramadan", - "date": "2024-03-11" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah", - "date": "2024-04-15" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Harijadi Yang di-Pertua Negeri Melaka", - "date": "2024-08-24" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap deleted file mode 100644 index 6055bba36..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____nsn___18_____nsn___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan", - "date": "2024-01-14" - }, - { - "name": "Israk dan Mikraj", - "date": "2024-02-07" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap deleted file mode 100644 index 61c83b9ce..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____phg___18_____phg___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Hol Pahang", - "date": "2024-05-22" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Keputeraan Sultan Pahang", - "date": "2024-07-30" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap deleted file mode 100644 index 135d293e7..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pjy___18_____pjy___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Hari Wilayah Persekutuan", - "date": "2024-02-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap deleted file mode 100644 index 0c2e9a635..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____pls___18_____pls___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Israk dan Mikraj", - "date": "2024-02-07" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Keputeraan Raja Perlis", - "date": "2024-05-17" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Hari Raya Aidiladha Hari Kedua", - "date": "2024-06-18" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap deleted file mode 100644 index 3ee6974d1..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____png___19_____png___19_.snap +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Hari Bandar Warisan Dunia Georgetown", - "date": "2024-07-07" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Harijadi Yang di-Pertua Negeri Pulau Pinang", - "date": "2024-07-13" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap deleted file mode 100644 index b4ec4d614..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____prk___18_____prk___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Keputeraan Sultan Perak", - "date": "2024-11-01" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap deleted file mode 100644 index 91d2b3a25..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sbh___20_____sbh___20_.snap +++ /dev/null @@ -1,82 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Good Friday", - "date": "2024-03-29" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Pesta Kaamatan", - "date": "2024-05-30" - }, - { - "name": "Pesta Kaamatan Hari Kedua", - "date": "2024-05-31" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Harijadi Yang di-Pertua Negeri Sabah", - "date": "2024-10-05" - }, - { - "name": "Hari Natal", - "date": "2024-12-24" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap deleted file mode 100644 index 3223f13b3..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____sgr___18_____sgr___18_.snap +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Hari Thaipusam", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Keputeraan Sultan Selangor", - "date": "2024-12-11" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap deleted file mode 100644 index 51ac14f11..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____swk___19_____swk___19_.snap +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru", - "date": "2024-01-01" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Good Friday", - "date": "2024-03-29" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Gawai", - "date": "2024-06-01" - }, - { - "name": "Hari Gawai Kedua", - "date": "2024-06-02" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Sarawak", - "date": "2024-07-22" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Harijadi Yang di-Pertua Negeri Sarawak", - "date": "2024-10-12" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap b/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap deleted file mode 100644 index 0d78398d4..000000000 --- a/tests/.pest/snapshots/Countries/MalaysiaTest/it_can_get_total_holidays_by_regions_with_data_set____trg___20_____trg___20_.snap +++ /dev/null @@ -1,82 +0,0 @@ -[ - { - "name": "Hari Wesak", - "date": "2024-01-01" - }, - { - "name": "Hari Deepavali", - "date": "2024-01-01" - }, - { - "name": "Israk dan Mikraj", - "date": "2024-02-07" - }, - { - "name": "Tahun Baru Cina", - "date": "2024-02-10" - }, - { - "name": "Tahun Baru Cina Hari Kedua", - "date": "2024-02-11" - }, - { - "name": "Hari Ulang Tahun Pertabalan Sultan Terengganu", - "date": "2024-03-04" - }, - { - "name": "Hari Nurul Al-Quran", - "date": "2024-03-27" - }, - { - "name": "Hari Raya Aidilfitri", - "date": "2024-04-10" - }, - { - "name": "Hari Raya Aidilfitri Hari Kedua", - "date": "2024-04-11" - }, - { - "name": "Hari Keputeraan Sultan Terengganu", - "date": "2024-04-26" - }, - { - "name": "Hari Pekerja", - "date": "2024-05-01" - }, - { - "name": "Hari Arafah", - "date": "2024-06-16" - }, - { - "name": "Hari Raya Aidiladha", - "date": "2024-06-17" - }, - { - "name": "Hari Raya Aidiladha Hari Kedua", - "date": "2024-06-18" - }, - { - "name": "Awal Muharram", - "date": "2024-07-08" - }, - { - "name": "Hari Kebangsaan", - "date": "2024-08-31" - }, - { - "name": "Maulidur Rasul", - "date": "2024-09-16" - }, - { - "name": "Hari Malaysia", - "date": "2024-09-16" - }, - { - "name": "Hari Keputeraan Yang Di-Pertuan Agong", - "date": "2024-10-05" - }, - { - "name": "Hari Krismas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/Countries/MalaysiaTest.php b/tests/Countries/MalaysiaTest.php index f14ea6043..09be119d6 100644 --- a/tests/Countries/MalaysiaTest.php +++ b/tests/Countries/MalaysiaTest.php @@ -19,35 +19,6 @@ expect(formatDates($holidays))->toMatchSnapshot(); }); -it('can calculate total holidays by regions', function (string $region, $totalHolidays) { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); - - $holidays = Holidays::for(Malaysia::make($region))->get(); - - expect($holidays) - ->toBeArray() - ->not()->toBeEmpty(); - - expect(formatDates($holidays))->toMatchSnapshot(); -})->with([ - ['jhr', 18], - ['kdh', 19], - ['ktn', 19], - ['kul', 18], - ['lbn', 19], - ['mlk', 18], - ['nsn', 18], - ['phg', 18], - ['png', 19], - ['prk', 18], - ['pls', 18], - ['pjy', 18], - ['sbh', 20], - ['swk', 19], - ['sgr', 18], - ['trg', 20], -]); - it('can calculate Hari Raya is in year 2023', function () { CarbonImmutable::setTestNow('2023-01-01'); From c8c331a39ff41fe7c6d2dbe1f1f142dc93599447 Mon Sep 17 00:00:00 2001 From: pisyek Date: Fri, 9 Feb 2024 15:16:32 +0800 Subject: [PATCH 17/18] refactor chinese function to use trait --- src/Countries/Malaysia.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 45e6f30c1..0375df2e2 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -3,12 +3,9 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; -use DateTime; -use IntlDateFormatter; use Spatie\Holidays\Calendars\ChineseCalendar; use Spatie\Holidays\Calendars\IslamicCalendar; use Spatie\Holidays\Exceptions\InvalidRegion; -use Spatie\Holidays\Exceptions\InvalidYear; class Malaysia extends Country { @@ -66,8 +63,8 @@ protected function variableHolidays(int $year): array $this->setChineseCalendarTimezone($this->timezone); $variableHolidays = [ - 'Tahun Baru Cina' => $this->lunarNewYear($year), - 'Tahun Baru Cina Hari Kedua' => $this->lunarNewYear($year)->addDays(1), + 'Tahun Baru Cina' => $this->chineseToGregorianDate('01-01', $year), + 'Tahun Baru Cina Hari Kedua' => $this->chineseToGregorianDate('01-02', $year), 'Hari Raya Aidilfitri' => $this->islamicToGregorianDate('10-01', $year), 'Hari Raya Aidilfitri Hari Kedua' => $this->islamicToGregorianDate('10-02', $year), 'Hari Wesak' => $this->hariWesak($year), @@ -415,11 +412,6 @@ protected function regionTerengganu(int $year): array ]; } - private function lunarNewYear(int $year): CarbonImmutable - { - return $this->chineseToGregorianDate('01-01', $year); - } - protected function hariWilayah(int $year): CarbonImmutable { return CarbonImmutable::createFromDate($year, 2, 1); From c929e4b95a7b49221ba5f491a4c4cd604c87ff6c Mon Sep 17 00:00:00 2001 From: pisyek Date: Fri, 9 Feb 2024 16:23:53 +0800 Subject: [PATCH 18/18] refactor function placeholder --- src/Countries/Malaysia.php | 63 +++++++++++++++----------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/src/Countries/Malaysia.php b/src/Countries/Malaysia.php index 0375df2e2..25779fb3a 100644 --- a/src/Countries/Malaysia.php +++ b/src/Countries/Malaysia.php @@ -67,7 +67,7 @@ protected function variableHolidays(int $year): array 'Tahun Baru Cina Hari Kedua' => $this->chineseToGregorianDate('01-02', $year), 'Hari Raya Aidilfitri' => $this->islamicToGregorianDate('10-01', $year), 'Hari Raya Aidilfitri Hari Kedua' => $this->islamicToGregorianDate('10-02', $year), - 'Hari Wesak' => $this->hariWesak($year), + 'Hari Wesak' => '01-01', 'Hari Raya Aidiladha' => $this->islamicToGregorianDate('12-10', $year), 'Awal Muharram' => $this->islamicToGregorianDate('01-01', $year, true), 'Maulidur Rasul' => $this->islamicToGregorianDate('03-12', $year, true), @@ -149,9 +149,9 @@ protected function regionJohor(int $year): array { $johorHolidays = [ 'Hari Keputeraan Sultan Johor' => '03-23', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; $hariHolJohor = match ($year) { @@ -178,12 +178,12 @@ protected function regionJohor(int $year): array protected function regionKedah(int $year): array { return [ - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year), 'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year), 'Hari Keputeraan Sultan Kedah' => CarbonImmutable::parse("third sunday of june {$year}"), 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -196,7 +196,7 @@ protected function regionKelantan(int $year): array 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Arafah' => $this->islamicToGregorianDate('12-09', $year), 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; $kingBirthday = match (true) { @@ -230,10 +230,10 @@ protected function regionKualaLumpur(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -248,7 +248,7 @@ protected function regionLabuan(int $year): array 'Pesta Kaamatan' => $this->pestaKaamatan($year), 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDay(), 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -262,7 +262,7 @@ protected function regionMelaka(int $year): array 'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year), 'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15), 'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -273,10 +273,10 @@ protected function regionNegeri9(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year), 'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -290,7 +290,7 @@ protected function regionPahang(int $year): array 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22), 'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -301,11 +301,11 @@ protected function regionPenang(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7), 'Harijadi Yang di-Pertua Negeri Pulau Pinang' => CarbonImmutable::parse("second saturday of july {$year}"), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -316,10 +316,10 @@ protected function regionPerak(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}"), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -333,7 +333,7 @@ protected function regionPerlis(int $year): array 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), 'Hari Keputeraan Raja Perlis' => CarbonImmutable::createFromDate($year, 5, 17), 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -344,10 +344,10 @@ protected function regionPutrajaya(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Hari Wilayah Persekutuan' => $this->hariWilayah($year), 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -362,7 +362,7 @@ protected function regionSabah(int $year): array 'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDays(1), 'Good Friday' => $this->goodFriday($year), 'Harijadi Yang di-Pertua Negeri Sabah' => CarbonImmutable::parse("first saturday of october {$year}"), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', 'Hari Natal' => CarbonImmutable::createFromDate($year, 12, 24), ]; } @@ -389,9 +389,9 @@ protected function regionSelangor(int $year): array { return [ 'Tahun Baru' => '01-01', - 'Hari Thaipusam' => $this->hariThaipusam($year), + 'Hari Thaipusam' => '01-01', 'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', 'Hari Keputeraan Sultan Selangor' => CarbonImmutable::createFromDate($year, 12, 11), ]; } @@ -408,7 +408,7 @@ protected function regionTerengganu(int $year): array 'Hari Keputeraan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 4, 26), 'Hari Arafah' => $this->islamicToGregorianDate('12-09', $year), 'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year), - 'Hari Deepavali' => $this->hariDeepavali($year), + 'Hari Deepavali' => '01-01', ]; } @@ -436,19 +436,4 @@ protected function hariKeputeraanYDP(int $year): ?CarbonImmutable default => null, }; } - - protected function hariWesak(int $year): string - { - return '01-01'; - } - - protected function hariThaipusam(int $year): string - { - return '01-01'; - } - - protected function hariDeepavali(int $year): string - { - return '01-01'; - } }