Skip to content

Commit

Permalink
Merge pull request #163 from eimantaaas/main
Browse files Browse the repository at this point in the history
Add Lithuanian holidays
  • Loading branch information
freekmurze authored Jan 23, 2024
2 parents 6edbdf3 + b45dd8e commit 1c9bdcf
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/Countries/Lithuania.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;

class Lithuania extends Country
{
public function countryCode(): string
{
return 'lt';
}

protected function allHolidays(int $year): array
{
return array_merge([
'Naujieji metai' => '01-01',
'Lietuvos valstybės atkūrimo diena' => '02-16',
'Nepriklausomybės atkūrimo diena' => '03-11',
'Tarptautinė darbo diena' => '05-01',
'Joninės' => '06-24',
'Karaliaus Mindaugo karūnavimo diena' => '07-06',
'Žolinė' => '08-15',
'Visų šventųjų diena' => '11-01',
'Vėlinės' => '11-02',
'Šv. Kūčios' => '12-24',
'Šv. Kalėdos' => '12-25',
'Šv. Kalėdų antroji diena' => '12-26',
], $this->variableHolidays($year));
}

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

return [
'Velykos' => $easter,
'Velykų antroji diena' => $easter->addDay(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"name": "Naujieji metai",
"date": "2024-01-01"
},
{
"name": "Lietuvos valstyb\u0117s atk\u016brimo diena",
"date": "2024-02-16"
},
{
"name": "Nepriklausomyb\u0117s atk\u016brimo diena",
"date": "2024-03-11"
},
{
"name": "Velykos",
"date": "2024-03-31"
},
{
"name": "Velyk\u0173 antroji diena",
"date": "2024-04-01"
},
{
"name": "Tarptautin\u0117 darbo diena",
"date": "2024-05-01"
},
{
"name": "Jonin\u0117s",
"date": "2024-06-24"
},
{
"name": "Karaliaus Mindaugo kar\u016bnavimo diena",
"date": "2024-07-06"
},
{
"name": "\u017dolin\u0117",
"date": "2024-08-15"
},
{
"name": "Vis\u0173 \u0161vent\u0173j\u0173 diena",
"date": "2024-11-01"
},
{
"name": "V\u0117lin\u0117s",
"date": "2024-11-02"
},
{
"name": "\u0160v. K\u016b\u010dios",
"date": "2024-12-24"
},
{
"name": "\u0160v. Kal\u0117dos",
"date": "2024-12-25"
},
{
"name": "\u0160v. Kal\u0117d\u0173 antroji diena",
"date": "2024-12-26"
}
]
18 changes: 18 additions & 0 deletions tests/Countries/LithuaniaTest.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 lithuanian holidays', function () {
CarbonImmutable::setTestNowAndTimezone('2024-01-01', 'Europe/Vilnius');

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

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

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

0 comments on commit 1c9bdcf

Please sign in to comment.