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 Azerbaijan holidays #166

Merged
merged 4 commits into from
Feb 8, 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
13 changes: 13 additions & 0 deletions lang/azerbaijan/en/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Yeni il": "New year",
"Beynəlxalq Qadınlar günü": "International Women's Day",
"Novruz bayramı": "Novruz holiday",
"Faşizm üzərində qələbə günü": "Day of Victory over fascism",
"Müstəqillik Günü": "Independence Day",
"Azərbaycan xalqının milli qurtuluş günü": "National Salvation Day of the Azerbaijani people",
"Azərbaycan Respublikasının Silahlı Qüvvələri günü": "Day of Armed Forces of the Republic of Azerbaijan",
"Müstəqilliyin bərpası günü": "Day of Restoration of Independence",
"Zəfər Günü": "Victory Day",
"Azərbaycan Respublikasının Dövlət bayrağı günü": "National Flag Day of the Republic of Azerbaijan",
"Dünya azərbaycanlılarının həmrəyliyi günü": "World Azerbaijanis Solidarity Day"
}
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"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[
{
"name": "New year",
"date": "2024-01-01"
},
{
"name": "International Women's Day",
"date": "2024-03-08"
},
{
"name": "Novruz holiday",
"date": "2024-03-20"
},
{
"name": "Day of Victory over fascism",
"date": "2024-05-09"
},
{
"name": "Independence Day",
"date": "2024-05-28"
},
{
"name": "National Salvation Day of the Azerbaijani people",
"date": "2024-06-15"
},
{
"name": "Day of Armed Forces of the Republic of Azerbaijan",
"date": "2024-06-26"
},
{
"name": "Day of Restoration of Independence",
"date": "2024-10-18"
},
{
"name": "Victory Day",
"date": "2024-11-08"
},
{
"name": "National Flag Day of the Republic of Azerbaijan",
"date": "2024-11-09"
},
{
"name": "World Azerbaijanis Solidarity Day",
"date": "2024-12-31"
}
]
30 changes: 30 additions & 0 deletions tests/Countries/AzerbaijanTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Spatie\Holidays\Tests\Countries;

use Carbon\CarbonImmutable;
use Spatie\Holidays\Holidays;

it('can calculate azerbaijani holidays', function () {
CarbonImmutable::setTestNow('2024-01-01');

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

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

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

it('can calculate azerbaijani holidays in english', function () {
CarbonImmutable::setTestNow('2024-01-01');

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

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

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