diff --git a/.editorconfig b/.editorconfig index a7c44ddb1..6f7c0773a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,6 @@ trim_trailing_whitespace = false [*.{yml,yaml}] indent_size = 2 + +[*.snap] +insert_final_newline = false \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..9fb40912d --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +# Contributing a new country ? + +* [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/spatie/holidays/pulls) for the same country? + +1. Create a new class in the Countries directory. It should extend the Country class. +2. Add a test for the new country in the tests directory. +3. Run the tests so a snapshot gets created. +4. Verify the result in the newly created snapshot is correct. diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index cd4239c24..30e62c774 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,9 +1,6 @@ name: Fix PHP code style issues -on: - push: - paths: - - '**.php' +on: [push] permissions: contents: write diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 60ce66b64..e171b0463 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -1,6 +1,6 @@ name: PHPStan -on: [push] +on: [push, pull_request] jobs: phpstan: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 14315473c..780a74427 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,13 +1,6 @@ name: Tests -on: - push: - paths: - - '**.php' - - '.github/workflows/run-tests-pest.yml' - - 'phpunit.xml.dist' - - 'composer.json' - - 'composer.lock' +on: [push, pull_request] jobs: test: @@ -16,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] php: [8.3, 8.2, 8.1] stability: [prefer-lowest, prefer-stable] diff --git a/.gitignore b/.gitignore index ff8bfd7e5..96b3d690a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .php_cs .php_cs.cache .phpunit.cache +.vscode build composer.lock coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d8e90265..8cdd8fd19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,67 @@ All notable changes to `holidays` will be documented in this file. +## 1.1.0 - 2024-01-19 + +### What's Changed + +* Fix incorrect usage in README by @cybernerdie in https://github.com/spatie/holidays/pull/16 +* Add Andorra Holidays by @BurtDS in https://github.com/spatie/holidays/pull/36 +* Add documentation on how to contribute by @Nielsvanpach in https://github.com/spatie/holidays/pull/73 +* Danish holidays by @RootAccessPlease in https://github.com/spatie/holidays/pull/5 +* Introducing Basic Playground by @devajmeireles in https://github.com/spatie/holidays/pull/28 +* fix: Oudjaarsdag is not a public holiday by @RickDBCN in https://github.com/spatie/holidays/pull/64 +* Adds support for Portuguese Holidays by @lamelas in https://github.com/spatie/holidays/pull/9 +* Added Zambian Holidays by @chandachewe10 in https://github.com/spatie/holidays/pull/83 +* Add Italian holidays by @mauricius in https://github.com/spatie/holidays/pull/24 +* Add French holidays by @levrailoup in https://github.com/spatie/holidays/pull/15 +* Add Czech holidays by @vrerabek in https://github.com/spatie/holidays/pull/22 +* Update Brazil.php by @juliofagundes in https://github.com/spatie/holidays/pull/101 +* Added Uganda Public Holidays and Unit Tests by @Crawford30 in https://github.com/spatie/holidays/pull/126 +* Support for Venezuelan holidays by @ricardomartos in https://github.com/spatie/holidays/pull/125 +* Add Macedonian holidays by @object505 in https://github.com/spatie/holidays/pull/119 +* Adding Nicaragua Holidays by @calonzolg in https://github.com/spatie/holidays/pull/92 +* add Philippine national holidays by @kndrckjvr in https://github.com/spatie/holidays/pull/25 +* Adding Full Mexican Holidays by @davsaniuv in https://github.com/spatie/holidays/pull/23 +* Add support for Irish public holidays by @marchanlon in https://github.com/spatie/holidays/pull/44 +* Add support for Croatian public holidays by @mcbuckets in https://github.com/spatie/holidays/pull/45 +* Bolivian holidays by @rats4final in https://github.com/spatie/holidays/pull/40 +* Add Estonian holidays by @hulkur in https://github.com/spatie/holidays/pull/47 +* Update README.md by @eltociear in https://github.com/spatie/holidays/pull/134 +* Public Holidays for Malawi by @Crawford30 in https://github.com/spatie/holidays/pull/133 +* Add Bangladesh holidays by @arifszn in https://github.com/spatie/holidays/pull/21 +* Adding Full Mandatory Mexican holidays by @dantes4ur in https://github.com/spatie/holidays/pull/20 +* mexico fixes by @Nielsvanpach in https://github.com/spatie/holidays/pull/140 + +### New Contributors + +* @cybernerdie made their first contribution in https://github.com/spatie/holidays/pull/16 +* @BurtDS made their first contribution in https://github.com/spatie/holidays/pull/36 +* @Nielsvanpach made their first contribution in https://github.com/spatie/holidays/pull/73 +* @RootAccessPlease made their first contribution in https://github.com/spatie/holidays/pull/5 +* @RickDBCN made their first contribution in https://github.com/spatie/holidays/pull/64 +* @lamelas made their first contribution in https://github.com/spatie/holidays/pull/9 +* @chandachewe10 made their first contribution in https://github.com/spatie/holidays/pull/83 +* @mauricius made their first contribution in https://github.com/spatie/holidays/pull/24 +* @levrailoup made their first contribution in https://github.com/spatie/holidays/pull/15 +* @vrerabek made their first contribution in https://github.com/spatie/holidays/pull/22 +* @juliofagundes made their first contribution in https://github.com/spatie/holidays/pull/101 +* @Crawford30 made their first contribution in https://github.com/spatie/holidays/pull/126 +* @ricardomartos made their first contribution in https://github.com/spatie/holidays/pull/125 +* @object505 made their first contribution in https://github.com/spatie/holidays/pull/119 +* @calonzolg made their first contribution in https://github.com/spatie/holidays/pull/92 +* @kndrckjvr made their first contribution in https://github.com/spatie/holidays/pull/25 +* @davsaniuv made their first contribution in https://github.com/spatie/holidays/pull/23 +* @marchanlon made their first contribution in https://github.com/spatie/holidays/pull/44 +* @mcbuckets made their first contribution in https://github.com/spatie/holidays/pull/45 +* @rats4final made their first contribution in https://github.com/spatie/holidays/pull/40 +* @hulkur made their first contribution in https://github.com/spatie/holidays/pull/47 +* @eltociear made their first contribution in https://github.com/spatie/holidays/pull/134 +* @arifszn made their first contribution in https://github.com/spatie/holidays/pull/21 +* @dantes4ur made their first contribution in https://github.com/spatie/holidays/pull/20 + +**Full Changelog**: https://github.com/spatie/holidays/compare/1.0.2...1.1.0 + ## 1.0.2 - 2024-01-17 ### What's Changed diff --git a/README.md b/README.md index 12f5b0ff3..8bc3564e3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ use Spatie\Holidays\Holidays; // returns an array of Belgian holidays // for the current year -$holidays = Holidays::for('be')->get(); +$holidays = Holidays::for('be')->get(); ``` ## Support us @@ -40,21 +40,22 @@ You can get all holidays for a country by using the `get` method. ```php use Spatie\Holidays\Holidays; +use Spatie\Holidays\Countries\Belgium; // returns an array of Belgian holidays // for the current year -$holidays = Holidays::for('be')->get(); +$holidays = Holidays::for(Belgium::make())->get(); ``` -Alternatively, you could also pass an instance of `Country` to the `for` method. +Alternatively, you could also pass an [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) code to the `for` method. +In case of region based holidays, these will not be included. Use a country class instead. ```php use Spatie\Holidays\Holidays; -use Spatie\Holidays\Countries\Belgium; // returns an array of Belgian holidays // for the current year -$holidays = Holidays::for(Belgium::make())->get(); +$holidays = Holidays::for('be')->get(); ``` ### Getting holidays for a specific year @@ -87,6 +88,45 @@ use Spatie\Holidays\Holidays; Holidays::for('be')->getName('2024-01-01'); // Nieuwjaar ``` +### 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. + +## Adding a new country + +1. Create a new class in the `Countries` directory. It should extend the `Country` class. +2. Add a test for the new country in the `tests` directory. +3. Run the tests so a snapshot gets created. +4. Verify the result in the newly created snapshot is correct. + +In case your country has specific rules for calculating holidays, +for example region specific holidays, you can pass this to the constructor of your country class. + +```php +$holidays = Holidays::for(Austria::make(region: 'de-bw'))->get(); +``` + +The value, `de-bw`, will be passed to the region parameter of the constructor of a country. + +```php +class Austria extends Country +{ + protected function __construct( + protected ?string $region = null, + ) { + } + + protected function allHolidays(int $year): array + { + // Here you can use $this->region (or other variables) to calculate holidays + } +``` + +Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for more details. + ## Testing ```bash @@ -97,10 +137,6 @@ composer test Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. -## Contributing - -Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details. - ## Security Vulnerabilities Please review [our security policy](../../security/policy) on how to report security vulnerabilities. diff --git a/composer.json b/composer.json index aa1da0465..91002ed8c 100644 --- a/composer.json +++ b/composer.json @@ -25,9 +25,11 @@ "ext-calendar": "*" }, "require-dev": { + "laravel/prompts": "^0.1.15", "pestphp/pest": "^2.31", "phpstan/phpstan": "^1.10.56", - "spatie/ray": "^1.40.1" + "spatie/ray": "^1.40.1", + "symfony/var-dumper": "^6.4" }, "autoload": { "psr-4": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 40f94f7ef..17eba40a1 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,17 +1,22 @@ parameters: ignoreErrors: - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Belgium\\:\\:allHolidays\\(\\) should return array\\ but returns array\\\\.$#" + message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" count: 1 - path: src/Countries/Belgium.php + path: src/Countries/Country.php - - message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" + message: "#^Cannot call method startOfDay\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" count: 1 path: src/Countries/Country.php - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Country\\:\\:get\\(\\) should return array\\ but returns array\\\\.$#" + message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Country\\:\\:get\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/Countries/Country.php + + - + message: "#^Parameter \\#1 \\$timestamp of static method Carbon\\\\CarbonImmutable\\:\\:createFromTimestamp\\(\\) expects float\\|int\\|string, int\\|false given\\.$#" count: 1 path: src/Countries/Country.php @@ -21,9 +26,9 @@ parameters: path: src/Countries/Country.php - - message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Hungary\\:\\:allHolidays\\(\\) should return array\\ but returns array\\\\.$#" + message: "#^Cannot call method setTimezone\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" count: 1 - path: src/Countries/Hungary.php + path: src/Countries/Mexico.php - message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#" @@ -44,3 +49,8 @@ parameters: message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(Carbon\\\\CarbonImmutable\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: non\\-falsy\\-string given\\.$#" count: 1 path: src/Holidays.php + + - + message: "#^Property Spatie\\\\Holidays\\\\Holidays\\:\\:\\$holidays \\(array\\\\) does not accept array\\\\.$#" + count: 1 + path: src/Holidays.php diff --git a/playground.php b/playground.php new file mode 100644 index 000000000..c53856a26 --- /dev/null +++ b/playground.php @@ -0,0 +1,31 @@ +get()) + ->map(fn (array $holiday) => [ + 'name' => $holiday['name'], + 'date' => $holiday['date']->format('Y-m-d'), // @phpstan-ignore-line + ])->toArray(); + +dd($result); diff --git a/src/Countries/Andorra.php b/src/Countries/Andorra.php index 19e342ca5..89ce91c80 100644 --- a/src/Countries/Andorra.php +++ b/src/Countries/Andorra.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'ad'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -31,8 +30,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Brussels'); + $easter = $this->easter($year); return [ 'Divendres Sant' => $easter->subDays(2), diff --git a/src/Countries/Austria.php b/src/Countries/Austria.php index c8eea5d62..36ddb41b2 100644 --- a/src/Countries/Austria.php +++ b/src/Countries/Austria.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'at'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -30,11 +29,10 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Vienna'); + $easter = $this->easter($year); return [ - 'Ostermontag' => $easter->addDay(1), + 'Ostermontag' => $easter->addDay(), 'Christi Himmelfahrt' => $easter->addDays(39), 'Pfingstmontag' => $easter->addDays(50), 'Fronleichnam' => $easter->addDays(60), diff --git a/src/Countries/Bangladesh.php b/src/Countries/Bangladesh.php new file mode 100644 index 000000000..b269f53dd --- /dev/null +++ b/src/Countries/Bangladesh.php @@ -0,0 +1,34 @@ + '02-21', + 'Birthday of Sheikh Mujibur Rahman' => '03-17', + 'Independence Day' => '03-26', + 'Bengali New Year' => '04-14', + 'May Day' => '05-01', + 'National Mourning Day' => '08-15', + 'Victory Day' => '12-16', + 'Christmas Day' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + // The variable holidays all follow the lunar calendar, so their dates are not confirmed. + return []; + } +} diff --git a/src/Countries/Belgium.php b/src/Countries/Belgium.php index f5d268db5..8710daf74 100644 --- a/src/Countries/Belgium.php +++ b/src/Countries/Belgium.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'be'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -28,8 +27,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Brussels'); + $easter = $this->easter($year); return [ 'Paasmaandag' => $easter->addDay(), diff --git a/src/Countries/Bolivia.php b/src/Countries/Bolivia.php new file mode 100644 index 000000000..94072ed08 --- /dev/null +++ b/src/Countries/Bolivia.php @@ -0,0 +1,39 @@ + '01-01', + 'Día del Estado Plurinacional' => '01-22', + 'Día del Trabajador' => '05-01', + 'Año Nuevo Aymara' => '06-21', + 'Día de la Independencia' => '08-06', + 'Día de Todos los Santos' => '11-02', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Lunes de Carnaval' => $easter->subWeeks(6)->subDays(6), + 'Martes de Carnaval' => $easter->subWeeks(6)->subDays(5), + 'Viernes Santo' => $easter->subDays(2), + 'Corpus Christi' => $easter->addWeeks(8)->addDays(4), + ]; + } +} diff --git a/src/Countries/Brazil.php b/src/Countries/Brazil.php index 4c93f100b..d2be75a23 100644 --- a/src/Countries/Brazil.php +++ b/src/Countries/Brazil.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'br'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -22,6 +21,7 @@ protected function allHolidays(int $year): array 'Nossa Senhora Aparecida' => '10-12', 'Finados' => '11-02', 'Proclamação da República' => '11-15', + 'Dia Nacional de Zumbi e da Consciência Negra' => '11-20', 'Natal' => '12-25', ], $this->variableHolidays($year)); } @@ -29,7 +29,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('America/Sao_Paulo'); + $easter = $this->easter($year); return [ 'Carnaval' => $easter->subDays(47), diff --git a/src/Countries/Country.php b/src/Countries/Country.php index b99262a5c..3a09768db 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -13,7 +13,7 @@ abstract public function countryCode(): string; /** @return array */ abstract protected function allHolidays(int $year): array; - /** @return array */ + /** @return array */ public function get(int $year): array { $this->ensureYearCanBeCalculated($year); @@ -37,7 +37,23 @@ public function get(int $year): array public static function make(): static { - return new static(); + return new static(...func_get_args()); + } + + protected function easter(int $year): CarbonImmutable + { + $easter = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-03-21") + ->startOfDay(); + + return $easter->addDays(easter_days($year)); + } + + protected function orthodoxEaster(int $year): CarbonImmutable + { + $timestamp = easter_date($year, CAL_EASTER_ALWAYS_JULIAN); + $daysDifference = (int) ($year / 100) - (int) ($year / 400) - 2; + + return CarbonImmutable::createFromTimestamp(strtotime("+$daysDifference days", $timestamp)); } public static function find(string $countryCode): ?Country diff --git a/src/Countries/Croatia.php b/src/Countries/Croatia.php new file mode 100644 index 000000000..f5d7b7c8f --- /dev/null +++ b/src/Countries/Croatia.php @@ -0,0 +1,41 @@ + '01-01', + 'Bogojavljenje' => '01-06', + 'Praznik rada' => '05-01', + 'Dan državnosti' => '05-30', + 'Dan antifašističke borbe' => '06-22', + 'Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja' => '08-05', + 'Velika Gospa' => '08-15', + 'Svi sveti' => '11-01', + 'Dan sjećanja na žrtve Domovinskog rata i Dan sjećanja na žrtvu Vukovara i Škabrnje' => '11-18', + 'Božić' => '12-25', + 'Sveti Stjepan' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Uskrsni ponedjeljak' => $easter->addDay(), + 'Tijelovo' => $easter->addDays(60), + ]; + } +} diff --git a/src/Countries/Czechia.php b/src/Countries/Czechia.php new file mode 100644 index 000000000..c4aff4200 --- /dev/null +++ b/src/Countries/Czechia.php @@ -0,0 +1,41 @@ + '01-01', + 'Svátek práce' => '05-01', + 'Den vítězství' => '05-08', + 'Den slovanských věrozvěstů Cyrila a Metoděje' => '07-05', + 'Den upálení mistra Jana Husa' => '07-06', + 'Den české státnosti' => '09-28', + 'Den vzniku samostatného československého státu' => '10-28', + 'Den boje za svobodu a demokracii a Mezinárodní den studentstva' => '11-17', + 'Štědrý den' => '12-24', + '1. svátek vánoční' => '12-25', + '2. svátek vánoční' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Velikonoční pondělí' => $easter->addDay(), + 'Velký pátek' => $easter->subDays(2), + ]; + } +} diff --git a/src/Countries/Denmark.php b/src/Countries/Denmark.php new file mode 100644 index 000000000..ee68d1d74 --- /dev/null +++ b/src/Countries/Denmark.php @@ -0,0 +1,45 @@ + '01-01', + 'Juleaften' => '12-24', + 'Juledag' => '12-25', + 'Anden Juledag' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + $holidays = [ + 'Påskedag' => $easter->addDay(), + 'Skærtorsdag' => $easter->subDays(3), + 'Langfredag' => $easter->subDays(2), + 'Anden Påskedag' => $easter->addDays(2), + 'Kristi Himmelfartsdag' => $easter->addDays(39), + 'Pinse' => $easter->addDays(49), + 'Anden Pinsedag' => $easter->addDays(50), + ]; + + if ($year < 2024) { + $holidays['Store Bededag'] = $easter->addDays(26); + } + + return $holidays; + } +} diff --git a/src/Countries/DominicanRepublic.php b/src/Countries/DominicanRepublic.php new file mode 100644 index 000000000..c632ae430 --- /dev/null +++ b/src/Countries/DominicanRepublic.php @@ -0,0 +1,29 @@ + */ + protected function allHolidays(int $year): array + { + return [ + 'Año Nuevo' => '01-01', + 'Día de la Altagracia' => '01-21', + 'Día de Duarte' => '01-26', + 'Día de la Independencia' => '02-27', + 'Día del Trabajo' => '05-01', + 'Día de la Restauración' => '08-16', + 'Día de las Mercedes' => '09-24', + 'Día de la Constitución' => '11-06', + 'Navidad' => '12-25', + ]; + } +} diff --git a/src/Countries/Estonia.php b/src/Countries/Estonia.php new file mode 100644 index 000000000..4ba7efcdc --- /dev/null +++ b/src/Countries/Estonia.php @@ -0,0 +1,40 @@ + '01-01', + 'Iseseisvuspäev' => '02-24', + 'Kevadpüha' => '05-01', + 'Võidupüha' => '06-23', + 'Jaanipäev' => '06-24', + 'Taasiseseisvumispäev' => '08-20', + 'Jõululaupäev' => '12-24', + 'Esimene jõulupüha' => '12-25', + 'Teine jõulupüha' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Suur reede' => $easter->subDays(2), + 'Ülestõusmispühade 1. püha' => $easter, + 'Nelipühade 1. püha' => $easter->addDays(49), + ]; + } +} diff --git a/src/Countries/France.php b/src/Countries/France.php new file mode 100644 index 000000000..c0272aabb --- /dev/null +++ b/src/Countries/France.php @@ -0,0 +1,78 @@ + '01-01', + 'Fête du Travail' => '05-01', + 'Victoire 1945' => '05-08', + 'Fête Nationale' => '07-14', + 'Assomption' => '08-15', + 'Toussaint' => '11-01', + 'Armistice 1918' => '11-11', + 'Noël' => '12-25', + ], + $this->variableHolidays($year), + $this->regionHolidays()); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + $holidays = [ + 'Lundi de Pâques' => $easter->addDay(), + 'Ascension' => $easter->addDays(39), + 'Lundi de Pentecôte' => $easter->addDays(50), + ]; + + if (in_array($this->region, ['FR-57', 'FR-67', 'FR-68'])) { + $holidays['Vendredi Saint'] = $easter->subDays(2); + } + + return $holidays; + } + + /** @return array */ + protected function regionHolidays(): array + { + switch ($this->region) { + case 'FR-57': + case 'FR-67': + case 'FR-68': + return ['Saint-Étienne' => '12-26']; + case 'FR-971': + case 'FR-MF': + return ['Abolition de l\'esclavage' => '05-27']; + case 'FR-972': + return ['Abolition de l\'esclavage' => '05-22']; + case 'FR-973': + return ['Abolition de l\'esclavage' => '06-10']; + case 'FR-974': + return ['Abolition de l\'esclavage' => '12-20']; + case 'FR-976': + return ['Abolition de l\'esclavage' => '04-27']; + case 'FR-BL': + return ['Abolition de l\'esclavage' => '10-09']; + } + + return []; + } +} diff --git a/src/Countries/Hungary.php b/src/Countries/Hungary.php index 8a6467455..9658c3809 100644 --- a/src/Countries/Hungary.php +++ b/src/Countries/Hungary.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'hu'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -29,8 +28,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Brussels'); + $easter = $this->easter($year); return [ 'Nagypéntek' => $easter->subDays(2), diff --git a/src/Countries/Ireland.php b/src/Countries/Ireland.php new file mode 100644 index 000000000..527cd487e --- /dev/null +++ b/src/Countries/Ireland.php @@ -0,0 +1,54 @@ + '01-01', + 'Saint Patrick\'s Day' => '03-17', + 'Christmas Day' => '12-25', + 'Saint Stephen\'s Day' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + $mayHoliday = new CarbonImmutable("first monday of May $year", 'Europe/Dublin'); + $juneHoliday = new CarbonImmutable("first monday of June $year", 'Europe/Dublin'); + $augHoliday = new CarbonImmutable("first monday of August $year", 'Europe/Dublin'); + $octHoliday = new CarbonImmutable("last monday of October $year", 'Europe/Dublin'); + + $variableHolidays = [ + 'Easter Monday' => $easter->addDays(1), + 'May Public Holiday' => $mayHoliday, + 'June Public Holiday' => $juneHoliday, + 'August Public Holiday' => $augHoliday, + 'October Public Holiday' => $octHoliday, + ]; + + // In 2023, Ireland added a new public holiday for St Brigid's day. + // It is the First Monday in February, or 1 February if the date falls on a Friday + if ($year >= 2023) { + $stBrigidsDay = new CarbonImmutable("$year-02-01", 'Europe/Dublin'); + if (! $stBrigidsDay->isFriday()) { + $stBrigidsDay = new CarbonImmutable("first monday of February $year", 'Europe/Dublin'); + } + $variableHolidays['St Brigid\'s Day'] = $stBrigidsDay; + } + + return $variableHolidays; + } +} diff --git a/src/Countries/Italy.php b/src/Countries/Italy.php new file mode 100644 index 000000000..e4f53b092 --- /dev/null +++ b/src/Countries/Italy.php @@ -0,0 +1,39 @@ + '01-01', + 'Epifania' => '01-06', + 'Liberazione dal nazifascismo' => '04-25', + 'Festa del lavoro' => '05-01', + 'Festa della Repubblica' => '06-02', + 'Assunzione di Maria' => '08-15', + 'Ognissanti' => '11-01', + 'Immacolata Concezione' => '12-08', + 'Natale di Gesù' => '12-25', + 'Santo Stefano' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Lunedì di Pasqua' => $easter->addDay(), + ]; + } +} diff --git a/src/Countries/Malawi.php b/src/Countries/Malawi.php new file mode 100644 index 000000000..573564d5e --- /dev/null +++ b/src/Countries/Malawi.php @@ -0,0 +1,41 @@ + '01-01', + 'John Chilembwe Day' => '01-15', + 'Martyrs Day' => '03-03', + 'Labour Day' => '05-01', + 'Kamuzu Day' => '05-14', + 'Independence Day' => '07-06', + 'Mothers Day' => '10-15', + 'Christmas Day' => '12-25', + 'Boxing Day' => '12-26', + ], $this->variableHolidays($year)); + } + + /** + * @return array + */ + private function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Good Friday' => $easter->subDays(2), + 'Easter Monday' => $easter->addDay(), + ]; + } +} diff --git a/src/Countries/Mexico.php b/src/Countries/Mexico.php new file mode 100644 index 000000000..1cb2cdfa9 --- /dev/null +++ b/src/Countries/Mexico.php @@ -0,0 +1,65 @@ + '01-01', + 'Día Internacional de los Trabajadores' => '05-01', + 'Día de Independencia' => '09-16', + 'Cambio de Gobierno' => '10-01', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $constitutionDay = (new CarbonImmutable("first monday of february $year")) + ->setTimezone('America/Mexico_City'); + + $benitoJuarezBirth = (new CarbonImmutable("third monday of March $year")) + ->setTimezone('America/Mexico_City'); + + $revolutionDay = (new CarbonImmutable("third monday of november $year")) + ->setTimezone('America/Mexico_City'); + + $holidays = [ + 'Día de la Constitución' => $constitutionDay, + 'Natalicio de Benito Juárez' => $benitoJuarezBirth, + 'Día de la Revolución' => $revolutionDay, + ]; + + $executiveChange = $this->governmentChangeDate($year); + + if ($executiveChange) { + $holidays = array_merge($holidays, ['Cambio de Gobierno' => $executiveChange]); + } + + return $holidays; + } + + protected function governmentChangeDate(int $year): ?CarbonImmutable + { + $baseYear = 1946; // The first occurrence with president Miguel Aleman Valdes + + // Check if the current year is a transmission year + if (($year - $baseYear) % 6 === 0) { + return CarbonImmutable::create($year, 10, 1) // October 1st of the transmission year + ->setTimezone('America/Mexico_City'); + + } + + return null; + } +} diff --git a/src/Countries/Netherlands.php b/src/Countries/Netherlands.php index c79223dd0..91abc9bd1 100644 --- a/src/Countries/Netherlands.php +++ b/src/Countries/Netherlands.php @@ -11,7 +11,6 @@ public function countryCode(): string return 'nl'; } - /** @return array */ protected function allHolidays(int $year): array { return array_merge([ @@ -19,7 +18,6 @@ protected function allHolidays(int $year): array 'Bevrijdingsdag' => '05-05', '1e Kerstdag' => '12-25', '2e Kerstdag' => '12-26', - 'Oudejaarsdag' => '12-31', ], $this->variableHolidays($year)); } @@ -32,8 +30,7 @@ protected function variableHolidays(int $year): array $koningsDag = $koningsDag->subDay(); } - $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) - ->setTimezone('Europe/Amsterdam'); + $easter = $this->easter($year); return [ 'Koningsdag' => $koningsDag, diff --git a/src/Countries/Nicaragua.php b/src/Countries/Nicaragua.php new file mode 100644 index 000000000..32837f3cb --- /dev/null +++ b/src/Countries/Nicaragua.php @@ -0,0 +1,38 @@ + '01-01', + 'Día internacional de los trabajadores' => '05-01', + 'Día de las madres' => '05-30', + 'Aniversario de la revolución' => '07-19', + 'Aniversario de la batalla de san jacinto' => '09-14', + 'Aniversario de la independencia' => '09-15', + 'Día de la inmaculada concepción' => '12-08', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Jueves santo' => $easter->subDays(3), + 'Viernes santo' => $easter->subDays(2), + ]; + } +} diff --git a/src/Countries/NorthMacedonia.php b/src/Countries/NorthMacedonia.php new file mode 100644 index 000000000..50057ea9d --- /dev/null +++ b/src/Countries/NorthMacedonia.php @@ -0,0 +1,38 @@ + '01-01', + 'Божик, првиот ден на Божик според православниот календар' => '01-07', + 'Ден на трудот' => '05-01', + 'Св. Кирил и Методиј - Ден на сесловенските просветители' => '05-24', + 'Ден на Републиката' => '08-02', + 'Ден на независноста' => '09-08', + 'Ден на народното востание' => '10-11', + 'Ден на македонската револуционерна борба' => '10-23', + 'Св. Климент Охридски' => '12-08', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->orthodoxEaster($year); + + return [ + 'Велигден, вториот ден на Велигден според православниот календар' => $easter->addDay(), + ]; + } +} diff --git a/src/Countries/Philippines.php b/src/Countries/Philippines.php new file mode 100644 index 000000000..c4d193e82 --- /dev/null +++ b/src/Countries/Philippines.php @@ -0,0 +1,40 @@ + '01-01', + 'Araw ng Kagitingan' => '04-09', + 'Labor Day' => '05-01', + 'Independence Day' => '06-12', + 'Bonifacio Day' => '11-27', + 'Christmas Day' => '12-25', + 'Rizal Day' => '12-30', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $nationalHeroes = new CarbonImmutable("last monday of august {$year}"); + + $easter = $this->easter($year); + + return [ + 'Maundy Thursday' => $easter->subDays(3), + 'Good Friday' => $easter->subDays(2), + 'National Heroes Day' => $nationalHeroes, + ]; + } +} diff --git a/src/Countries/Portugal.php b/src/Countries/Portugal.php new file mode 100644 index 000000000..98c09b0a3 --- /dev/null +++ b/src/Countries/Portugal.php @@ -0,0 +1,41 @@ + '01-01', + 'Dia da Liberdade' => '04-25', + 'Dia do Trabalhador' => '05-01', + 'Dia de Portugal' => '06-10', + 'Assunção da Nossa Senhora' => '08-15', + 'Implantação da República' => '10-05', + 'Dia de Todos os Santos' => '11-01', + 'Restauração da Independência' => '12-01', + 'Imaculada Conceição' => '12-08', + 'Natal' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Páscoa' => $easter, + 'Sexta-feira Santa' => $easter->subDays(2), + 'Corpo de Deus' => $easter->addDays(60), + ]; + } +} diff --git a/src/Countries/Uganda.php b/src/Countries/Uganda.php new file mode 100644 index 000000000..90a0af5bf --- /dev/null +++ b/src/Countries/Uganda.php @@ -0,0 +1,42 @@ + '01-01', + 'NRM Liberation Day' => '01-26', + 'Archbishop Janani Luwum Day' => '02-16', + "International Women's Day" => '03-08', + 'Labour Day' => '05-01', + "Martyrs' Day" => '06-03', + 'National Hereos Day' => '06-09', + 'Independence Day' => '10-09', + 'Christmas Day' => '12-25', + 'Boxing Day' => '12-26', + ], $this->variableHolidays($year)); + } + + /** + * @return array + */ + private function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Africa/Nairobi'); + + return [ + 'Good Friday' => $easter->subDays(2), + 'Easter Monday' => $easter->addDay(), + ]; + } +} diff --git a/src/Countries/Venezuela.php b/src/Countries/Venezuela.php new file mode 100644 index 000000000..10082f44d --- /dev/null +++ b/src/Countries/Venezuela.php @@ -0,0 +1,42 @@ + '01-01', + 'Declaración de la Independencia' => '04-19', + 'Día del Trabajador' => '05-01', + 'Aniversario de la Batalla de Carabobo' => '06-24', + 'Día de la Independencia' => '07-05', + 'Natalicio de Simón Bolívar' => '07-24', + 'Día de la Resistencia Indígena' => '10-12', + 'Víspera de Navidad' => '12-24', + 'Navidad' => '12-25', + 'Día de Fin de Año' => '12-31', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Lunes de Carnaval' => $easter->subDays(48), + 'Martes de Carnaval' => $easter->subDays(42), + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + ]; + } +} diff --git a/src/Countries/Zambia.php b/src/Countries/Zambia.php new file mode 100644 index 000000000..c8802a90f --- /dev/null +++ b/src/Countries/Zambia.php @@ -0,0 +1,43 @@ + '01-01', + 'International Womens Day' => '03-08', + 'Youth Day' => '03-12', + 'Birthday of Kenneth Kaunda' => '04-28', + 'Labour Day' => '05-01', + 'Africa Day' => '05-25', + 'Heroes Day' => '07-01', + 'Unity Day' => '07-02', + 'Farmers Day' => '08-01', + 'National Prayer Day' => '10-18', + 'Independence Day' => '10-24', + 'Christmas Day' => '12-25', + + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Good Friday' => $easter->subDays(2), + 'Easter Monday' => $easter->addDay(), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/BangladeshTest/it_can_calculate_bangladesh_holidays.snap b/tests/.pest/snapshots/Countries/BangladeshTest/it_can_calculate_bangladesh_holidays.snap new file mode 100644 index 000000000..f5a0e91db --- /dev/null +++ b/tests/.pest/snapshots/Countries/BangladeshTest/it_can_calculate_bangladesh_holidays.snap @@ -0,0 +1,34 @@ +[ + { + "name": "International Mother Language Day", + "date": "2024-02-21" + }, + { + "name": "Birthday of Sheikh Mujibur Rahman", + "date": "2024-03-17" + }, + { + "name": "Independence Day", + "date": "2024-03-26" + }, + { + "name": "Bengali New Year", + "date": "2024-04-14" + }, + { + "name": "May Day", + "date": "2024-05-01" + }, + { + "name": "National Mourning Day", + "date": "2024-08-15" + }, + { + "name": "Victory Day", + "date": "2024-12-16" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BoliviaTest/it_can_calculate_bolivian_holidays.snap b/tests/.pest/snapshots/Countries/BoliviaTest/it_can_calculate_bolivian_holidays.snap new file mode 100644 index 000000000..c169618cb --- /dev/null +++ b/tests/.pest/snapshots/Countries/BoliviaTest/it_can_calculate_bolivian_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "D\u00eda de A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "D\u00eda del Estado Plurinacional", + "date": "2024-01-22" + }, + { + "name": "Lunes de Carnaval", + "date": "2024-02-12" + }, + { + "name": "Martes de Carnaval", + "date": "2024-02-13" + }, + { + "name": "Viernes Santo", + "date": "2024-03-29" + }, + { + "name": "D\u00eda del Trabajador", + "date": "2024-05-01" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "A\u00f1o Nuevo Aymara", + "date": "2024-06-21" + }, + { + "name": "D\u00eda de la Independencia", + "date": "2024-08-06" + }, + { + "name": "D\u00eda de Todos los Santos", + "date": "2024-11-02" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BrazilTest/it_can_calculate_brazil_holidays.snap b/tests/.pest/snapshots/Countries/BrazilTest/it_can_calculate_brazil_holidays.snap index 5be3e640f..eeaf05a79 100644 --- a/tests/.pest/snapshots/Countries/BrazilTest/it_can_calculate_brazil_holidays.snap +++ b/tests/.pest/snapshots/Countries/BrazilTest/it_can_calculate_brazil_holidays.snap @@ -39,6 +39,10 @@ "name": "Proclama\u00e7\u00e3o da Rep\u00fablica", "date": "2024-11-15" }, + { + "name": "Dia Nacional de Zumbi e da Consci\u00eancia Negra", + "date": "2024-11-20" + }, { "name": "Natal", "date": "2024-12-25" diff --git a/tests/.pest/snapshots/Countries/CroatiaTest/it_can_calculate_croatian_holidays.snap b/tests/.pest/snapshots/Countries/CroatiaTest/it_can_calculate_croatian_holidays.snap new file mode 100644 index 000000000..206f07845 --- /dev/null +++ b/tests/.pest/snapshots/Countries/CroatiaTest/it_can_calculate_croatian_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Nova godina", + "date": "2024-01-01" + }, + { + "name": "Bogojavljenje", + "date": "2024-01-06" + }, + { + "name": "Uskrsni ponedjeljak", + "date": "2024-04-01" + }, + { + "name": "Praznik rada", + "date": "2024-05-01" + }, + { + "name": "Dan dr\u017eavnosti", + "date": "2024-05-30" + }, + { + "name": "Tijelovo", + "date": "2024-05-30" + }, + { + "name": "Dan antifa\u0161isti\u010dke borbe", + "date": "2024-06-22" + }, + { + "name": "Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja", + "date": "2024-08-05" + }, + { + "name": "Velika Gospa", + "date": "2024-08-15" + }, + { + "name": "Svi sveti", + "date": "2024-11-01" + }, + { + "name": "Dan sje\u0107anja na \u017ertve Domovinskog rata i Dan sje\u0107anja na \u017ertvu Vukovara i \u0160kabrnje", + "date": "2024-11-18" + }, + { + "name": "Bo\u017ei\u0107", + "date": "2024-12-25" + }, + { + "name": "Sveti Stjepan", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap b/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap new file mode 100644 index 000000000..9e3ba56a8 --- /dev/null +++ b/tests/.pest/snapshots/Countries/CzechiaTest/it_can_calculate_czech_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Den obnovy samostatn\u00e9ho \u010desk\u00e9ho st\u00e1tu", + "date": "2024-01-01" + }, + { + "name": "Velk\u00fd p\u00e1tek", + "date": "2024-03-29" + }, + { + "name": "Velikono\u010dn\u00ed pond\u011bl\u00ed", + "date": "2024-04-01" + }, + { + "name": "Sv\u00e1tek pr\u00e1ce", + "date": "2024-05-01" + }, + { + "name": "Den v\u00edt\u011bzstv\u00ed", + "date": "2024-05-08" + }, + { + "name": "Den slovansk\u00fdch v\u011brozv\u011bst\u016f Cyrila a Metod\u011bje", + "date": "2024-07-05" + }, + { + "name": "Den up\u00e1len\u00ed mistra Jana Husa", + "date": "2024-07-06" + }, + { + "name": "Den \u010desk\u00e9 st\u00e1tnosti", + "date": "2024-09-28" + }, + { + "name": "Den vzniku samostatn\u00e9ho \u010deskoslovensk\u00e9ho st\u00e1tu", + "date": "2024-10-28" + }, + { + "name": "Den boje za svobodu a demokracii a Mezin\u00e1rodn\u00ed den studentstva", + "date": "2024-11-17" + }, + { + "name": "\u0160t\u011bdr\u00fd den", + "date": "2024-12-24" + }, + { + "name": "1. sv\u00e1tek v\u00e1no\u010dn\u00ed", + "date": "2024-12-25" + }, + { + "name": "2. sv\u00e1tek v\u00e1no\u010dn\u00ed", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/DenmarkTest/it_can_calculate_danish_holidays.snap b/tests/.pest/snapshots/Countries/DenmarkTest/it_can_calculate_danish_holidays.snap new file mode 100644 index 000000000..b19f23c2d --- /dev/null +++ b/tests/.pest/snapshots/Countries/DenmarkTest/it_can_calculate_danish_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Nyt\u00e5r", + "date": "2024-01-01" + }, + { + "name": "Sk\u00e6rtorsdag", + "date": "2024-03-28" + }, + { + "name": "Langfredag", + "date": "2024-03-29" + }, + { + "name": "P\u00e5skedag", + "date": "2024-04-01" + }, + { + "name": "Anden P\u00e5skedag", + "date": "2024-04-02" + }, + { + "name": "Kristi Himmelfartsdag", + "date": "2024-05-09" + }, + { + "name": "Pinse", + "date": "2024-05-19" + }, + { + "name": "Anden Pinsedag", + "date": "2024-05-20" + }, + { + "name": "Juleaften", + "date": "2024-12-24" + }, + { + "name": "Juledag", + "date": "2024-12-25" + }, + { + "name": "Anden Juledag", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/DominicanRepublicTest/it_can_calculate_dominican_republic_holidays.snap b/tests/.pest/snapshots/Countries/DominicanRepublicTest/it_can_calculate_dominican_republic_holidays.snap new file mode 100644 index 000000000..3bdd36d0d --- /dev/null +++ b/tests/.pest/snapshots/Countries/DominicanRepublicTest/it_can_calculate_dominican_republic_holidays.snap @@ -0,0 +1,38 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "D\u00eda de la Altagracia", + "date": "2024-01-21" + }, + { + "name": "D\u00eda de Duarte", + "date": "2024-01-26" + }, + { + "name": "D\u00eda de la Independencia", + "date": "2024-02-27" + }, + { + "name": "D\u00eda del Trabajo", + "date": "2024-05-01" + }, + { + "name": "D\u00eda de la Restauraci\u00f3n", + "date": "2024-08-16" + }, + { + "name": "D\u00eda de las Mercedes", + "date": "2024-09-24" + }, + { + "name": "D\u00eda de la Constituci\u00f3n", + "date": "2024-11-06" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/EstoniaTest/it_can_calculate_estonian_holidays.snap b/tests/.pest/snapshots/Countries/EstoniaTest/it_can_calculate_estonian_holidays.snap new file mode 100644 index 000000000..bbd7f3c12 --- /dev/null +++ b/tests/.pest/snapshots/Countries/EstoniaTest/it_can_calculate_estonian_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Uusaasta", + "date": "2024-01-01" + }, + { + "name": "Iseseisvusp\u00e4ev", + "date": "2024-02-24" + }, + { + "name": "Suur reede", + "date": "2024-03-29" + }, + { + "name": "\u00dclest\u00f5usmisp\u00fchade 1. p\u00fcha", + "date": "2024-03-31" + }, + { + "name": "Kevadp\u00fcha", + "date": "2024-05-01" + }, + { + "name": "Nelip\u00fchade 1. p\u00fcha", + "date": "2024-05-19" + }, + { + "name": "V\u00f5idup\u00fcha", + "date": "2024-06-23" + }, + { + "name": "Jaanip\u00e4ev", + "date": "2024-06-24" + }, + { + "name": "Taasiseseisvumisp\u00e4ev", + "date": "2024-08-20" + }, + { + "name": "J\u00f5ululaup\u00e4ev", + "date": "2024-12-24" + }, + { + "name": "Esimene j\u00f5ulup\u00fcha", + "date": "2024-12-25" + }, + { + "name": "Teine j\u00f5ulup\u00fcha", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_date_based_regional_holidays.snap b/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_date_based_regional_holidays.snap new file mode 100644 index 000000000..5256f894b --- /dev/null +++ b/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_date_based_regional_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "Jour de l'An", + "date": "2024-01-01" + }, + { + "name": "Lundi de P\u00e2ques", + "date": "2024-04-01" + }, + { + "name": "F\u00eate du Travail", + "date": "2024-05-01" + }, + { + "name": "Victoire 1945", + "date": "2024-05-08" + }, + { + "name": "Ascension", + "date": "2024-05-09" + }, + { + "name": "Lundi de Pentec\u00f4te", + "date": "2024-05-20" + }, + { + "name": "F\u00eate Nationale", + "date": "2024-07-14" + }, + { + "name": "Assomption", + "date": "2024-08-15" + }, + { + "name": "Abolition de l'esclavage", + "date": "2024-10-09" + }, + { + "name": "Toussaint", + "date": "2024-11-01" + }, + { + "name": "Armistice 1918", + "date": "2024-11-11" + }, + { + "name": "No\u00ebl", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_easter_based_region_holidays.snap b/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_easter_based_region_holidays.snap new file mode 100644 index 000000000..4dd52f185 --- /dev/null +++ b/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_easter_based_region_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Jour de l'An", + "date": "2024-01-01" + }, + { + "name": "Vendredi Saint", + "date": "2024-03-29" + }, + { + "name": "Lundi de P\u00e2ques", + "date": "2024-04-01" + }, + { + "name": "F\u00eate du Travail", + "date": "2024-05-01" + }, + { + "name": "Victoire 1945", + "date": "2024-05-08" + }, + { + "name": "Ascension", + "date": "2024-05-09" + }, + { + "name": "Lundi de Pentec\u00f4te", + "date": "2024-05-20" + }, + { + "name": "F\u00eate Nationale", + "date": "2024-07-14" + }, + { + "name": "Assomption", + "date": "2024-08-15" + }, + { + "name": "Toussaint", + "date": "2024-11-01" + }, + { + "name": "Armistice 1918", + "date": "2024-11-11" + }, + { + "name": "No\u00ebl", + "date": "2024-12-25" + }, + { + "name": "Saint-\u00c9tienne", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_holidays.snap b/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_holidays.snap new file mode 100644 index 000000000..f89d17309 --- /dev/null +++ b/tests/.pest/snapshots/Countries/FranceTest/it_can_calculate_french_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Jour de l'An", + "date": "2024-01-01" + }, + { + "name": "Lundi de P\u00e2ques", + "date": "2024-04-01" + }, + { + "name": "F\u00eate du Travail", + "date": "2024-05-01" + }, + { + "name": "Victoire 1945", + "date": "2024-05-08" + }, + { + "name": "Ascension", + "date": "2024-05-09" + }, + { + "name": "Lundi de Pentec\u00f4te", + "date": "2024-05-20" + }, + { + "name": "F\u00eate Nationale", + "date": "2024-07-14" + }, + { + "name": "Assomption", + "date": "2024-08-15" + }, + { + "name": "Toussaint", + "date": "2024-11-01" + }, + { + "name": "Armistice 1918", + "date": "2024-11-11" + }, + { + "name": "No\u00ebl", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/IrelandTest/it_can_calculate_irish_holidays.snap b/tests/.pest/snapshots/Countries/IrelandTest/it_can_calculate_irish_holidays.snap new file mode 100644 index 000000000..5d241806a --- /dev/null +++ b/tests/.pest/snapshots/Countries/IrelandTest/it_can_calculate_irish_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "St Brigid's Day", + "date": "2024-02-05" + }, + { + "name": "Saint Patrick's Day", + "date": "2024-03-17" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "May Public Holiday", + "date": "2024-05-06" + }, + { + "name": "June Public Holiday", + "date": "2024-06-03" + }, + { + "name": "August Public Holiday", + "date": "2024-08-05" + }, + { + "name": "October Public Holiday", + "date": "2024-10-28" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Saint Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/ItalyTest/it_can_calculate_italian_holidays.snap b/tests/.pest/snapshots/Countries/ItalyTest/it_can_calculate_italian_holidays.snap new file mode 100644 index 000000000..b390d06e5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/ItalyTest/it_can_calculate_italian_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "Capodanno", + "date": "2024-01-01" + }, + { + "name": "Epifania", + "date": "2024-01-06" + }, + { + "name": "Luned\u00ec di Pasqua", + "date": "2024-04-01" + }, + { + "name": "Liberazione dal nazifascismo", + "date": "2024-04-25" + }, + { + "name": "Festa del lavoro", + "date": "2024-05-01" + }, + { + "name": "Festa della Repubblica", + "date": "2024-06-02" + }, + { + "name": "Assunzione di Maria", + "date": "2024-08-15" + }, + { + "name": "Ognissanti", + "date": "2024-11-01" + }, + { + "name": "Immacolata Concezione", + "date": "2024-12-08" + }, + { + "name": "Natale di Ges\u00f9", + "date": "2024-12-25" + }, + { + "name": "Santo Stefano", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_malawi_holidays.snap b/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_malawi_holidays.snap new file mode 100644 index 000000000..63bfa81dc --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_malawi_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "New Years Day", + "date": "2024-01-01" + }, + { + "name": "John Chilembwe Day", + "date": "2024-01-15" + }, + { + "name": "Martyrs Day", + "date": "2024-03-03" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Kamuzu Day", + "date": "2024-05-14" + }, + { + "name": "Independence Day", + "date": "2024-07-06" + }, + { + "name": "Mothers Day", + "date": "2024-10-15" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Boxing Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap b/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap new file mode 100644 index 000000000..63bfa81dc --- /dev/null +++ b/tests/.pest/snapshots/Countries/MalawiTest/it_can_calculate_ugandan_holidays.snap @@ -0,0 +1,46 @@ +[ + { + "name": "New Years Day", + "date": "2024-01-01" + }, + { + "name": "John Chilembwe Day", + "date": "2024-01-15" + }, + { + "name": "Martyrs Day", + "date": "2024-03-03" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Kamuzu Day", + "date": "2024-05-14" + }, + { + "name": "Independence Day", + "date": "2024-07-06" + }, + { + "name": "Mothers Day", + "date": "2024-10-15" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Boxing Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/MexicoTest/it_can_calculate_mexican_holidays.snap b/tests/.pest/snapshots/Countries/MexicoTest/it_can_calculate_mexican_holidays.snap new file mode 100644 index 000000000..7f15803a3 --- /dev/null +++ b/tests/.pest/snapshots/Countries/MexicoTest/it_can_calculate_mexican_holidays.snap @@ -0,0 +1,34 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "D\u00eda de la Constituci\u00f3n", + "date": "2024-02-04" + }, + { + "name": "Natalicio de Benito Ju\u00e1rez", + "date": "2024-03-17" + }, + { + "name": "D\u00eda Internacional de los Trabajadores", + "date": "2024-05-01" + }, + { + "name": "D\u00eda de Independencia", + "date": "2024-09-16" + }, + { + "name": "Cambio de Gobierno", + "date": "2024-09-30" + }, + { + "name": "D\u00eda de la Revoluci\u00f3n", + "date": "2024-11-17" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap b/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap index 3257dd423..7ba840be8 100644 --- a/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap +++ b/tests/.pest/snapshots/Countries/NetherlandsTest/it_can_calculate_dutch_holidays.snap @@ -42,9 +42,5 @@ { "name": "2e Kerstdag", "date": "2024-12-26" - }, - { - "name": "Oudejaarsdag", - "date": "2024-12-31" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/NicaraguaTest/it_can_calculate_nicaragua_holidays.snap b/tests/.pest/snapshots/Countries/NicaraguaTest/it_can_calculate_nicaragua_holidays.snap new file mode 100644 index 000000000..b92235be0 --- /dev/null +++ b/tests/.pest/snapshots/Countries/NicaraguaTest/it_can_calculate_nicaragua_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "A\u00f1o nuevo", + "date": "2024-01-01" + }, + { + "name": "Jueves santo", + "date": "2024-03-28" + }, + { + "name": "Viernes santo", + "date": "2024-03-29" + }, + { + "name": "D\u00eda internacional de los trabajadores", + "date": "2024-05-01" + }, + { + "name": "D\u00eda de las madres", + "date": "2024-05-30" + }, + { + "name": "Aniversario de la revoluci\u00f3n", + "date": "2024-07-19" + }, + { + "name": "Aniversario de la batalla de san jacinto", + "date": "2024-09-14" + }, + { + "name": "Aniversario de la independencia", + "date": "2024-09-15" + }, + { + "name": "D\u00eda de la inmaculada concepci\u00f3n", + "date": "2024-12-08" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/NorthMacedoniaTest/it_can_calculate_macedonian_holidays.snap b/tests/.pest/snapshots/Countries/NorthMacedoniaTest/it_can_calculate_macedonian_holidays.snap new file mode 100644 index 000000000..dfc694191 --- /dev/null +++ b/tests/.pest/snapshots/Countries/NorthMacedoniaTest/it_can_calculate_macedonian_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "\u041d\u043e\u0432\u0430 \u0433\u043e\u0434\u0438\u043d\u0430", + "date": "2024-01-01" + }, + { + "name": "\u0411\u043e\u0436\u0438\u043a, \u043f\u0440\u0432\u0438\u043e\u0442 \u0434\u0435\u043d \u043d\u0430 \u0411\u043e\u0436\u0438\u043a \u0441\u043f\u043e\u0440\u0435\u0434 \u043f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u0438\u043e\u0442 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440", + "date": "2024-01-07" + }, + { + "name": "\u0414\u0435\u043d \u043d\u0430 \u0442\u0440\u0443\u0434\u043e\u0442", + "date": "2024-05-01" + }, + { + "name": "\u0412\u0435\u043b\u0438\u0433\u0434\u0435\u043d, \u0432\u0442\u043e\u0440\u0438\u043e\u0442 \u0434\u0435\u043d \u043d\u0430 \u0412\u0435\u043b\u0438\u0433\u0434\u0435\u043d \u0441\u043f\u043e\u0440\u0435\u0434 \u043f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u0438\u043e\u0442 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440", + "date": "2024-05-06" + }, + { + "name": "\u0421\u0432. \u041a\u0438\u0440\u0438\u043b \u0438 \u041c\u0435\u0442\u043e\u0434\u0438\u0458 - \u0414\u0435\u043d \u043d\u0430 \u0441\u0435\u0441\u043b\u043e\u0432\u0435\u043d\u0441\u043a\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0432\u0435\u0442\u0438\u0442\u0435\u043b\u0438", + "date": "2024-05-24" + }, + { + "name": "\u0414\u0435\u043d \u043d\u0430 \u0420\u0435\u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u0430", + "date": "2024-08-02" + }, + { + "name": "\u0414\u0435\u043d \u043d\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u043d\u043e\u0441\u0442\u0430", + "date": "2024-09-08" + }, + { + "name": "\u0414\u0435\u043d \u043d\u0430 \u043d\u0430\u0440\u043e\u0434\u043d\u043e\u0442\u043e \u0432\u043e\u0441\u0442\u0430\u043d\u0438\u0435", + "date": "2024-10-11" + }, + { + "name": "\u0414\u0435\u043d \u043d\u0430 \u043c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0430\u0442\u0430 \u0440\u0435\u0432\u043e\u043b\u0443\u0446\u0438\u043e\u043d\u0435\u0440\u043d\u0430 \u0431\u043e\u0440\u0431\u0430", + "date": "2024-10-23" + }, + { + "name": "\u0421\u0432. \u041a\u043b\u0438\u043c\u0435\u043d\u0442 \u041e\u0445\u0440\u0438\u0434\u0441\u043a\u0438", + "date": "2024-12-08" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/PhilippinesTest/it_can_calculate_philippine_holidays.snap b/tests/.pest/snapshots/Countries/PhilippinesTest/it_can_calculate_philippine_holidays.snap new file mode 100644 index 000000000..0859fcf5e --- /dev/null +++ b/tests/.pest/snapshots/Countries/PhilippinesTest/it_can_calculate_philippine_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Maundy Thursday", + "date": "2024-03-28" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Araw ng Kagitingan", + "date": "2024-04-09" + }, + { + "name": "Labor Day", + "date": "2024-05-01" + }, + { + "name": "Independence Day", + "date": "2024-06-12" + }, + { + "name": "National Heroes Day", + "date": "2024-08-26" + }, + { + "name": "Bonifacio Day", + "date": "2024-11-27" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Rizal Day", + "date": "2024-12-30" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/PortugalTest/it_can_calculate_portuguese_holidays.snap b/tests/.pest/snapshots/Countries/PortugalTest/it_can_calculate_portuguese_holidays.snap new file mode 100644 index 000000000..13513781f --- /dev/null +++ b/tests/.pest/snapshots/Countries/PortugalTest/it_can_calculate_portuguese_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Dia de Ano Novo", + "date": "2024-01-01" + }, + { + "name": "Sexta-feira Santa", + "date": "2024-03-29" + }, + { + "name": "P\u00e1scoa", + "date": "2024-03-31" + }, + { + "name": "Dia da Liberdade", + "date": "2024-04-25" + }, + { + "name": "Dia do Trabalhador", + "date": "2024-05-01" + }, + { + "name": "Corpo de Deus", + "date": "2024-05-30" + }, + { + "name": "Dia de Portugal", + "date": "2024-06-10" + }, + { + "name": "Assun\u00e7\u00e3o da Nossa Senhora", + "date": "2024-08-15" + }, + { + "name": "Implanta\u00e7\u00e3o da Rep\u00fablica", + "date": "2024-10-05" + }, + { + "name": "Dia de Todos os Santos", + "date": "2024-11-01" + }, + { + "name": "Restaura\u00e7\u00e3o da Independ\u00eancia", + "date": "2024-12-01" + }, + { + "name": "Imaculada Concei\u00e7\u00e3o", + "date": "2024-12-08" + }, + { + "name": "Natal", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/UgandaTest/it_can_calculate_ugandan_holidays.snap b/tests/.pest/snapshots/Countries/UgandaTest/it_can_calculate_ugandan_holidays.snap new file mode 100644 index 000000000..ff3733180 --- /dev/null +++ b/tests/.pest/snapshots/Countries/UgandaTest/it_can_calculate_ugandan_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "NRM Liberation Day", + "date": "2024-01-26" + }, + { + "name": "Archbishop Janani Luwum Day", + "date": "2024-02-16" + }, + { + "name": "International Women's Day", + "date": "2024-03-08" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Martyrs' Day", + "date": "2024-06-03" + }, + { + "name": "National Hereos Day", + "date": "2024-06-09" + }, + { + "name": "Independence Day", + "date": "2024-10-09" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Boxing Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/VenezuelaTest/it_can_calculate_venezuelan_holidays.snap b/tests/.pest/snapshots/Countries/VenezuelaTest/it_can_calculate_venezuelan_holidays.snap new file mode 100644 index 000000000..dd3850a4b --- /dev/null +++ b/tests/.pest/snapshots/Countries/VenezuelaTest/it_can_calculate_venezuelan_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "A\u00f1o nuevo", + "date": "2024-01-01" + }, + { + "name": "Lunes de Carnaval", + "date": "2024-02-12" + }, + { + "name": "Martes de Carnaval", + "date": "2024-02-18" + }, + { + "name": "Jueves Santo", + "date": "2024-03-28" + }, + { + "name": "Viernes Santo", + "date": "2024-03-29" + }, + { + "name": "Declaraci\u00f3n de la Independencia", + "date": "2024-04-19" + }, + { + "name": "D\u00eda del Trabajador", + "date": "2024-05-01" + }, + { + "name": "Aniversario de la Batalla de Carabobo", + "date": "2024-06-24" + }, + { + "name": "D\u00eda de la Independencia", + "date": "2024-07-05" + }, + { + "name": "Natalicio de Sim\u00f3n Bol\u00edvar", + "date": "2024-07-24" + }, + { + "name": "D\u00eda de la Resistencia Ind\u00edgena", + "date": "2024-10-12" + }, + { + "name": "V\u00edspera de Navidad", + "date": "2024-12-24" + }, + { + "name": "Navidad", + "date": "2024-12-25" + }, + { + "name": "D\u00eda de Fin de A\u00f1o", + "date": "2024-12-31" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/ZambiaTest/it_can_calculate_zambian_holidays.snap b/tests/.pest/snapshots/Countries/ZambiaTest/it_can_calculate_zambian_holidays.snap new file mode 100644 index 000000000..8cec8422f --- /dev/null +++ b/tests/.pest/snapshots/Countries/ZambiaTest/it_can_calculate_zambian_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year", + "date": "2024-01-01" + }, + { + "name": "International Womens Day", + "date": "2024-03-08" + }, + { + "name": "Youth Day", + "date": "2024-03-12" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Birthday of Kenneth Kaunda", + "date": "2024-04-28" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Africa Day", + "date": "2024-05-25" + }, + { + "name": "Heroes Day", + "date": "2024-07-01" + }, + { + "name": "Unity Day", + "date": "2024-07-02" + }, + { + "name": "Farmers Day", + "date": "2024-08-01" + }, + { + "name": "National Prayer Day", + "date": "2024-10-18" + }, + { + "name": "Independence Day", + "date": "2024-10-24" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/BangladeshTest.php b/tests/Countries/BangladeshTest.php new file mode 100644 index 000000000..b5b0f0b59 --- /dev/null +++ b/tests/Countries/BangladeshTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/BoliviaTest.php b/tests/Countries/BoliviaTest.php new file mode 100644 index 000000000..e1305657f --- /dev/null +++ b/tests/Countries/BoliviaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty() + ->and(formatDates($holidays))->toMatchSnapshot(); + +}); diff --git a/tests/Countries/CroatiaTest.php b/tests/Countries/CroatiaTest.php new file mode 100644 index 000000000..a78f5258a --- /dev/null +++ b/tests/Countries/CroatiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/CzechiaTest.php b/tests/Countries/CzechiaTest.php new file mode 100644 index 000000000..0a7ece2fa --- /dev/null +++ b/tests/Countries/CzechiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/DenmarkTest.php b/tests/Countries/DenmarkTest.php new file mode 100644 index 000000000..dc01757ce --- /dev/null +++ b/tests/Countries/DenmarkTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/DominicanRepublicTest.php b/tests/Countries/DominicanRepublicTest.php new file mode 100644 index 000000000..954e2a589 --- /dev/null +++ b/tests/Countries/DominicanRepublicTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/EstoniaTest.php b/tests/Countries/EstoniaTest.php new file mode 100644 index 000000000..c7ee1aa0b --- /dev/null +++ b/tests/Countries/EstoniaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/FranceTest.php b/tests/Countries/FranceTest.php new file mode 100644 index 000000000..358f8b1c0 --- /dev/null +++ b/tests/Countries/FranceTest.php @@ -0,0 +1,43 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate french easter based region holidays', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(France::make('FR-57'))->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate french date based regional holidays', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(France::make('FR-BL'))->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/IrelandTest.php b/tests/Countries/IrelandTest.php new file mode 100644 index 000000000..6ed63548f --- /dev/null +++ b/tests/Countries/IrelandTest.php @@ -0,0 +1,29 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate St Bridid\'s day in Ireland', function () { + // In 2022, there was no St Brigid's Day + expect(Holidays::for(country: 'ie')->isHoliday('2022-02-07'))->toBe(false); + + // In 2023, it was on Monday 6th Feb + expect(Holidays::for(country: 'ie')->isHoliday('2023-02-06'))->toBe(true); + + // In 2030, it will fall on Friday 1st Feb + expect(Holidays::for(country: 'ie')->isHoliday('2030-02-01'))->toBe(true); +}); diff --git a/tests/Countries/ItalyTest.php b/tests/Countries/ItalyTest.php new file mode 100644 index 000000000..bd42933b6 --- /dev/null +++ b/tests/Countries/ItalyTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/MalawiTest.php b/tests/Countries/MalawiTest.php new file mode 100644 index 000000000..bc2710322 --- /dev/null +++ b/tests/Countries/MalawiTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/MexicoTest.php b/tests/Countries/MexicoTest.php new file mode 100644 index 000000000..dfd62a71e --- /dev/null +++ b/tests/Countries/MexicoTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/NicaraguaTest.php b/tests/Countries/NicaraguaTest.php new file mode 100644 index 000000000..840a0609a --- /dev/null +++ b/tests/Countries/NicaraguaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/NorthMacedoniaTest.php b/tests/Countries/NorthMacedoniaTest.php new file mode 100644 index 000000000..b68507ff4 --- /dev/null +++ b/tests/Countries/NorthMacedoniaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/PhilippinesTest.php b/tests/Countries/PhilippinesTest.php new file mode 100644 index 000000000..4fd997173 --- /dev/null +++ b/tests/Countries/PhilippinesTest.php @@ -0,0 +1,19 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); diff --git a/tests/Countries/PortugalTest.php b/tests/Countries/PortugalTest.php new file mode 100644 index 000000000..7c2ed381f --- /dev/null +++ b/tests/Countries/PortugalTest.php @@ -0,0 +1,19 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + +}); diff --git a/tests/Countries/UgandaTest.php b/tests/Countries/UgandaTest.php new file mode 100644 index 000000000..82ab1f7f6 --- /dev/null +++ b/tests/Countries/UgandaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/VenezuelaTest.php b/tests/Countries/VenezuelaTest.php new file mode 100644 index 000000000..5b2cf5ea2 --- /dev/null +++ b/tests/Countries/VenezuelaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); diff --git a/tests/Countries/ZambiaTest.php b/tests/Countries/ZambiaTest.php new file mode 100644 index 000000000..83e732256 --- /dev/null +++ b/tests/Countries/ZambiaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});