Skip to content

Commit

Permalink
implement Islamic interface on Syria
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Mar 22, 2024
1 parent 0bb161f commit ffa7382
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"laravel/pint": "^1.0",
"laravel/prompts": "^0.1.15",
"pestphp/pest": "^2.31",
"phpstan/phpstan": "1.10.56",
"phpstan/phpstan": "^1.10.56",
"spatie/invade": "^2.0",
"spatie/ray": "^1.40.1",
"symfony/var-dumper": "^6.4"
Expand Down
1 change: 1 addition & 0 deletions src/Countries/Canada.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected function variableHolidays(int $year): array
{
$easter = $this->easter($year);

/** @var CarbonImmutable $victoriaDay */
$victoriaDay = (new CarbonImmutable("last monday of May $year"))->startOfDay();

if ($victoriaDay->day < 25) {
Expand Down
17 changes: 14 additions & 3 deletions src/Countries/Syria.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;
use Spatie\Holidays\Calendars\IslamicCalendar;
use Spatie\Holidays\Concerns\Translatable;
use Spatie\Holidays\Contracts\HasTranslations;
use Spatie\Holidays\Contracts\Islamic;

class Syria extends Country implements HasTranslations
class Syria extends Country implements HasTranslations, Islamic
{
use IslamicCalendar;
use Translatable;

public function countryCode(): string
Expand All @@ -22,6 +25,7 @@ public function defaultLocale(): string

protected function allHolidays(int $year): array
{
// @todo the islamic holidays should be calculated
return array_merge([
"New Year\n's Day" => '01-01',
"Mother\n's Day" => '03-21',
Expand All @@ -37,13 +41,20 @@ protected function allHolidays(int $year): array
'The commemoration of the birth of the Prophet Muhammad' => '09-15',
'The October Liberation War' => '10-06',
'Christmas' => '12-25',
], $this->variableHolidays($year));
],
$this->variableHolidays($year),
$this->islamicHolidays($year),
);
}

/** @return array<string, string|CarbonImmutable> */
protected function variableHolidays(int $year): array
{
// The variable holidays all follow the lunar calendar, so their dates are not confirmed.
return [];
}

public function islamicHolidays(int $year): array
{
return []; // @todo
}
}

0 comments on commit ffa7382

Please sign in to comment.