generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Albanian National Holidays - Add Albanian national holidays including tentative dates for islamic holidays that are TBD. - Test coverage. * Albanian National Holidays - Add test coverage for holidays with standard dates. * Enhancements - Add empty line in the end of the testing file. * Enhancements - Fix empty line warning in the end of the file. * Fixes - Fix php stan error. * Fix holiday TYPO. * Language support - Translation for German, English, Spanish, French, Greek, Italian, Portughese, Russian, Turkish. * Filter out some variable holidays when they are not set for the given year. --------- Co-authored-by: Miril Terolli <[email protected]>
- Loading branch information
1 parent
6fde494
commit feda8ec
Showing
12 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Albania extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'al'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Viti i Ri' => '01-01', | ||
'Dita e Verës' => '03-14', | ||
'Dita e Sulltan Nevruzit' => '03-22', | ||
'Dita Ndërkombëtare e Punëtorëve' => '05-01', | ||
'Dita e Shenjtërimit të Shenjt Terezës' => '09-05', | ||
'Dita e Pavarësisë' => '11-28', | ||
'Dita e Çlirimit' => '11-29', | ||
'Dita Kombëtare e Rinisë' => '12-08', | ||
'Krishtlindja' => '12-25', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable|string> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
return array_filter([ | ||
'E diela e Pashkëve Katolike' => $this->easter($year), | ||
'E diela e Pashkëve Ortodokse' => $this->orthodoxEaster($year), | ||
'Dita e Bajramit të Madh' => $this->getEidAlFitrHoliday($year), | ||
'Dita e Kurban Bajramit' => $this->getEidAlAdhaHoliday($year), | ||
]); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
private function getEidAlFitrHoliday(int $year): ?string | ||
{ | ||
/** | ||
* Provided until 2034 by qppstudio.net. | ||
* https://www.qppstudio.net/global-holidays-observances/eid-al-fitr-end-of-ramadan.htm | ||
*/ | ||
return match ($year) { | ||
2024 => '04-10', | ||
2025 => '03-30', | ||
2026 => '03-20', | ||
2027 => '03-09', | ||
2028 => '02-26', | ||
2029 => '02-14', | ||
2030 => '02-04', | ||
2031 => '01-24', | ||
2032 => '01-14', | ||
2033 => '01-02', | ||
2034 => '12-12', | ||
default => null // Holiday is variable; requires ongoing maintenance. | ||
}; | ||
} | ||
|
||
private function getEidAlAdhaHoliday(int $year): ?string | ||
{ | ||
/** | ||
* Tentative dates. | ||
* Provided until 2034 by timeanddate.com. | ||
* https://www.timeanddate.com/holidays/us/eid-al-adha | ||
*/ | ||
return match ($year) { | ||
2024 => '06-17', | ||
2025 => '06-07', | ||
2026 => '05-27', | ||
2027 => '05-17', | ||
2028 => '05-05', | ||
2029 => '04-24', | ||
2030 => '04-14', | ||
2031 => '04-03', | ||
2032 => '03-22', | ||
2033 => '03-12', | ||
2034 => '03-01', | ||
default => null // Holiday is variable; requires ongoing maintenance. | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Neujahr", | ||
"Dita e Verës": "Sommertag", | ||
"Dita e Sulltan Nevruzit": "Tag des Sultan Nevruz", | ||
"Dita Ndërkombëtare e Punëtorëve": "Tag der Arbeit", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Tag der Heiligsprechung der Heiligen Teresa", | ||
"Dita e Pavarësisë": "Unabhängigkeitstag", | ||
"Dita e Çlirimit": "Befreiungstag", | ||
"Dita Kombëtare e Rinisë": "Nationaler Jugendtag", | ||
"Krishtlindja": "Weihnachten", | ||
"E diela e Pashkëve Katolike": "Katholischer Ostersonntag", | ||
"E diela e Pashkëve Ortodokse": "Orthodoxer Ostersonntag", | ||
"Dita e Bajramit të Madh": "Eid al-Fitr", | ||
"Dita e Kurban Bajramit": "Eid al-Adha" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "New Year's Day", | ||
"Dita e Verës": "Summer Day", | ||
"Dita e Sulltan Nevruzit": "Sultan Nevruz Day", | ||
"Dita Ndërkombëtare e Punëtorëve": "International Workers' Day", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Saint Teresa Canonization Day", | ||
"Dita e Pavarësisë": "Independence Day", | ||
"Dita e Çlirimit": "Liberation Day", | ||
"Dita Kombëtare e Rinisë": "National Youth Day", | ||
"Krishtlindja": "Christmas", | ||
"E diela e Pashkëve Katolike": "Catholic Easter Sunday", | ||
"E diela e Pashkëve Ortodokse": "Orthodox Easter Sunday", | ||
"Dita e Bajramit të Madh": "Eid al-Fitr", | ||
"Dita e Kurban Bajramit": "Eid al-Adha" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Año Nuevo", | ||
"Dita e Verës": "Día del Verano", | ||
"Dita e Sulltan Nevruzit": "Día del Sultan Nevruz", | ||
"Dita Ndërkombëtare e Punëtorëve": "Día Internacional de los Trabajadores", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Día de la Canonización de Santa Teresa", | ||
"Dita e Pavarësisë": "Día de la Independencia", | ||
"Dita e Çlirimit": "Día de la Liberación", | ||
"Dita Kombëtare e Rinisë": "Día Nacional de la Juventud", | ||
"Krishtlindja": "Navidad", | ||
"E diela e Pashkëve Katolike": "Domingo de Pascua Católica", | ||
"E diela e Pashkëve Ortodokse": "Domingo de Pascua Ortodoxa", | ||
"Dita e Bajramit të Madh": "Eid al-Fitr", | ||
"Dita e Kurban Bajramit": "Eid al-Adha" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"Viti i Ri": "Jour de l'An", | ||
"Dita e Verës": "Jour de l'Été", | ||
"Dita e Sulltan Nevruzit": "Jour du Sultan Nevruz", | ||
"Dita Ndërkombëtare e Punëtorëve": "Fête du Travail", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Jour de la Canonisation de Sainte Teresa", | ||
"Dita e Pavarësisë": "Jour de l'Indépendance", | ||
"Dita e Çlirimit": "Jour de la Libération", | ||
"Dita Kombëtare e Rinisë": "Journée nationale de la jeunesse", | ||
"Krishtlindja": "Noël", | ||
"E diela e Pashkëve Katolike": "Dimanche de Pâques catholique", | ||
"E diela e Pashkëve Ortodokse": "Dimanche de Pâques orthodoxe", | ||
"Dita e Bajramit të Madh": "Aïd al-Fitr", | ||
"Dita e Kurban Bajramit": "Aïd al-Adha" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Πρωτοχρονιά (Protochroniá)", | ||
"Dita e Verës": "Ημέρα του Καλοκαιριού (Iméra tou Kalokairioú)", | ||
"Dita e Sulltan Nevruzit": "Ημέρα του Σουλτάν Nevruz (Iméra tou Soúltan Nevruz)", | ||
"Dita Ndërkombëtare e Punëtorëve": "Διεθνής Ημέρα των Εργαζομένων (Diethnís Iméra ton Ergazoménon)", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Ημέρα Κανονισμού της Αγίας Τερέζας (Iméra Kanonismoú tis Agías Terézas)", | ||
"Dita e Pavarësisë": "Ημέρα Ανεξαρτησίας (Iméra Anexartisías)", | ||
"Dita e Çlirimit": "Ημέρα Απελευθέρωσης (Iméra Apelafthéroses)", | ||
"Dita Kombëtare e Rinisë": "Εθνική Ημέρα της Νεολαίας (Ethnikí Iméra tis Neoléas)", | ||
"Krishtlindja": "Χριστούγεννα (Christoúgenna)", | ||
"E diela e Pashkëve Katolike": "Κυριακή του Καθολικού Πάσχα (Kyriakí tou Katholikoú Páscha)", | ||
"E diela e Pashkëve Ortodokse": "Κυριακή του Ορθόδοξου Πάσχα (Kyriakí tou Orthódoksi Páscha)", | ||
"Dita e Bajramit të Madh": "Ημέρα του Μεγάλου Βαϊράμ (Iméra tou Megálou Vaïrám)", | ||
"Dita e Kurban Bajramit": "Ημέρα του Κουρμπάν Βαϊράμ (Iméra tou Kourbán Vaïrám)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Capodanno", | ||
"Dita e Verës": "Giorno d'Estate", | ||
"Dita e Sulltan Nevruzit": "Giorno del Sultano Nevruz", | ||
"Dita Ndërkombëtare e Punëtorëve": "Festa dei Lavoratori", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Giorno della Canonizzazione di Santa Teresa", | ||
"Dita e Pavarësisë": "Giorno dell'Indipendenza", | ||
"Dita e Çlirimit": "Giorno della Liberazione", | ||
"Dita Kombëtare e Rinisë": "Giornata Nazionale della Gioventù", | ||
"Krishtlindja": "Natale", | ||
"E diela e Pashkëve Katolike": "Domenica di Pasqua Cattolica", | ||
"E diela e Pashkëve Ortodokse": "Domenica di Pasqua Ortodossa", | ||
"Dita e Bajramit të Madh": "Eid al-Fitr", | ||
"Dita e Kurban Bajramit": "Eid al-Adha" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Ano Novo", | ||
"Dita e Verës": "Dia do Verão", | ||
"Dita e Sulltan Nevruzit": "Dia do Sultão Nevruz", | ||
"Dita Ndërkombëtare e Punëtorëve": "Dia Internacional dos Trabalhadores", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Dia da Canonização de Santa Teresa", | ||
"Dita e Pavarësisë": "Dia da Independência", | ||
"Dita e Çlirimit": "Dia da Libertação", | ||
"Dita Kombëtare e Rinisë": "Dia Nacional da Juventude", | ||
"Krishtlindja": "Natal", | ||
"E diela e Pashkëve Katolike": "Domingo de Páscoa Católico", | ||
"E diela e Pashkëve Ortodokse": "Domingo de Páscoa Ortodoxo", | ||
"Dita e Bajramit të Madh": "Eid al-Fitr", | ||
"Dita e Kurban Bajramit": "Eid al-Adha" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Новий рік", | ||
"Dita e Verës": "День літа", | ||
"Dita e Sulltan Nevruzit": "День Султана Невруза", | ||
"Dita Ndërkombëtare e Punëtorëve": "Міжнародний день праці", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "День канонізації Святої Терези", | ||
"Dita e Pavarësisë": "День Незалежності", | ||
"Dita e Çlirimit": "День Визволення", | ||
"Dita Kombëtare e Rinisë": "Національний день молоді", | ||
"Krishtlindja": "Різдво", | ||
"E diela e Pashkëve Katolike": "Католицька неділя Великодня", | ||
"E diela e Pashkëve Ortodokse": "Православна неділя Великодня", | ||
"Dita e Bajramit të Madh": "Байрам", | ||
"Dita e Kurban Bajramit": "Курбан-байрам" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Viti i Ri": "Yılbaşı", | ||
"Dita e Verës": "Yaz Günü", | ||
"Dita e Sulltan Nevruzit": "Sultan Nevruz Günü", | ||
"Dita Ndërkombëtare e Punëtorëve": "Uluslararası İşçi Günü", | ||
"Dita e Shenjtërimit të Shenjt Terezës": "Azize Teresa'nın Kanonizasyon Günü", | ||
"Dita e Pavarësisë": "Bağımsızlık Günü", | ||
"Dita e Çlirimit": "Kurtuluş Günü", | ||
"Dita Kombëtare e Rinisë": "Ulusal Gençlik Günü", | ||
"Krishtlindja": "Noel", | ||
"E diela e Pashkëve Katolike": "Katolik Paskalya Pazarı", | ||
"E diela e Pashkëve Ortodokse": "Ortodoks Paskalya Pazarı", | ||
"Dita e Bajramit të Madh": "Ramazan Bayramı", | ||
"Dita e Kurban Bajramit": "Kurban Bayramı" | ||
} |
54 changes: 54 additions & 0 deletions
54
tests/.pest/snapshots/Countries/AlbaniaTest/it_can_calculate_albanian_holidays.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[ | ||
{ | ||
"name": "Viti i Ri", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "Dita e Ver\u00ebs", | ||
"date": "2024-03-14" | ||
}, | ||
{ | ||
"name": "Dita e Sulltan Nevruzit", | ||
"date": "2024-03-22" | ||
}, | ||
{ | ||
"name": "E diela e Pashk\u00ebve Katolike", | ||
"date": "2024-03-31" | ||
}, | ||
{ | ||
"name": "Dita e Bajramit t\u00eb Madh", | ||
"date": "2024-04-10" | ||
}, | ||
{ | ||
"name": "Dita Nd\u00ebrkomb\u00ebtare e Pun\u00ebtor\u00ebve", | ||
"date": "2024-05-01" | ||
}, | ||
{ | ||
"name": "E diela e Pashk\u00ebve Ortodokse", | ||
"date": "2024-05-05" | ||
}, | ||
{ | ||
"name": "Dita e Kurban Bajramit", | ||
"date": "2024-06-17" | ||
}, | ||
{ | ||
"name": "Dita e Shenjt\u00ebrimit t\u00eb Shenjt Terez\u00ebs", | ||
"date": "2024-09-05" | ||
}, | ||
{ | ||
"name": "Dita e Pavar\u00ebsis\u00eb", | ||
"date": "2024-11-28" | ||
}, | ||
{ | ||
"name": "Dita e \u00c7lirimit", | ||
"date": "2024-11-29" | ||
}, | ||
{ | ||
"name": "Dita Komb\u00ebtare e Rinis\u00eb", | ||
"date": "2024-12-08" | ||
}, | ||
{ | ||
"name": "Krishtlindja", | ||
"date": "2024-12-25" | ||
} | ||
] |
Oops, something went wrong.