Skip to content

Commit

Permalink
Add holidays for Luxembourg (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
UrbinCedric authored Jan 23, 2024
1 parent 74d1956 commit 7a09493
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
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();
});

0 comments on commit 7a09493

Please sign in to comment.