Skip to content

Commit

Permalink
feat: add switzerland
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Welte committed Jan 22, 2024
1 parent 48bb3ba commit b586ebd
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/Countries/Switzerland.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;

class Switzerland extends Country
{
public function countryCode(): string
{
return 'ch';
}

protected function allHolidays(int $year): array
{
return array_merge([
'Neujahr' => '01-01',
'Berchtoldstag' => '01-02',
'Bundesfeier' => '08-01',
'Weihnachtstag' => '12-25',
'Stephanstag' => '12-26',
], $this->variableHolidays($year));
}

/** @return array<string, CarbonImmutable> */
protected function variableHolidays(int $year): array
{
$easter = $this->easter($year);

return [
'Karfreitag' => $easter->subDays(2),
'Ostermontag' => $easter->addDay(),
'Auffahrt' => $easter->addDays(39),
'Pfingstmontag' => $easter->addDays(50),
];
}
}

0 comments on commit b586ebd

Please sign in to comment.