Skip to content

Commit

Permalink
Add Azerbaijan holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
kenanaga committed Jan 22, 2024
1 parent 48bb3ba commit 01680ab
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/Countries/Azerbaijan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;

class Azerbaijan extends Country
{
public function countryCode(): string
{
return 'az';
}

protected function allHolidays(int $year): array
{
return array_merge([
'Yeni il' => '01-01',
'Beynəlxalq Qadınlar günü' => '03-08',
'Novruz bayramı' => '03-20',
'Faşizm üzərində qələbə günü' => '05-09',
'Müstəqillik Günü' => '05-28',
'Azərbaycan xalqının milli qurtuluş günü' => '06-15',
'Azərbaycan Respublikasının Silahlı Qüvvələri günü' => '06-26',
'Müstəqilliyin bərpası günü' => '10-18',
'Zəfər Günü' => '11-08',
'Azərbaycan Respublikasının Dövlət bayrağı günü' => '11-09',
'Dünya azərbaycanlılarının həmrəyliyi günü' => '12-31',
], $this->variableHolidays($year));
}

/** @return array<string, CarbonImmutable> */
protected function variableHolidays(int $year): array
{
// does not change according to the standard
return [];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[
{
"name": "Yeni il",
"date": "2024-01-01"
},
{
"name": "Beyn\u0259lxalq Qad\u0131nlar g\u00fcn\u00fc",
"date": "2024-03-08"
},
{
"name": "Novruz bayram\u0131",
"date": "2024-03-20"
},
{
"name": "Fa\u015fizm \u00fcz\u0259rind\u0259 q\u0259l\u0259b\u0259 g\u00fcn\u00fc",
"date": "2024-05-09"
},
{
"name": "M\u00fcst\u0259qillik G\u00fcn\u00fc",
"date": "2024-05-28"
},
{
"name": "Az\u0259rbaycan xalq\u0131n\u0131n milli qurtulu\u015f g\u00fcn\u00fc",
"date": "2024-06-15"
},
{
"name": "Az\u0259rbaycan Respublikas\u0131n\u0131n Silahl\u0131 Q\u00fcvv\u0259l\u0259ri g\u00fcn\u00fc",
"date": "2024-06-26"
},
{
"name": "M\u00fcst\u0259qilliyin b\u0259rpas\u0131 g\u00fcn\u00fc",
"date": "2024-10-18"
},
{
"name": "Z\u0259f\u0259r G\u00fcn\u00fc",
"date": "2024-11-08"
},
{
"name": "Az\u0259rbaycan Respublikas\u0131n\u0131n D\u00f6vl\u0259t bayra\u011f\u0131 g\u00fcn\u00fc",
"date": "2024-11-09"
},
{
"name": "D\u00fcnya az\u0259rbaycanl\u0131lar\u0131n\u0131n h\u0259mr\u0259yliyi g\u00fcn\u00fc",
"date": "2024-12-31"
}
]
18 changes: 18 additions & 0 deletions tests/Countries/AzerbaijanTest.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 azerbaijani holidays', function () {
CarbonImmutable::setTestNowAndTimezone('2024-01-01');

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

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

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

0 comments on commit 01680ab

Please sign in to comment.