Skip to content

Commit

Permalink
Merge branch 'main' into Syria-holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
amralsaleeh authored Feb 10, 2024
2 parents 0a9140d + 8bea6ac commit 022d1c7
Show file tree
Hide file tree
Showing 78 changed files with 2,276 additions and 662 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ jobs:
os: [ubuntu-latest]
php: [8.3, 8.2, 8.1]
stability: [prefer-lowest, prefer-stable]
carbon: [2.72, 3.0]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} - Carbon ${{ matrix.carbon }}

steps:
- name: Checkout code
Expand All @@ -32,7 +33,9 @@ jobs:
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
run: |
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
composer require nesbot/carbon:^${{ matrix.carbon }} --${{ matrix.stability }} -W --prefer-dist --no-interaction
- name: List Installed Dependencies
run: composer show -D
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,51 @@

All notable changes to `holidays` will be documented in this file.

## 1.7.0 - 2024-02-08

### What's Changed

* Add Uzbekistan Holidays by @shoxrux1996 in https://github.com/spatie/holidays/pull/81
* Add Azerbaijan holidays by @kenanaga in https://github.com/spatie/holidays/pull/166
* Enhanced holiday dates in Ghana by @Ikpeba4ll in https://github.com/spatie/holidays/pull/80
* Adding holidays for syria by @abdulrhmanak213 in https://github.com/spatie/holidays/pull/201

### New Contributors

* @shoxrux1996 made their first contribution in https://github.com/spatie/holidays/pull/81
* @kenanaga made their first contribution in https://github.com/spatie/holidays/pull/166
* @Ikpeba4ll made their first contribution in https://github.com/spatie/holidays/pull/80
* @abdulrhmanak213 made their first contribution in https://github.com/spatie/holidays/pull/201

**Full Changelog**: https://github.com/spatie/holidays/compare/1.6.1...1.7.0

## 1.6.1 - 2024-02-07

### What's Changed

* Fixes for Egyptian holidays by @wessama in https://github.com/spatie/holidays/pull/155

### New Contributors

* @wessama made their first contribution in https://github.com/spatie/holidays/pull/155

**Full Changelog**: https://github.com/spatie/holidays/compare/1.6.0...1.6.1

## 1.6.0 - 2024-02-07

### What's Changed

* Add holidays for Argentine by @damian-developer in https://github.com/spatie/holidays/pull/200
* Add Spanish Holidays by @jaltez in https://github.com/spatie/holidays/pull/34
* Add support for Carbon v3 by @Nielsvanpach in https://github.com/spatie/holidays/pull/204

### New Contributors

* @damian-developer made their first contribution in https://github.com/spatie/holidays/pull/200
* @jaltez made their first contribution in https://github.com/spatie/holidays/pull/34

**Full Changelog**: https://github.com/spatie/holidays/compare/1.5.1...1.6.0

## 1.5.1 - 2024-02-01

