Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] sudan public holidays #179

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/Countries/Sudan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;

class Sudan extends Country
{
public function countryCode(): string
{
return 'sd';
}

protected function allHolidays(int $year): array
{
return array_merge([
"New Year's Day" => '01-01',
'Independence Day' => '01-01',
'Labour Day' => '05-01',
'Christmas Day' => '12-25'
], $this->variableHolidays($year));
}

/**
* @return array<string, CarbonImmutable>
*/
private function variableHolidays(int $year): array
{
return [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how other countries solved the Islamic holidays: https://github.com/spatie/holidays/blob/main/src/Countries/Turkey.php#L8

}
}
18 changes: 18 additions & 0 deletions tests/Countries/SudanTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Spatie\Holidays\Tests\Countries;

use Carbon\CarbonImmutable;
use Spatie\Holidays\Holidays;

it('can calculate sudan holidays', function () {
CarbonImmutable::setTestNowAndTimezone('2024-01-01');

$holidays = Holidays::for(country: 'sd')->get();

expect($holidays)
->toBeArray()
->not()->toBeEmpty();

expect(formatDates($holidays))->toMatchSnapshot();
});
Loading