From cfb13c6351af068ec00c22b768d22aed15326ac5 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Date: Wed, 17 Jan 2024 21:13:04 +0500 Subject: [PATCH 1/5] added Pakistan as the country --- src/Countries/Pakistan.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/Countries/Pakistan.php diff --git a/src/Countries/Pakistan.php b/src/Countries/Pakistan.php new file mode 100644 index 000000000..1ecf6f706 --- /dev/null +++ b/src/Countries/Pakistan.php @@ -0,0 +1,36 @@ + + * @link https://en.wikipedia.org/wiki/Public_holidays_in_Pakistan + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Kashmir Solidarity Day' => '02-05', + 'Pakistan Day' => '03-23', + 'Labour Day' => '05-01', + 'Independence Day' => '08-14', + 'Iqbal Day' => '11-09', + 'Quaid-e-Azam Day' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + // The variable holidays are all follow lunar calendar so their dates are not confirmed. + return []; + } +} From e33bb1bab49bd2951cb5ef619c01b26dcfd2387d Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Date: Wed, 17 Jan 2024 21:35:31 +0500 Subject: [PATCH 2/5] Added tests for country Pakistan --- .../it_can_calculate_pakistan_holidays.snap | 26 +++++++++++++++++++ tests/Countries/PakistanTest.php | 18 +++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/.pest/snapshots/Countries/PakistanTest/it_can_calculate_pakistan_holidays.snap create mode 100644 tests/Countries/PakistanTest.php diff --git a/tests/.pest/snapshots/Countries/PakistanTest/it_can_calculate_pakistan_holidays.snap b/tests/.pest/snapshots/Countries/PakistanTest/it_can_calculate_pakistan_holidays.snap new file mode 100644 index 000000000..59b4a0503 --- /dev/null +++ b/tests/.pest/snapshots/Countries/PakistanTest/it_can_calculate_pakistan_holidays.snap @@ -0,0 +1,26 @@ +[ + { + "name": "Kashmir Solidarity Day", + "date": "2024-02-05" + }, + { + "name": "Pakistan Day", + "date": "2024-03-23" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Independence Day", + "date": "2024-08-14" + }, + { + "name": "Iqbal Day", + "date": "2024-11-09" + }, + { + "name": "Quaid-e-Azam Day", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/PakistanTest.php b/tests/Countries/PakistanTest.php new file mode 100644 index 000000000..8f8695f3f --- /dev/null +++ b/tests/Countries/PakistanTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); From 1b250808281579c314969fe753d10728b549ffae Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Date: Thu, 18 Jan 2024 18:12:25 +0500 Subject: [PATCH 3/5] removed doc block --- src/Countries/Pakistan.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Countries/Pakistan.php b/src/Countries/Pakistan.php index 1ecf6f706..da2158357 100644 --- a/src/Countries/Pakistan.php +++ b/src/Countries/Pakistan.php @@ -11,10 +11,6 @@ public function countryCode(): string return 'pk'; } - /** - * @return array - * @link https://en.wikipedia.org/wiki/Public_holidays_in_Pakistan - */ protected function allHolidays(int $year): array { return array_merge([ From 63498526b1e0aebfd9ad6bb00d29954bf010d1d4 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Date: Sat, 27 Jan 2024 13:21:55 +0500 Subject: [PATCH 4/5] Added Urdu translations --- lang/pakistan/ur/holidays.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lang/pakistan/ur/holidays.json diff --git a/lang/pakistan/ur/holidays.json b/lang/pakistan/ur/holidays.json new file mode 100644 index 000000000..ad4ec0e80 --- /dev/null +++ b/lang/pakistan/ur/holidays.json @@ -0,0 +1,8 @@ +{ + "Kashmir Solidarity Day": "یوم یکجہتی کشمیر", + "Pakistan Day": "یوم پاکستان", + "Labour Day": "مزدورں کادن", + "Independence Day": "یوم آزادی", + "Iqbal Day": "یوم اقبال", + "Quaid-e-Azam Day": "قائداعظم کا یوم پیدائش" +} From 69377d1a9fded9e664d535c970f8a4ae14b6223d Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Date: Thu, 1 Feb 2024 17:46:11 +0500 Subject: [PATCH 5/5] Update tests/Countries/PakistanTest.php Co-authored-by: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> --- tests/Countries/PakistanTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Countries/PakistanTest.php b/tests/Countries/PakistanTest.php index 8f8695f3f..e72e90faf 100644 --- a/tests/Countries/PakistanTest.php +++ b/tests/Countries/PakistanTest.php @@ -6,7 +6,7 @@ use Spatie\Holidays\Holidays; it('can calculate pakistan holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + CarbonImmutable::setTestNow('2024-01-01'); $holidays = Holidays::for(country: 'pk')->get();