Fix translations for Albania & Iran
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,9 @@ Holidays::has('be'); // true
Holidays::has('unknown'); // false
```

### Package limitations
1. Islamic holidays are not supported (yet)

## Contributing

This is a community driven package. If you find any errors, please create an issue or a pull request.
This is a community driven package. If you find any errors, please create a pull request with the fix, or at least open an issue.

## Adding a new country

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require": {
"php": "^8.1",
"ext-intl": "*",
"nesbot/carbon": "^2.72.1"
"nesbot/carbon": "^2.72.1|^3.0"
},
"require-dev": {
"laravel/pint": "^1.0",
Expand All @@ -46,7 +46,7 @@
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"baseline": "vendor/bin/phpstan analyse --generate-baseline",
"test": "vendor/bin/pest",
"test": "vendor/bin/pest --compact",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/pint"
},
Expand Down
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"
}
46 changes: 28 additions & 18 deletions lang/egypt/ar/holidays.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
{
"New Year\n's Day": "يوم رأس السنة",
"Coptic Christmas": "عيد الميلاد القبطي",
"Revolution Day January 25": "عيد ثورة 25 يناير",
"New Year\\'s Day": "رأس السنة الميلادية",
"Coptic Christmas Day": "عيد الميلاد المجيد",
"Revolution Day 2011": "ثورة ٢٥ يناير وعيد الشرطة",
"March Equinox": "اعتدال مارس",
"Sinai Liberation": "تحرير سيناء",
"Labor": "العمل",
"Coptic Good": "الصالح القبطي",
"Coptic Holy": "المقدس القبطي",
"Coptic Easter": "عيد الفصح القبطي",
"Spring Festival": "مهرجان الربيع",
"June Solstice": "انقلاب يونيو",
"June 30 Revolution": "ثورة 30 يونيو",
"Day off for June 30 Revolution": "يوم عطلة بمناسبة ثورة 30 يونيو",
"Revolution Day July 23": "عيد ثورة 23 يوليو",
"Day off for Revolution Day July 23": "يوم عطلة بمناسبة عيد ثورة 23 يوليو",
"Sinai Liberation Day": "عيد تحرير سيناء (٢٥ أبريل ١٩٨٢)",
"Labour Day": "عيد العمال",
"Coptic Good Friday": "الصالح القبطي",
"Coptic Holy Saturday": "المقدس القبطي",
"Coptic Easter Sunday": "عيد الفصح القبطي",
"Spring Festival": "عيد شم النسيم",
"June Solstice": "الانقلاب الشمسي في يونيو",
"June 30 Revolution Day": "عيد ثورة 30 يونيو",
"Day off for June 30 Revolution Day": "بمناسبة عيد ثورة 30 يونيو",
"Revolution Day": "عيد ثورة 23 يوليو",
"Day off for Revolution Day": "بمناسبة عيد ثورة 23 يوليو",
"Flooding of the Nile": "فيضان النيل",
"Nayrouz": "النيروز",
"September Equinox": "الاعتدال في سبتمبر",
"Armed Forces": "القوات المسلحة",
"Day off for Armed Forces": "يوم عطلة للقوات المسلحة",
"December Solstice": "الانقلاب الشمسي في ديسمبر"
}
"Armed Forces Day": "عيد القوات المسلحة (٦ أكتوبر ١٩٧٣)",
"Day off for Armed Forces Day": "يوم عطلة للقوات المسلحة",
"December Solstice": "الانقلاب الشمسي في ديسمبر",
"Eid al-Fitr": "عيد الفطر المبارك",
"Eid al-Fitr Day 2": "عيد الفطر المبارك",
"Eid al-Fitr Day 3": "عيد الفطر المبارك",
"Eid al-Adha": "عيد الأضحى المبارك",
"Eid al-Adha Day 2": "عيد الأضحى المبارك",
"Eid al-Adha Day 3": "عيد الأضحى المبارك",
"Eid al-Adha Day 4": "عيد الأضحى المبارك",
"Islamic New Year": "رأس السنة الهجرية",
"Birthday of the Prophet Muhammad": "المولد النبوي الشريف",
"Arafat Day": "يوم عرفة (وقفة عيد الأضحى)"
}
33 changes: 33 additions & 0 deletions lang/egypt/en/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"New Year\\'s Day": "New Year\\'s Day",
"Coptic Christmas Day": "Coptic Christmas Day",
"Revolution Day 2011": "Revolution Day 2011",
"March Equinox": "March Equinox",
"Sinai Liberation Day": "Sinai Liberation Day",
"Labour Day": "Labour Day",
"Coptic Good Friday": "Coptic Good Friday",
"Coptic Holy Saturday": "Coptic Holy Saturday",
"Coptic Easter Sunday": "Coptic Easter Sunday",
"Spring Festival": "Spring Festival",
"June Solstice": "June Solstice",
"June 30 Revolution Day": "June 30 Revolution Day",
"Day off for June 30 Revolution Day": "Day off for June 30 Revolution Day",
"Revolution Day": "Revolution Day",
"Day off for Revolution Day": "Day off for Revolution Day",
"Flooding of the Nile": "Flooding of the Nile",
"Nayrouz": "Nayrouz",
"September Equinox": "September Equinox",
"Armed Forces Day": "Armed Forces Day",
"Day off for Armed Forces Day": "Day off for Armed Forces",
"December Solstice": "December Solstice",
"Eid al-Fitr": "Eid al-Fitr",
"Eid al-Fitr Day 2": "Eid al-Fitr",
"Eid al-Fitr Day 3": "Eid al-Fitr",
"Eid al-Adha": "Eid al-Adha",
"Eid al-Adha Day 2": "Eid al-Adha",
"Eid al-Adha Day 3": "Eid al-Adha",
"Eid al-Adha Day 4": "Eid al-Adha",
"Islamic New Year": "Islamic New Year (Muharram)",
"Birthday of the Prophet Muhammad": "Birthday of the Prophet Muhammad",
"Arafat Day": "Arafat Day",
}
16 changes: 16 additions & 0 deletions lang/syria/ar/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"New Year\n's Day": "يوم رأس السنة",
"Mother\n's Day": "عيد الأم",
"Teacher\n's Day": "عيد المعلم",
"Western Easter": "عيد الفصح الغربي",
"Eid al-Fitr": "عيد الفطر السعيد",
"Syrian Independence Day": "عيد الجلاء واستقلال سورية",
"Labor Day": "عيد العمال",
"Eastern Easter": "عيد الفصح الشرقي",
"Martyrs\n' Day": "عيد الشهداء",
"Eid al-Adha": "عيد الأضحى المبارك",
"Islamic New Year": "عيد رأس السنة الهجرية",
"The commemoration of the birth of the Prophet Muhammad": "عيد مولد الرسول الأعظم",
"The October Liberation War": "ذكرى حرب تشرين التحريرية",
"Merry Christmas": "عيد الميلاد المجيد"
}
13 changes: 13 additions & 0 deletions lang/uzbekistan/en/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Yangi yil": "New year",
"Xalqaro xotin-qizlar kuni": "International Women's Day",
"Navro'z": "Nowruz",
"Xotira va qadrlash kuni": "Remembrance Day",
"Mustaqillik kuni": "Independence Day",
"Ustoz va murabbiylar kuni": "Teachers Day",
"Konstitutsiya kuni": "Constitution Day",
"Ramazon Hayiti": "Eid al-Fitr",
"Qurbon Hayiti": "Eid al-Adha",
"Ramazon Hayiti 2": "Eid al-Fitr",
"Qurbon Hayiti 2": "Eid al-Adha"
}
13 changes: 13 additions & 0 deletions lang/uzbekistan/ru/holidays.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Yangi yil": "Новый год",
"Xalqaro xotin-qizlar kuni": "Международный женский день",
"Navro'z": "Навруз",
"Xotira va qadrlash kuni": "День памяти и почестей",
"Mustaqillik kuni": "День Независимости",
"Ustoz va murabbiylar kuni": "День учителя",
"Konstitutsiya kuni": "День Конституции",
"Ramazon Hayiti": "Рамазан Хаит",
"Qurbon Hayiti": "Курбан Хаит",
"Ramazon Hayiti 2": "Рамазан Хаит",
"Qurbon Hayiti 2": "Курбан Хаит"
}
30 changes: 3 additions & 27 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
parameters:
ignoreErrors:
-
message: "#^Cannot call method modify\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#"
count: 1
path: src/Countries/Australia.php

-
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
count: 1
path: src/Countries/Country.php

-
message: "#^Cannot call method startOfDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#"
count: 2
path: src/Countries/Country.php

-
message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Country\\:\\:get\\(\\) should return array\\<string, Carbon\\\\CarbonImmutable\\|string\\> but returns array\\<string, Carbon\\\\CarbonImmutable\\|false\\>\\.$#"
count: 1
path: src/Countries/Country.php

-
message: "#^Parameter \\#2 \\$callback of function uasort expects callable\\(bool\\|Carbon\\\\CarbonImmutable, bool\\|Carbon\\\\CarbonImmutable\\)\\: int, Closure\\(Carbon\\\\CarbonImmutable, Carbon\\\\CarbonImmutable\\)\\: int\\<\\-1, 1\\> given\\.$#"
count: 1
path: src/Countries/Country.php

-
message: "#^Cannot call method startOfDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#"
count: 2
path: src/Countries/Sweden.php
message: "#^Ternary operator condition is always true\\.$#"
count: 3
path: src/Countries/Turkey.php

-
message: "#^Cannot call method setTimeStamp\\(\\) on DateTime\\|false\\.$#"
Expand All @@ -45,7 +25,3 @@ parameters:
count: 1
path: src/Holidays.php

-
message: "#^Property Spatie\\\\Holidays\\\\Holidays\\:\\:\\$holidays \\(array\\<string, Carbon\\\\CarbonImmutable\\>\\) does not accept array\\<string, Carbon\\\\CarbonImmutable\\|string\\>\\.$#"
count: 1
path: src/Holidays.php
58 changes: 58 additions & 0 deletions src/Concerns/Observable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Spatie\Holidays\Concerns;

use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;

trait Observable
{
protected function weekendToNextMonday(string|CarbonInterface $date, int $year): ?CarbonInterface
{
if (is_string($date)) {
$date = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$date}")->startOfDay();
}

if ($date->isWeekend()) {
return $date->next('monday');
}

return null;
}

protected function sundayToNextMonday(string|CarbonInterface $date, int $year): ?CarbonInterface
{
if (is_string($date)) {
$date = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$date}")->startOfDay();
}

if ($date->isSunday()) {
return $date->next('monday');
}

return null;
}

protected function observedChristmasDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();

return match ($christmasDay->dayName) {
'Saturday' => $christmasDay->next('monday'),
'Sunday' => $christmasDay->next('tuesday'),
default => null,
};
}

protected function observedBoxingDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();
$boxingDay = $christmasDay->addDay();

return match ($christmasDay->dayName) {
'Friday' => $boxingDay->next('monday'),
'Saturday' => $boxingDay->next('tuesday'),
default => null,
};
}
}
1 change: 0 additions & 1 deletion src/Countries/Angola.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function countryCode(): string

protected function allHolidays(int $year): array
{

return array_merge([
'Dia de Ano Novo' => '01-01',
'Dia do Inicio da Luta Armada de Libertação Nacional' => '02-04',
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Argentine.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function allHolidays(int $year): array
return array_merge([
'Día de Año Nuevo' => '01-01',
'Carnaval' => '12-02',
'Carnaval' => '13-02',
'Carnaval Día 2' => '13-02',
'Día Nacional de la Memoria por la Verdad y la Justicia' => '24-04',
'Día del Veterano y de los Caídos en la Guerra de Malvinas' => '02-04',
'Día del Trabajador' => '05-01',
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Australia.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function variableHolidays(int $year): array
'Canberra Day' => CarbonImmutable::parse("second monday of march {$year}"),
'Easter Saturday' => $easter->subDay(),
'Easter Sunday' => $easter,
'Reconciliation Day' => CarbonImmutable::create($year, 5, 27)->modify('monday'),
'Reconciliation Day' => CarbonImmutable::create($year, 5, 27)?->modify('monday'),
$this->sovereignBirthdayKey($year) => CarbonImmutable::parse("second monday of june {$year}"),
'Labour Day' => CarbonImmutable::parse("first monday of october {$year}"),
],
Expand Down
Loading

0 comments on commit 022d1c7

Please sign in to comment.