Skip to content

Commit

Permalink
fix Serbia
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jan 24, 2024
1 parent 3fe1835 commit 8648337
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/Countries/Serbia.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

class Serbia extends Country
{
protected function __construct(
public ?string $region = null
) {
}

public function countryCode(): string
{
return 'sr';
Expand All @@ -33,22 +28,12 @@ protected function allHolidays(int $year): array
/** @return array<string, CarbonImmutable> */
protected function variableHolidays(int $year): array
{
$easter = CarbonImmutable::createFromTimestamp(
$this->orthodoxEaster($year)
)->setTimezone('Europe/Belgrade');
$easter = $this->orthodoxEaster($year);

return [
'Veliki petak' => $easter->subDays(2),
'Vaskrs' => $easter,
'Vaskršnji ponedeljak' => $easter->addDay(),
];
}

protected function orthodoxEaster(int $year): int
{
$timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN);
$daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2;

return (int) strtotime("+$daysDifference days", $timestamp);
}
}

0 comments on commit 8648337

Please sign in to comment.