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 holidays for Luxembourg #165

Merged
merged 1 commit into from
Jan 23, 2024
Merged
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
39 changes: 39 additions & 0 deletions src/Countries/Luxembourg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;

class Luxembourg extends Country
{
public function countryCode(): string
{
return 'lu';
}

protected function allHolidays(int $year): array
{
return array_merge([
'Neijoerschdag' => '01-01',
'Dag vun der Aarbecht' => '05-01',
'Europadag' => '05-09',
'Nationalfeierdag' => '06-23',
'Mariä Himmelfahrt' => '08-15',
'Allerhellgen' => '11-01',
'Chrëschtdag' => '12-25',
'Stiefesdag' => '12-26',
], $this->variableHolidays($year));
}

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

return [
'Ouschterméindeg' => $easter->addDay(),
'Christi Himmelfahrt' => $easter->addDays(39),
'Péngschtméindeg' => $easter->addDays(50),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[
{
"name": "Neijoerschdag",
"date": "2024-01-01"
},
{
"name": "Ouschterm\u00e9indeg",
"date": "2024-04-01"
},
{
"name": "Dag vun der Aarbecht",
"date": "2024-05-01"
},
{
"name": "Europadag",
"date": "2024-05-09"
},
{
"name": "Christi Himmelfahrt",
"date": "2024-05-09"
},
{
"name": "P\u00e9ngschtm\u00e9indeg",
"date": "2024-05-20"
},
{
"name": "Nationalfeierdag",
"date": "2024-06-23"
},
{
"name": "Mari\u00e4 Himmelfahrt",
"date": "2024-08-15"
},
{
"name": "Allerhellgen",
"date": "2024-11-01"
},
{
"name": "Chr\u00ebschtdag",
"date": "2024-12-25"
},
{
"name": "Stiefesdag",
"date": "2024-12-26"
}
]
18 changes: 18 additions & 0 deletions tests/Countries/LuxembourgTest.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 luxembourgish holidays', function () {
CarbonImmutable::setTestNowAndTimezone('2024-01-01');

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

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

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