├── .github └── workflows │ └── run-tests.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── carbon-macros-helper.php ├── composer.json ├── dev └── GenerateIdeHelpers.php ├── docs ├── algeria.md ├── brazil.md ├── egypt.md ├── france.md ├── germany.md ├── india.md ├── indonesia.md ├── italy.md ├── kenya.md ├── netherlands.md ├── sweden.md ├── ukraine.md └── zambia.md ├── lcm ├── lcm-autocomplete.gif ├── phpunit.xml.dist ├── readme.md ├── src ├── CarbonMacrosServiceProvider.php └── Traits │ ├── AlgerianDates.php │ ├── BrazilianDates.php │ ├── CanadianDates.php │ ├── DutchDates.php │ ├── EgyptianDates.php │ ├── FrenchDates.php │ ├── GermanDates.php │ ├── IndianDates.php │ ├── IndonesianDates.php │ ├── ItalianDates.php │ ├── KenyanDates.php │ ├── MultiNationalDates.php │ ├── SwedishDates.php │ ├── UkrainianDates.php │ ├── UsDates.php │ └── ZambianDates.php └── tests ├── AlgerianHolidaysTest.php ├── BrazilianHolidaysTest.php ├── CanadianHolidaysTest.php ├── DutchHolidaysTest.php ├── EgyptianHolidaysTest.php ├── FrenchHolidaysTest.php ├── GermanHolidaysTest.php ├── IndianHolidaysTest.php ├── IndonesianHolidaysTest.php ├── ItalianHolidaysTest.php ├── KenyanHolidaysTest.php ├── SwedishHolidaysTest.php ├── TestCase.php ├── USHolidaysTest.php ├── UkrainianHolidaysTest.php └── ZambianHolidaysTest.php /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | fail-fast: true 10 | matrix: 11 | os: [ubuntu-latest] 12 | php: [7.4, 8.0] 13 | laravel: [7.*, 8.*] 14 | dependency-version: [prefer-lowest, prefer-stable] 15 | include: 16 | - laravel: 7.* 17 | testbench: 5.* 18 | - laravel: 8.* 19 | testbench: 6.* 20 | 21 | name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} 22 | 23 | steps: 24 | - name: Checkout code 25 | uses: actions/checkout@v2 26 | 27 | - name: Cache dependencies 28 | uses: actions/cache@v2 29 | with: 30 | path: ~/.composer/cache/files 31 | key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} 32 | 33 | - name: Setup PHP 34 | uses: shivammathur/setup-php@v2 35 | with: 36 | php-version: ${{ matrix.php }} 37 | extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick 38 | coverage: none 39 | 40 | - name: Install dependencies 41 | run: | 42 | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update 43 | composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest 44 | - name: Execute tests 45 | run: vendor/bin/phpunit 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | .phpunit.result.cache 4 | composer.lock 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.5.0 - 2020-12-28 4 | - Add IDE autocomplete helper file 5 | - Add Indian date helpers - [@prakashchhetri](https://github.com/prakashchhetri) 6 | - Add Dutch date helpers - [@stephanbouman](https://github.com/stephanbouman) 7 | - Add Zambian date helpers - [@twmbx](https://github.com/twmbx) 8 | 9 | ## 1.4.0 - 2020-12-14 10 | - Add German date helpers - [@dsturm](https://github.com/dsturm) 11 | - Add Kenyan date helpers - [@lexxyungcarter](https://github.com/lexxyungcarter) 12 | - Add French date helpers - [@fabpl](https://github.com/fabpl), [@auncly](https://github.com/auncly) 13 | - Add Brazilian Day of the Deads holiday - [@lucassmacedo](https://github.com/lucassmacedo) 14 | 15 | ## 1.3.0 - 2020-12-13 16 | - Add Indonesian date helpers - [@PanjiNamjaElf](https://github.com/PanjiNamjaElf) 17 | - Add trust badges to readme - [@thinkverse](https://github.com/thinkverse) - addresses [#9](https://github.com/dansoppelsa/laravel-carbon-macros/issues/9) 18 | 19 | ## 1.2.0 - 2020-12-12 20 | - Add Italian date helpers - [@tiaxter](https://github.com/tiaxter) 21 | - Add Swedish date helpers - [@thinkverse](https://github.com/thinkverse) 22 | - Add GitHub Action for tests - [@thinkverse](https://github.com/thinkverse) 23 | 24 | ## 1.1.0 - 2020-12-04 25 | - Add Brazilian date helpers - [@FRFlor](https://github.com/FRFlor) 26 | - Add Ukrainian date helpers - [@alisondraV](https://github.com/alisondraV) 27 | - Documentation updates 28 | 29 | ## 1.0.0 - 2020-10-01 30 | - First stable release 31 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2020 Dan Soppelsa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /carbon-macros-helper.php: -------------------------------------------------------------------------------- 1 | =5.5" 8 | }, 9 | "require-dev": { 10 | "orchestra/testbench": "6.*" 11 | }, 12 | "authors": [ 13 | { 14 | "name": "Dan Soppelsa", 15 | "email": "dsoppelsa@gmail.com" 16 | } 17 | ], 18 | "autoload": { 19 | "psr-4" : { 20 | "CarbonMacros\\" : "src" 21 | } 22 | }, 23 | "autoload-dev" : { 24 | "psr-4" : { 25 | "CarbonMacros\\" : "tests", 26 | "CarbonMacros\\Dev\\" : "dev" 27 | } 28 | }, 29 | "extra": { 30 | "laravel": { 31 | "providers": [ 32 | "CarbonMacros\\CarbonMacrosServiceProvider" 33 | ] 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dev/GenerateIdeHelpers.php: -------------------------------------------------------------------------------- 1 | getTraitFiles(); 17 | 18 | $files = $files->flatMap(function (string $fileName) { 19 | $matches = []; 20 | 21 | preg_match_all( 22 | '/Carbon::macro\([\'"]{1}(?P[a-zA-Z]{1}[\w\d]*)[\'"]{1}/', 23 | file_get_contents($fileName), 24 | $matches 25 | ); 26 | 27 | return collect($matches['macros'])->sort(); 28 | }) 29 | ->map(function (string $macroMethod) { 30 | return " * @method bool $macroMethod"; 31 | }); 32 | 33 | $header = $this->getFileHeader(); 34 | $content = $files->implode(PHP_EOL); 35 | $footer = $this->getFileFooter(); 36 | 37 | file_put_contents(lcm_path('carbon-macros-helper.php'), $header . $content . $footer); 38 | } 39 | 40 | protected function getFileHeader(): string 41 | { 42 | return <<filter(function ($file) { 66 | return Str::endsWith($file, '.php'); 67 | }) 68 | ->map(function (string $fileName) { 69 | return lcm_path("src/traits/$fileName"); 70 | }) 71 | ->values(); 72 | } 73 | } -------------------------------------------------------------------------------- /docs/algeria.md: -------------------------------------------------------------------------------- 1 | ### Algerian Dates 2 | 3 | - isAlgerianIndependenceDay 4 | - isAlgerianRevolutionDay 5 | - isAlgerianLaborDay 6 | - isAmazighNewYear -------------------------------------------------------------------------------- /docs/brazil.md: -------------------------------------------------------------------------------- 1 | ### Brazilian Dates 2 | 3 | - isBrazilianIndependenceDay 4 | - isBrazilianLaborDay 5 | - isBrazilianRepublicProclamationDay 6 | - isTheDayOfOurLadyAparecida 7 | - isTiradentesDay 8 | -------------------------------------------------------------------------------- /docs/egypt.md: -------------------------------------------------------------------------------- 1 | ### Egyptian Dates 2 | 3 | | Method | Description | 4 | | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | 5 | | `isEgyptianChristmasDay` | Celebrates the birth of Jesus Christ, according to the Coptic Calendar (29 Koiak). | 6 | | `isEgyptian2011RevolutionDay` | Celebrates the day of the beginning of the Egyptian revolution of 2011, protesting the 29-year rule of Hosni Mubarak. | 7 | | `isEgyptianNationalPoliceDay` | Celebrates the anniversary of Police officers resistance against the British Army in 1952 during the final months of the colonial era. | 8 | | `isEgyptianSinaLiberationDay` | Celebrates the final withdrawal of all Israeli military forces from the Sinai Peninsula in 1982. | 9 | | `isEgyptianLabourDay` | | 10 | | `isEgyptian30JuneRevolutionDay` | Observes the June 2013 Egyptian protests, which saw President Mohamed Morsi deposed by the military a few days later. | 11 | | `isEgyptian23JulyRevolutionDay` | Celebrates the Egyptian Revolution of 1952 which led to the declaration of the modern republic of Egypt. This is considered the National Day of Egypt. | 12 | | `isEgyptian6OctoberVictoryDay` | Celebrates Egypt's initial military success in the October War which led to the liberation of the land of Sinai from occupation back to Egyptian sovereignty. | 13 | -------------------------------------------------------------------------------- /docs/france.md: -------------------------------------------------------------------------------- 1 | ### French Dates 2 | 3 | - isAscensionDay 4 | - isAssumptionDay 5 | - isEasterMonday 6 | - isFirstWarArmisticeDay 7 | - isFrenchNationalDay 8 | - isPentecostDay 9 | - isSecondWarArmisticeDay 10 | -------------------------------------------------------------------------------- /docs/germany.md: -------------------------------------------------------------------------------- 1 | ### German Dates 2 | 3 | - isGermanLabourDay 4 | - isAscensionOfJesus 5 | - isWhitSunday 6 | - isWhitsun 7 | - isPentecost 8 | - isPentecostSunday 9 | - isWhitMonday 10 | - isPentecostMonday 11 | - isCorpusChristi 12 | - isGermanUnityDay 13 | - isHeiligerAbend 14 | - isHeiligAbend 15 | -------------------------------------------------------------------------------- /docs/india.md: -------------------------------------------------------------------------------- 1 | ### Indian Dates 2 | 3 | - isIndianRepublicDay 4 | - isIndianIndependenceDay 5 | - isGandhiJayanti -------------------------------------------------------------------------------- /docs/indonesia.md: -------------------------------------------------------------------------------- 1 | ### Indonesian Dates 2 | 3 | - isIndonesianIndependenceDay 4 | - isPancasilaDay 5 | - isIndonesianLaborDay 6 | - isKartiniDay 7 | - isIndonesianEducationDay 8 | - isIndonesiaCustomerDay 9 | - isIndonesianHeroesDay 10 | - isIndonesianMothersDay 11 | -------------------------------------------------------------------------------- /docs/italy.md: -------------------------------------------------------------------------------- 1 | ### Italian Dates 2 | 3 | - isLiberationDay 4 | - isRepublicDay 5 | - isImmaculateConceptionFeast 6 | - isAssumptionOfMaryFeast 7 | - isEpiphany 8 | - isSaintStephenDay 9 | - isSaintSylvesterDay 10 | - isWorkersDay 11 | -------------------------------------------------------------------------------- /docs/kenya.md: -------------------------------------------------------------------------------- 1 | ### Kenyan Dates 2 | 3 | - isKenyanIndependenceDay 4 | - isKenyanJamhuriDay 5 | - isKenyanLabourDay 6 | - isKenyanMadarakaDay 7 | - isKenyanHudumaDay 8 | - isKenyanMashujaaDay 9 | - isKenyanUtamaduniDay 10 | -------------------------------------------------------------------------------- /docs/netherlands.md: -------------------------------------------------------------------------------- 1 | ### Dutch dates 2 | 3 | - isDutchLiberationDay 4 | - isDutchRemembranceDay 5 | - isDutchNationalHoliday 6 | - isSaintNicholasEve 7 | -------------------------------------------------------------------------------- /docs/sweden.md: -------------------------------------------------------------------------------- 1 | ### Swedish Dates 2 | 3 | - isSwedishMidsummerDay 4 | - isChristmasEve 5 | - isSwedishNationalDay -------------------------------------------------------------------------------- /docs/ukraine.md: -------------------------------------------------------------------------------- 1 | ### Ukrainian Dates 2 | 3 | - isKupalaNight 4 | - isUkraineDefenderDay 5 | - isUkrainianConstitutionDay 6 | - isUkrainianIndependenceDay 7 | - isUkrainianLabourDay 8 | - isVictoryDayOverNazism -------------------------------------------------------------------------------- /docs/zambia.md: -------------------------------------------------------------------------------- 1 | ### Zambian Dates 2 | 3 | - isZambianIndependenceDay 4 | - isZambianLabourDay 5 | - isZambianYouthDay 6 | - isZambianWomensDay 7 | - isZambianAfricanUnityDay 8 | - isZambianAfricaDay 9 | - isZambianHeroesDay 10 | - isZambianUnityDay 11 | - isZambianFarmersDay 12 | - isZambianNationalPrayerDay 13 | -------------------------------------------------------------------------------- /lcm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | add(new GenerateIdeHelpers); 22 | $app->run(); -------------------------------------------------------------------------------- /lcm-autocomplete.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dansoppelsa/laravel-carbon-macros/fcc1f6ac143035b1a1643c2ab4ce53b3754cafd5/lcm-autocomplete.gif -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | tests 5 | 6 | 7 | 8 | 9 | src/ 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Laravel Carbon Macros 2 | 3 | ![Packagist Version](https://img.shields.io/packagist/v/dansoppelsa/laravel-carbon-macros) ![GitHub Main Workflow Status](https://img.shields.io/github/workflow/status/dansoppelsa/laravel-carbon-macros/Tests/master) ![Packagist License](https://img.shields.io/packagist/l/dansoppelsa/laravel-carbon-macros) ![GitHub Contributors](https://img.shields.io/github/contributors/dansoppelsa/laravel-carbon-macros) 4 | 5 | A handy collection of international `Illuminate\Support\Carbon` date helpers 6 | 7 | ## Available Methods 8 | 9 | ### Multi-National Dates 10 | - isNewYearsDay 11 | - isGoodFriday 12 | - isEasterSunday 13 | - isAllSaintsDay 14 | - isChristmasDay 15 | - isNewYearsEve 16 | 17 | ### US Dates 🇺🇸 18 | 19 | - isMlkJrDay 20 | - isPresidentsDay 21 | - isMemorialDay 22 | - isIndependenceDay 23 | - isLaborDay 24 | - isColumbusDay 25 | - isVeteransDay 26 | - isAmericanThanksgiving 27 | 28 | ### Canadian Dates 🇨🇦 29 | - isFamilyDay 30 | - isVictoriaDay 31 | - isCanadaDay 32 | - isCivicHoliday 33 | - isLabourDay 34 | - isCanadianThanksgiving 35 | - isRemembranceDay 36 | - isBoxingDay 37 | 38 | ### Other Dates 39 | 40 | - [Algeria](./docs/algeria.md) 🇩🇿 41 | - [Brazil](./docs/brazil.md) 🇧🇷 42 | - [Egypt](./docs/egypt.md) 🇪🇬 43 | - [France](docs/france.md) 🇫🇷 44 | - [Germany](./docs/germany.md) 🇩🇪 45 | - [India](./docs/india.md) 🇮🇳 46 | - [Indonesia](./docs/indonesia.md) 🇮🇩 47 | - [Italy](./docs/italy.md) 🇮🇹 48 | - [Kenya](./docs/kenya.md) 🇰🇪 49 | - [Netherlands](./docs/netherlands.md) 🇳🇱 50 | - [Sweden](./docs/sweden.md) 🇸🇪 51 | - [Ukraine](./docs/ukraine.md) 🇺🇦 52 | - [Zambia](./docs/zambia.md) 🇿🇲 53 | 54 | ## Installation 55 | #### Install via composer 56 | ``` 57 | composer require dansoppelsa/laravel-carbon-macros 58 | ``` 59 | 60 | ## Usage 61 | ```php 62 | isChristmasDay(); 70 | // true 71 | 72 | $day->isCanadaDay(); 73 | // false 74 | 75 | $day->isNewYearsDay(); 76 | // false 77 | ``` 78 | 79 | ![](./lcm-autocomplete.gif) 80 | -------------------------------------------------------------------------------- /src/CarbonMacrosServiceProvider.php: -------------------------------------------------------------------------------- 1 | registerMultinationalDates(); 50 | 51 | $this->registerAlgerianDates(); 52 | 53 | $this->registerBrazilianDates(); 54 | 55 | $this->registerCanadianDates(); 56 | 57 | $this->registerDutchDates(); 58 | 59 | $this->registerEgyptianDates(); 60 | 61 | $this->registerFrenchDates(); 62 | 63 | $this->registerGermanDates(); 64 | 65 | $this->registerIndianDates(); 66 | 67 | $this->registerIndonesianDates(); 68 | 69 | $this->registerItalianDates(); 70 | 71 | $this->registerKenyanDates(); 72 | 73 | $this->registerSwedishDates(); 74 | 75 | $this->registerUsDates(); 76 | 77 | $this->registerUkrainianDates(); 78 | 79 | $this->registerZambianDates(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Traits/AlgerianDates.php: -------------------------------------------------------------------------------- 1 | year < 1962) { 20 | return false; 21 | } 22 | return $this->month === 7 && $this->day === 5; 23 | }); 24 | 25 | Carbon::macro('isAlgerianRevolutionDay', function () { 26 | // It is celebrated on November 1st and commemorates the start of the war of independence against France 27 | 28 | if ($this->year < 1954) { 29 | return false; 30 | } 31 | return $this->month === 11 && $this->day === 1; 32 | }); 33 | 34 | Carbon::macro('isAlgerianLaborDay', function () { 35 | // Algeria also celebrates Labor's day as well as other contries around the world on May 1st of each year. 36 | return $this->month === 5 && $this->day === 1; 37 | }); 38 | 39 | Carbon::macro('isAmazighNewYear', function () { 40 | // The Amazigh New Year or Yennayer is a public holiday in Algeria on January 12th. 41 | // It marks the start of the Berber (Amazigh) New Year. 42 | // https://en.wikipedia.org/wiki/Yennayer 43 | // https://www.middleeasteye.net/discover/what-you-need-know-about-amazigh-new-year-or-yennayer 44 | 45 | return $this->month === 1 && $this->day === 12; 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Traits/BrazilianDates.php: -------------------------------------------------------------------------------- 1 | month === 4 && $this->day === 21; 17 | }); 18 | 19 | Carbon::macro('isBrazilianLaborDay', function () { 20 | // The brazilian labor day differs from the Canadian one. In Brazil, labor day is celebrated on May 1st. 21 | 22 | return $this->month === 5 && $this->day === 1; 23 | }); 24 | 25 | Carbon::macro('isBrazilianIndependenceDay', function () { 26 | // The Brazilian Independence was declared on September 7th 1822. 27 | 28 | return $this->month === 9 && $this->day === 7; 29 | }); 30 | 31 | Carbon::macro('isTheDayOfOurLadyAparecida', function () { 32 | // The day of Our Lady Aparecida is observed every 12th of October celebrating the Patroness of Brazil, 33 | // the Virgin Mary (Our Lady Aparecida) 34 | 35 | return $this->month === 10 && $this->day === 12; 36 | }); 37 | 38 | Carbon::macro('isBrazilianDayOfTheDead', function () { 39 | // Day of the Dead is celebrated annually on November 2. In Brazil, this date is a national holiday, instituted by Law No. 10,607, of December 19, 2002. 40 | return $this->month = 11 && $this->day === 2; 41 | }); 42 | 43 | Carbon::macro('isBrazilianRepublicProclamationDay', function () { 44 | // This celebrates the day Brazil changed from being an Empire to a Republic, which was on November 15, 1889. 45 | 46 | return $this->month = 11 && $this->day === 15; 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Traits/CanadianDates.php: -------------------------------------------------------------------------------- 1 | month !== 5) { 13 | return false; 14 | } 15 | 16 | if ($this->day >= 25) { 17 | return false; 18 | } 19 | 20 | return $this->clone()->setDay(25)->previous(Carbon::MONDAY)->day == $this->day; 21 | }); 22 | 23 | Carbon::macro('isCanadaDay', function () { 24 | return $this->month === 7 && $this->day === 1; 25 | }); 26 | 27 | Carbon::macro('isLabourDay', function () { 28 | // Labour Day was first observed in Canada in 1894 29 | // https://www.timeanddate.com/holidays/canada/labour-day 30 | // https://en.wikipedia.org/wiki/Labour_Day 31 | if ($this->year < 1894) { 32 | return false; 33 | } 34 | 35 | return $this->month === 9 && 36 | $this->clone()->firstOfMonth(static::MONDAY)->day === $this->day; 37 | }); 38 | 39 | Carbon::macro('isCanadianThanksgiving', function () { 40 | if ($this->year < 1957) { 41 | return false; 42 | } 43 | 44 | // Second Monday in October 45 | // https://www.statutoryholidays.com/ 46 | // https://en.wikipedia.org/wiki/Thanksgiving_(Canada) 47 | return $this->month === 10 && 48 | $this->clone()->firstOfMonth(Carbon::MONDAY)->addWeek()->day === $this->day; 49 | }); 50 | 51 | Carbon::macro('isRemembranceDay', function () { 52 | // Remembrance Day was first observed officially in Canada in 1931 53 | // https://en.wikipedia.org/wiki/Remembrance_Day 54 | if ($this->year < 1931) { 55 | return false; 56 | } 57 | 58 | return $this->month === 11 && $this->day === 11; 59 | }); 60 | 61 | Carbon::macro('isBoxingDay', function () { 62 | return $this->month === 12 && $this->day === 26; 63 | }); 64 | 65 | Carbon::macro('isCivicHoliday', function () { 66 | if ($this->month !== 8) { 67 | return false; 68 | } 69 | 70 | return $this->clone()->firstOfMonth(static::MONDAY)->day === $this->day; 71 | }); 72 | 73 | Carbon::macro('isFamilyDay', function () { 74 | // Family Day was first observed anywhere in Canada in 1990 in Alberta 75 | // https://en.wikipedia.org/wiki/Family_Day_(Canada) 76 | if ($this->year < 1990) { 77 | return false; 78 | } 79 | 80 | if ($this->month !== 2) { 81 | return false; 82 | } 83 | 84 | // Third Monday in February 85 | return $this->clone()->nthOfMonth(3, static::MONDAY)->day === $this->day; 86 | }); 87 | } 88 | } -------------------------------------------------------------------------------- /src/Traits/DutchDates.php: -------------------------------------------------------------------------------- 1 | year < 1945) { 15 | return false; 16 | } 17 | 18 | return $this->month === 5 && $this->day === 5; 19 | }); 20 | 21 | Carbon::macro('isSaintNicholasEve', function () { 22 | // Called "Sinterklaas" in Dutch 23 | // https://en.wikipedia.org/wiki/Sinterklaas 24 | return $this->month === 12 && $this->day === 5; 25 | }); 26 | 27 | Carbon::macro('isDutchRemembranceDay', function () { 28 | // https://en.wikipedia.org/wiki/Remembrance_of_the_Dead 29 | if ($this->year < 1945) { 30 | return false; 31 | } 32 | 33 | return $this->month === 5 && $this->day === 4; 34 | }); 35 | 36 | Carbon::macro('isDutchNationalDay', function () { 37 | // Called "Koningsdag" of "Koninginnedag" in Dutch 38 | // since 2014 celebrated on April 27th. If the 39 | // day is on Sunday, we celebrate a day before. 40 | // https://en.wikipedia.org/wiki/Koningsdag 41 | if ($this->year < 1949) { 42 | return false; 43 | } 44 | 45 | if ($this->year < 2014) { 46 | return $this->month === 4 && $this->day === 30; 47 | } 48 | 49 | if ($this->dayOfWeek === Carbon::SUNDAY) { 50 | return false; 51 | } 52 | 53 | if ($this->month === 4 && $this->day === 26) { 54 | return $this->dayOfWeek === Carbon::SATURDAY; 55 | } 56 | 57 | return $this->month === 4 && $this->day === 27; 58 | }); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Traits/EgyptianDates.php: -------------------------------------------------------------------------------- 1 | month === 1 && $this->day === 7; 21 | }); 22 | 23 | Carbon::macro('isEgyptian2011RevolutionDay', function () { 24 | /** @var Carbon $this */ 25 | 26 | // Celebrates the day of the beginning of the 27 | // Egyptian revolution of 2011, protesting 28 | // the 29-year rule of Hosni Mubarak. 29 | if ($this->year < 2011) { 30 | return false; 31 | } 32 | 33 | return $this->month === 1 && $this->day === 25; 34 | }); 35 | 36 | // 2011 Revloution days is the same as National Police Day 37 | Carbon::macro('isEgyptianNationalPoliceDay', function () { 38 | /** @var Carbon $this */ 39 | 40 | // Celebrates the anniversary of Police officers 41 | // resistance against the British Army in 1952 42 | // during the final months of the colonial era. 43 | if ($this->year < 1952) { 44 | return false; 45 | } 46 | 47 | return $this->month === 1 && $this->day === 25; 48 | }); 49 | 50 | 51 | Carbon::macro('isEgyptianSinaLiberationDay', function () { 52 | /** @var Carbon $this */ 53 | 54 | // Celebrates the final withdrawal of all Israeli military 55 | // forces from the Sinai Peninsula in 1982. 56 | if ($this->year < 1982) { 57 | return false; 58 | } 59 | 60 | return $this->month === 4 && $this->day === 25; 61 | }); 62 | 63 | 64 | Carbon::macro('isEgyptianLabourDay', function () { 65 | /** @var Carbon $this */ 66 | 67 | return $this->month === 5 && $this->day === 1; 68 | }); 69 | 70 | 71 | Carbon::macro('isEgyptian30JuneRevolutionDay', function () { 72 | /** @var Carbon $this */ 73 | 74 | // Observes the June 2013 Egyptian protests, 75 | // which saw President Mohamed Morsi deposed 76 | // by the military a few days later. 77 | 78 | if ($this->year < 2013) { 79 | return false; 80 | } 81 | return $this->month === 6 && $this->day === 30; 82 | }); 83 | 84 | 85 | Carbon::macro('isEgyptian23JulyRevolutionDay', function () { 86 | /** @var Carbon $this */ 87 | 88 | // Celebrates the Egyptian Revolution of 1952 which led 89 | // to the declaration of the modern republic of Egypt. 90 | // This is considered the National Day of Egypt. 91 | if ($this->year < 1952) { 92 | return false; 93 | } 94 | return $this->month === 7 && $this->day === 23; 95 | }); 96 | 97 | 98 | Carbon::macro('isEgyptian6OctoberVictoryDay', function () { 99 | /** @var Carbon $this */ 100 | 101 | // Celebrates Egypt's initial military success in the 102 | // October War which led to the liberation of the land of 103 | // Sinai from occupation back to Egyptian sovereignty. 104 | if ($this->year < 1973) { 105 | return false; 106 | } 107 | return $this->month === 10 && $this->day === 6; 108 | }); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/Traits/FrenchDates.php: -------------------------------------------------------------------------------- 1 | clone() 18 | ->subDays(39) 19 | ->isEasterSunday(); 20 | }); 21 | 22 | Carbon::macro('isAssumptionDay', function () { 23 | // Called "Assomption" in french 24 | // https://en.wikipedia.org/wiki/Assumption_of_Mary 25 | return $this->month === 8 && $this->day === 15; 26 | }); 27 | 28 | Carbon::macro('isEasterMonday', function () { 29 | // Called "Lundi de pâques" in french 30 | // https://en.wikipedia.org/wiki/Easter_Monday 31 | return $this->clone() 32 | ->subDays(1) 33 | ->isEasterSunday(); 34 | }); 35 | 36 | Carbon::macro('isFirstWarArmisticeDay', function () { 37 | // https://en.wikipedia.org/wiki/Armistice_Day 38 | if ($this->year < 1918) { 39 | return false; 40 | } 41 | 42 | return $this->month === 11 && $this->day === 11; 43 | 44 | }); 45 | 46 | Carbon::macro('isFrenchNationalDay', function () { 47 | // https://fr.wikipedia.org/wiki/F%C3%AAte_nationale_fran%C3%A7aise 48 | if ($this->year < 1880) { 49 | return false; 50 | } 51 | 52 | return $this->month === 07 && $this->day === 14; 53 | }); 54 | 55 | Carbon::macro('isPentecostDay', function () { 56 | // Called "Pentecôte" in french 57 | // https://en.wikipedia.org/wiki/Pentecost 58 | return $this->clone() 59 | ->subDays(49) 60 | ->isEasterSunday(); 61 | }); 62 | 63 | Carbon::macro('isSecondWarArmisticeDay', function () { 64 | // https://en.wikipedia.org/wiki/Victory_in_Europe_Day 65 | if ($this->year < 1945) { 66 | return false; 67 | } 68 | 69 | return $this->month === 5 && $this->day === 8; 70 | 71 | }); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Traits/GermanDates.php: -------------------------------------------------------------------------------- 1 | month === 5 && $this->day === 1; 18 | }); 19 | 20 | Carbon::macro('isAscensionOfJesus', function () { 21 | /* 22 | * Ascension Day, in the Christian faith, signifies the return 23 | * of Jesus Christ as the Son of God to His Father in heaven. 24 | * Ascension Day is celebrated on the 40th day of the Easter 25 | * season, 39 days after Easter Sunday. Therefore, the feast 26 | * always falls on a Thursday. 27 | * https://en.wikipedia.org/wiki/Public_holidays_in_Germany 28 | */ 29 | return $this->clone() 30 | ->subDays(39) 31 | ->isEasterSunday(); 32 | }); 33 | 34 | Carbon::macro('isWhitSunday', function () { 35 | /* 36 | * The Christian holiday of Pentecost or Whitsunday is celebrated 37 | * the 50th day (the seventh Sunday) from Easter Sunday. 38 | * https://en.wikipedia.org/wiki/Public_holidays_in_Germany 39 | */ 40 | return $this->clone() 41 | ->subDays(49) 42 | ->isEasterSunday(); 43 | }); 44 | 45 | Carbon::macro('isWhitsun', function () { 46 | return $this->isWhitSunday(); 47 | }); 48 | 49 | Carbon::macro('isPentecost', function () { 50 | return $this->isWhitSunday(); 51 | }); 52 | 53 | Carbon::macro('isPentecostSunday', function () { 54 | return $this->isWhitSunday(); 55 | }); 56 | 57 | Carbon::macro('isWhitMonday', function () { 58 | /* 59 | * Whit Monday is the holiday celebrated the day after Pentecost. 60 | * https://en.wikipedia.org/wiki/Public_holidays_in_Germany 61 | */ 62 | return $this->clone() 63 | ->subDays(1) 64 | ->isWhitSunday(); 65 | }); 66 | 67 | Carbon::macro('isPentecostMonday', function () { 68 | return $this->isWhitMonday(); 69 | }); 70 | 71 | Carbon::macro('isCorpusChristi', function () { 72 | /* 73 | * In Germany, Corpus Christi is a public holiday in some states. 74 | * It takes place 60 days after Easter Sunday. 75 | * https://en.wikipedia.org/wiki/Public_holidays_in_Germany 76 | */ 77 | return $this->clone() 78 | ->subDays(60) 79 | ->isEasterSunday(); 80 | }); 81 | 82 | Carbon::macro('isGermanUnityDay', function () { 83 | /* 84 | * German Unity Day (German: Tag der Deutschen Einheit) is the 85 | * National Day in Germany, celebrated on 3 October as a public holiday. 86 | * It commemorates German reunification in 1990 when the Federal Republic 87 | * of Germany (West Germany) and the German Democratic Republic 88 | * (East Germany) were unified, so that for the first time since 1945 89 | * there existed a single German state. German Unity Day on 3 October 90 | * has been the German National Holiday since 1990, when the 91 | * reunification was formally completed. 92 | * https://en.wikipedia.org/wiki/Public_holidays_in_Germany 93 | */ 94 | if ($this->year < 1990) { 95 | return false; 96 | } 97 | 98 | return $this->month === 10 && $this->day === 3; 99 | }); 100 | 101 | Carbon::macro('isHeiligerAbend', function () { 102 | /* 103 | * Germans celebrate Christmas Eve (German: Heiliger Abend, Heiligabend), 104 | * Christmas Day is just another holiday. 105 | */ 106 | return $this->isChristmasEve(); 107 | }); 108 | 109 | Carbon::macro('isHeiligAbend', function () { 110 | return $this->isHeiligerAbend(); 111 | }); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/Traits/IndianDates.php: -------------------------------------------------------------------------------- 1 | year < 1950) { 16 | return false; 17 | } 18 | return $this->month === 1 && $this->day === 26; 19 | }); 20 | 21 | Carbon::macro('isIndianIndependenceDay', function () { 22 | // https://en.wikipedia.org/wiki/Public_holidays_in_India 23 | 24 | if ($this->year < 1947) { 25 | return false; 26 | } 27 | return $this->month === 8 && $this->day === 15; 28 | }); 29 | 30 | Carbon::macro('isGandhiJayanti', function () { 31 | // https://en.wikipedia.org/wiki/Public_holidays_in_India 32 | 33 | if ($this->year < 1869) { 34 | return false; 35 | } 36 | return $this->month === 10 && $this->day === 2; 37 | }); 38 | 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /src/Traits/IndonesianDates.php: -------------------------------------------------------------------------------- 1 | month === 8 && $this->day === 17; 14 | }); 15 | 16 | Carbon::macro('isPancasilaDay', function () { 17 | // https://www.officeholidays.com/holidays/indonesia/pancasila-day 18 | return $this->month === 6 && $this->day === 1; 19 | }); 20 | 21 | Carbon::macro('isIndonesianLaborDay', function () { 22 | // https://www.timeanddate.com/holidays/indonesia/labor-day 23 | return $this->month === 5 && $this->day === 1; 24 | }); 25 | 26 | Carbon::macro('isKartiniDay', function () { 27 | // https://en.wikipedia.org/wiki/Kartini#Kartini_Day 28 | return $this->month === 4 && $this->day === 21; 29 | }); 30 | 31 | Carbon::macro('isIndonesianEducationDay', function () { 32 | // https://en.wikipedia.org/wiki/Indonesia_National_Education_Day 33 | return $this->month === 5 && $this->day === 2; 34 | }); 35 | 36 | Carbon::macro('isIndonesiaCustomerDay', function () { 37 | // https://www.kompas.com/tren/read/2020/09/04/121402665/sejarah-di-balik-penetapan-4-september-jadi-hari-pelanggan-nasional 38 | if ($this->year < 2003) { 39 | return false; 40 | } 41 | 42 | return $this->month === 9 && $this->day === 4; 43 | }); 44 | 45 | Carbon::macro('isIndonesianHeroesDay', function () { 46 | // https://en.wikipedia.org/wiki/Heroes%27_Day#Indonesia 47 | return $this->month === 11 && $this->day === 10; 48 | }); 49 | 50 | Carbon::macro('isIndonesianMothersDay', function () { 51 | // https://publicholidays.co.id/mothers-day/ 52 | return $this->month === 12 && $this->day === 22; 53 | }); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Traits/ItalianDates.php: -------------------------------------------------------------------------------- 1 | year < 1946) { 17 | return false; 18 | } 19 | 20 | return $this->month === 4 && $this->day === 25; 21 | }); 22 | 23 | Carbon::macro('isRepublicDay', function () { 24 | // Republic Day is the Italian National Day and Republic Day, which is celebrated on 2 June each year 25 | // The day commemorates the institutional referendum held by universal suffrage in 1946, 26 | // in which the Italian people were called to the polls to decide on the form of government 27 | // following the Second World War and the fall of Fascism. 28 | // https://en.wikipedia.org/wiki/Festa_della_Repubblica 29 | 30 | if ($this->year < 1946) { 31 | return false; 32 | } 33 | 34 | return $this->month === 6 && $this->day === 2; 35 | }); 36 | 37 | Carbon::macro('isImmaculateConceptionFeast', function () { 38 | // The feast day of the Immaculate Conception is December 8. 39 | // By Pontifical decree, it is the patronal feast day of America, Argentina, Brazil, Italy, Korea, 40 | // Nicaragua, Paraguay, the Philippines, Spain and Uruguay. 41 | // https://en.wikipedia.org/wiki/Feast_of_the_Immaculate_Conception 42 | 43 | return $this->month === 12 && $this->day === 8; 44 | }); 45 | 46 | Carbon::macro('isAssumptionOfMaryFeast', function () { 47 | // Assumption Day on 15 August is a nationwide public holiday in Andorra, Austria, Belgium, [...], Italy 48 | // https://en.wikipedia.org/wiki/Assumption_of_Mary#Public_holidays 49 | 50 | return $this->month === 8 && $this->day === 15; 51 | }); 52 | 53 | Carbon::macro('isEpiphany', function () { 54 | // In Italy, Epiphany is a national holiday and is associated with the figure of the Befana 55 | // (the name being a corruption of the word Epifania) 56 | // https://en.wikipedia.org/wiki/Epiphany_(holiday)#Italy 57 | 58 | return $this->month === 1 && $this->day === 6; 59 | }); 60 | 61 | Carbon::macro('isSaintStephenDay', function () { 62 | // Saint Stephen's Day, also called the Feast of Saint Stephen, is a Christian saint's day 63 | // to commemorate Saint Stephen, the first Christian martyr, celebrated on 26 December 64 | // https://en.wikipedia.org/wiki/Saint_Stephen%27s_Day 65 | 66 | return $this->month === 12 && $this->day === 26; 67 | }); 68 | 69 | Carbon::macro('isSaintSylvesterDay', function () { 70 | // In Italy, New Year's Eve (Italian: Vigilia di Capodanno or Notte di San Silvestro) 71 | // is celebrated by the observation of traditional rituals, such as wearing red underwear. 72 | // https://en.wikipedia.org/wiki/New_Year%27s_Eve#Italy 73 | 74 | return $this->month === 12 && $this->day === 31; 75 | }); 76 | 77 | Carbon::macro('isWorkersDay', function () { 78 | // The first May Day celebration in Italy took place in 1890 79 | // It was abolished under the Fascist regime and immediately restored after the Second World War. 80 | // (During the fascist period, a "Holiday of the Italian Labour" was celebrated on 21 April) 81 | // https://en.wikipedia.org/wiki/International_Workers%27_Day#Europe 82 | // More precisely from 1924 to 1945 (source: https://it.wikipedia.org/wiki/Festa_dei_lavoratori#Durante_il_Fascismo) 83 | 84 | if ($this->year < 1890) { 85 | return false; 86 | } 87 | 88 | if (in_array($this->year, range(1924, 1945))) { 89 | return $this->month === 4 && $this->day === 21; 90 | } 91 | 92 | return $this->month === 5 && $this->day === 1; 93 | 94 | 95 | }); 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/Traits/KenyanDates.php: -------------------------------------------------------------------------------- 1 | year < 1963) { 15 | return false; 16 | } 17 | 18 | return $this->month === 12 && $this->day === 12; 19 | }); 20 | 21 | Carbon::macro('isKenyanJamhuriDay', function () { 22 | // This is the local name for Independence Day 23 | return $this->isKenyanIndependenceDay(); 24 | }); 25 | 26 | Carbon::macro('isKenyanLabourDay', function () { 27 | // International Workers' Day, also known as Labour Day in most countries 28 | // and often referred to as May Day, is a celebration of labourers and the working classes 29 | // that is promoted by the international labour movement and occurs every year on May Day. 30 | // https://www.officeholidays.com/holidays/kenya/labour-day 31 | return $this->month === 5 && $this->day === 1; 32 | }); 33 | 34 | Carbon::macro('isKenyanMadarakaDay', function () { 35 | // It commemorates the day in 1963 that Kenya attained internal self rule 36 | // after being a British colony since 1920. It is celebrated on every 1st of June 37 | // https://en.wikipedia.org/wiki/Madaraka_Day 38 | if ($this->year < 1920) { 39 | return false; 40 | } 41 | 42 | return $this->month === 6 && $this->day === 1; 43 | }); 44 | 45 | Carbon::macro('isKenyanHudumaDay', function () { 46 | // Formerly known as Moi Day, it is a public holiday in Kenya celebrated every 10th of October. 47 | // https://www.officeholidays.com/holidays/kenya/moi-day 48 | return $this->month === 10 && $this->day === 10; 49 | }); 50 | 51 | Carbon::macro('isKenyanMashujaaDay', function () { 52 | // Heroes' Day or National Heroes' Day may refer to a number of commemorations of national heroes 53 | // in different countries. It is often held on the birthday of a national hero or heroine, 54 | // or the anniversary of their great deeds that made them heroes. 55 | // It is celebrated on every 20th of October. 56 | // https://www.officeholidays.com/holidays/kenya/mashujaa-day 57 | return $this->month === 10 && $this->day === 20; 58 | }); 59 | 60 | Carbon::macro('isKenyanUtamaduniDay', function () { 61 | // Also internationally know as Boxing Day. It is celebrated every year after the Christmas day. 62 | // https://www.officeholidays.com/holidays/kenya/boxing-day 63 | return $this->isBoxingDay(); 64 | }); 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Traits/MultiNationalDates.php: -------------------------------------------------------------------------------- 1 | month === 1 && $this->day === 1; 13 | }); 14 | 15 | Carbon::macro('isEasterSunday', function () { 16 | return $this->clone() 17 | ->setMonth(3) 18 | ->setDay(21) 19 | ->eq($this->clone()->subDays(easter_days($this->year))); 20 | }); 21 | 22 | Carbon::macro('isGoodFriday', function () { 23 | return $this->clone() 24 | ->addDays(2) 25 | ->isEasterSunday(); 26 | }); 27 | 28 | Carbon::macro('isAllSaintsDay', function () { 29 | // All Saints' Day is a Christian solemnity celebrated in honour of all the saints, known and unknown. 30 | // Its intent is to celebrate all the saints, including those who do not celebrated individually. 31 | // https://en.wikipedia.org/wiki/All_Saints%27_Day 32 | 33 | return $this->month === 11 && $this->day === 1; 34 | }); 35 | 36 | Carbon::macro('isChristmasDay', function () { 37 | return $this->month === 12 && $this->day === 25; 38 | }); 39 | 40 | Carbon::macro('isNewYearsEve', function () { 41 | return $this->month === 12 && $this->day === 31; 42 | }); 43 | } 44 | } -------------------------------------------------------------------------------- /src/Traits/SwedishDates.php: -------------------------------------------------------------------------------- 1 | month === 6 && 14 | $this->weekday() === Carbon::SATURDAY && 15 | ($this->day >= 20 && $this->day <= 26); 16 | }); 17 | 18 | Carbon::macro('isChristmasEve', function () { 19 | // Swedes celebrate Christmas Eve, Christmas Day is just another holiday. 20 | return $this->month === 12 && $this->day === 24; 21 | }); 22 | 23 | Carbon::macro('isSwedishNationalDay', function () { 24 | // Previously knows as Swedish Flag Day before 1983. 25 | return $this->month === 6 && $this->day === 6; 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Traits/UkrainianDates.php: -------------------------------------------------------------------------------- 1 | year < 1991) { 13 | return false; 14 | } 15 | 16 | return $this->month === 8 && $this->day === 24; 17 | }); 18 | 19 | Carbon::macro('isUkraineDefenderDay', function () { 20 | // Defender of Ukraine Day is a state holiday in Ukraine celebrated annually on 14 October. 21 | // Its first celebration was in 2015. Starting from 2015, this day is considered a public holiday. 22 | 23 | if ($this->year < 2015) { 24 | return false; 25 | } 26 | 27 | return $this->month === 10 && $this->day === 14; 28 | }); 29 | 30 | Carbon::macro('isUkrainianConstitutionDay', function () { 31 | // It commemorates the anniversary of the approval by the Verkhovna Rada of the Constitution 32 | // of Ukraine on 28 June 1996. 33 | 34 | if ($this->year < 1996) { 35 | return false; 36 | } 37 | 38 | return $this->month === 6 && $this->day === 28; 39 | }); 40 | 41 | Carbon::macro('isUkrainianLabourDay', function () { 42 | return $this->month === 5 && $this->day === 1; 43 | }); 44 | 45 | Carbon::macro('isKupalaNight', function () { 46 | // The celebration relates to the summer solstice when nights are the shortest and includes 47 | // a number of Slavic rituals. In Eastern Slavic countries it is celebrated according to traditional 48 | // Julian calendar on the night between 6 to 7 July. 49 | 50 | return $this->month === 7 && ($this->day === 6 || $this->day === 7); 51 | }); 52 | 53 | Carbon::macro('isVictoryDayOverNazism', function () { 54 | // Victory Day over Nazism in World War II or Victory Day is a national holiday and a day off in Ukraine. 55 | // It was first celebrated on 9 May 2015 and follows the Day of Remembrance and Reconciliation on May 8 56 | // The holiday replaced the Soviet Union/Russian Federation "Victory Day", which was celebrated in the 57 | // post-Soviet Union states, including Ukraine, until 2014 inclusive. 58 | 59 | if ($this->year < 2015) { 60 | return false; 61 | } 62 | 63 | return $this->month === 5 && $this->day === 9; 64 | }); 65 | } 66 | } -------------------------------------------------------------------------------- /src/Traits/UsDates.php: -------------------------------------------------------------------------------- 1 | year < 1986) { 15 | return false; 16 | } 17 | 18 | if ($this->month !== 1) { 19 | return false; 20 | } 21 | 22 | // Third Monday in January 23 | return $this->clone()->nthOfMonth(3, static::MONDAY)->day === $this->day; 24 | }); 25 | 26 | Carbon::macro('isIndependenceDay', function () { 27 | // Independence Day was first recognized in Massachusetts in 1781 28 | // https://en.wikipedia.org/wiki/Independence_Day_(United_States) 29 | if ($this->year < 1781) { 30 | return false; 31 | } 32 | 33 | return $this->month === 7 && $this->day === 4; 34 | }); 35 | 36 | Carbon::macro('isMemorialDay', function () { 37 | // Memorial Day was first observed in 1874 38 | // https://en.wikipedia.org/wiki/Memorial_Day 39 | if ($this->year < 1874) { 40 | return false; 41 | } 42 | 43 | if ($this->month !== 5) { 44 | return false; 45 | } 46 | 47 | return $this->clone()->lastOfMonth(static::MONDAY)->day === $this->day; 48 | }); 49 | 50 | Carbon::macro('isLaborDay', function () { 51 | return $this->isLabourDay(); 52 | }); 53 | 54 | Carbon::macro('isVeteransDay', function () { 55 | // Veterans Day was first celebrated in 1954 56 | // https://en.wikipedia.org/wiki/Veterans_Day 57 | if ($this->year < 1954) { 58 | return false; 59 | } 60 | 61 | return $this->month === 11 && $this->day === 11; 62 | }); 63 | 64 | Carbon::macro('isAmericanThanksgiving', function () { 65 | // US Thanksgiving is believed to have first been celebrated in 1621 66 | // https://en.wikipedia.org/wiki/Thanksgiving_(United_States) 67 | if ($this->year < 1789) { 68 | return false; 69 | } 70 | 71 | return $this->clone()->nthOfMonth(4, static::THURSDAY)->day === $this->day; 72 | }); 73 | 74 | Carbon::macro('isPresidentsDay', function () { 75 | // Presidents Day was first celebrated in 1880 76 | // https://www.timeanddate.com/holidays/us/washington-birthday 77 | if ($this->year < 1880) { 78 | return false; 79 | } 80 | 81 | if ($this->month !== 2) { 82 | return false; 83 | } 84 | 85 | return $this->clone()->nthOfMonth(3, static::MONDAY)->day === $this->day; 86 | }); 87 | 88 | Carbon::macro('isColumbusDay', function () { 89 | // Columbus Day was first celebrated in 1868 90 | // https://www.timeanddate.com/holidays/us/columbus-day 91 | if ($this->year < 1869) { 92 | return false; 93 | } 94 | 95 | return $this->clone()->nthOfMonth(2, static::MONDAY)->day === $this->day; 96 | }); 97 | } 98 | } -------------------------------------------------------------------------------- /src/Traits/ZambianDates.php: -------------------------------------------------------------------------------- 1 | year < 1964) { 15 | return false; 16 | } 17 | 18 | return $this->month === 10 && $this->day === 24; 19 | }); 20 | 21 | Carbon::macro('isZambianLabourDay', function () { 22 | // International Workers' Day, also known as Labour Day in most countries 23 | // and often referred to as May Day, is a celebration of labourers and the working classes 24 | // that is promoted by the international labour movement and occurs every year on May Day. 25 | // https://www.officeholidays.com/holidays/zambia/labour-day 26 | return $this->month === 5 && $this->day === 1; 27 | }); 28 | 29 | Carbon::macro('isZambianYouthDay', function () { 30 | // This holiday highlights the importance of the youth to the country 31 | // on the anniversary of disturbances in 1962 that resulted in the deaths 32 | // of young Zambians during the nation's turbulent journey to independence. 33 | // https://www.officeholidays.com/holidays/zambia/zambia-youth-day 34 | if ($this->year < 1966) { 35 | return false; 36 | } 37 | 38 | return $this->month === 3 && $this->day === 12; 39 | }); 40 | 41 | Carbon::macro('isZambianWomensDay', function () { 42 | // International Women's Day is celebrated on March 8th. 43 | // https://www.officeholidays.com/holidays/zambia/international-womens-day 44 | if ($this->year < 1977 || $this->month !== 3 || $this->isWeekend()) { 45 | return false; 46 | } 47 | 48 | return $this->day === 8 || ($this->isMonday() && in_array($this->day, [9, 10])); 49 | }); 50 | 51 | Carbon::macro('isZambianAfricanUnityDay', function () { 52 | // African Unity Day, also known as Africa day is celebrated annually on May 25th. 53 | // It commemorates the founding of the Organisation of African Unity (OAU) on this day in 1963. 54 | // https://www.officeholidays.com/holidays/zambia/african-unity-day 55 | if ($this->year < 1963) { 56 | return false; 57 | } 58 | 59 | return $this->month === 5 && $this->day === 25; 60 | }); 61 | 62 | Carbon::macro('isZambianAfricaDay', function () { 63 | // This is the alternative name for Africa Unity Day 64 | return $this->isZambianAfricanUnityDay(); 65 | }); 66 | 67 | Carbon::macro('isZambianHeroesDay', function () { 68 | // This day remembers those Zambians who perished during Zambia's long struggle for independence. 69 | // The day always forms part of a two-day break as Heroes' Day is immediately followed by Unity Day. 70 | // https://www.officeholidays.com/holidays/zambia/zambia-heroes-day 71 | if ($this->year < 1964) { 72 | return false; 73 | } 74 | 75 | if ($this->month !== 7) { 76 | return false; 77 | } 78 | 79 | return $this->clone()->nthOfMonth(1, static::MONDAY)->day === $this->day; 80 | }); 81 | 82 | Carbon::macro('isZambianUnityDay', function () { 83 | // The day always forms part of a two-day break as Unity Day always take place on the day after Heroes' Day. 84 | // https://www.officeholidays.com/holidays/zambia/zambia-unity-day 85 | if ($this->year < 1964) { 86 | return false; 87 | } 88 | 89 | if ($this->month !== 7) { 90 | return false; 91 | } 92 | 93 | return $this->clone()->nthOfMonth(1, static::MONDAY)->addDay()->day === $this->day; 94 | }); 95 | 96 | Carbon::macro('isZambianFarmersDay', function () { 97 | // This is a day to celebrate the contribution and work of the agricultural sector in Zambia. 98 | // https://www.officeholidays.com/holidays/zambia/zambia-farmers-day 99 | if ($this->year < 1964) { 100 | return false; 101 | } 102 | 103 | if ($this->month !== 8) { 104 | return false; 105 | } 106 | 107 | return $this->clone()->nthOfMonth(1, static::MONDAY)->day === $this->day; 108 | }); 109 | 110 | Carbon::macro('isZambianNationalPrayerDay', function () { 111 | // This aim of this holiday is as a day for national prayer, fasting, repentance and reconciliation. 112 | // https://www.officeholidays.com/holidays/zambia/national-prayer-day 113 | if ($this->year < 2015) { 114 | return false; 115 | } 116 | 117 | if ($this->month !== 10) { 118 | return false; 119 | } 120 | 121 | return $this->month === 10 && $this->day === 18; 122 | }); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /tests/AlgerianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isAlgerianIndependenceDay()); 15 | } 16 | 17 | public function provideAlgerianIndependenceDay() 18 | { 19 | return [ 20 | '1962-07-05' => ['1962-07-05', true], 21 | '1962-07-06' => ['1962-07-06', false], 22 | '1972-07-05' => ['1972-07-05', true], 23 | '1961-07-05' => ['1961-07-05', false], 24 | '1958-07-05' => ['1958-07-05', false], 25 | '2010-07-05' => ['2010-07-05', true], 26 | '1962-10-05' => ['1962-10-05', false], 27 | '1948-08-15' => ['1948-08-15', false], 28 | '2022-07-05' => ['2022-07-05', true], 29 | ]; 30 | } 31 | 32 | /** 33 | * @dataProvider provideAlgerianRevolutionDay 34 | */ 35 | public function test_it_recognizes_algerian_revolution_day($date, $validity) 36 | { 37 | $date = Carbon::parse($date); 38 | 39 | $this->assertSame($validity, $date->isAlgerianRevolutionDay()); 40 | } 41 | 42 | public function provideAlgerianRevolutionDay() 43 | { 44 | return [ 45 | '1954-11-01' => ['1954-11-01', true], 46 | '1954-12-01' => ['1954-12-01', false], 47 | '1950-11-01' => ['1950-11-01', false], 48 | '1961-07-05' => ['1961-07-05', false], 49 | '2010-11-01' => ['2010-11-01', true], 50 | '1954-09-17' => ['1954-09-17', false], 51 | '1948-08-15' => ['1948-08-15', false], 52 | '2022-11-01' => ['2022-11-01', true], 53 | ]; 54 | } 55 | 56 | /** 57 | * @dataProvider provideAmazighNewYear 58 | */ 59 | public function test_it_recognizes_amazigh_new_year($date, $validity) 60 | { 61 | $date = Carbon::parse($date); 62 | 63 | $this->assertSame($validity, $date->isAmazighNewYear()); 64 | } 65 | 66 | public function provideAmazighNewYear() 67 | { 68 | return [ 69 | '1976-01-12' => ['1976-01-12', true], 70 | '1960-01-20' => ['1960-01-20', false], 71 | '1999-12-20' => ['1999-12-20', false], 72 | '2010-07-16' => ['2010-07-16', false], 73 | '2010-03-08' => ['2010-03-08', false], 74 | '1999-01-12' => ['1999-01-12', true], 75 | '2012-01-12' => ['2012-01-12', true], 76 | '2020-01-12' => ['2020-01-12', true], 77 | ]; 78 | } 79 | 80 | /** 81 | * @dataProvider provideAlgerianLaborDay 82 | */ 83 | public function test_it_recognizes_algerian_labor_day($date, $validity) 84 | { 85 | $date = Carbon::parse($date); 86 | 87 | $this->assertSame($validity, $date->isAlgerianLaborDay()); 88 | } 89 | 90 | public function provideAlgerianLaborDay() 91 | { 92 | return [ 93 | '1994-03-16' => ['1994-03-16', false], 94 | '1894-09-03' => ['1894-09-03', false], 95 | '1894-05-01' => ['1894-05-01', true], 96 | '2015-09-07' => ['2015-09-07', false], 97 | '2015-05-01' => ['2015-05-01', true], 98 | '2016-09-05' => ['2016-09-05', false], 99 | '2017-05-01' => ['2017-05-01', true], 100 | ]; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /tests/BrazilianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isTiradentesDay()); 15 | } 16 | 17 | public function provideTiradentesDayData() 18 | { 19 | return [ 20 | '1963-04-21' => ['1963-04-21', true], 21 | '1963-04-22' => ['1963-04-22', false], 22 | '1963-04-19' => ['1963-04-19', false], 23 | '1984-04-21' => ['1984-04-21', true], 24 | '2014-04-21' => ['2014-04-21', true], 25 | ]; 26 | } 27 | 28 | /** 29 | * @dataProvider provideBrazilianLaborDayData 30 | */ 31 | public function test_it_recognizes_brazilian_labor_day($date, $validity) 32 | { 33 | $date = Carbon::parse($date); 34 | 35 | $this->assertSame($validity, $date->isBrazilianLaborDay()); 36 | } 37 | 38 | public function provideBrazilianLaborDayData() 39 | { 40 | return [ 41 | '1994-03-16 (not labor day)' => ['1994-03-16', false], 42 | '1894-09-03 (Canadian labor day)' => ['1894-09-03', false], 43 | '1894-05-01 (Brazilian labor day)' => ['1894-05-01', true], 44 | '2015-09-07 (Canadian labor day)' => ['2015-09-07', false], 45 | '2015-05-01 (Brazilian labor day)' => ['2015-05-01', true], 46 | '2016-09-05 (Canadian labor day)' => ['2016-09-05', false], 47 | '2016-05-01 (Brazilian labor day)' => ['2016-05-01', true], 48 | ]; 49 | } 50 | 51 | /** 52 | * @dataProvider provideBrazilianIndependenceDayData 53 | */ 54 | public function test_it_recognizes_brazilian_independence_day($date, $validity) 55 | { 56 | $date = Carbon::parse($date); 57 | 58 | $this->assertSame($validity, $date->isBrazilianIndependenceDay()); 59 | } 60 | 61 | public function provideBrazilianIndependenceDayData() 62 | { 63 | return [ 64 | '1963-09-07' => ['1963-09-07', true], 65 | '1963-04-22' => ['1963-04-22', false], 66 | '1963-04-19' => ['1963-04-19', false], 67 | '1984-04-21' => ['1984-04-21', false], 68 | '2014-09-07' => ['2014-09-07', true], 69 | ]; 70 | } 71 | 72 | /** 73 | * @dataProvider provideDayOfOurLadyAparecidaData 74 | */ 75 | public function test_it_recognizes_the_day_of_Our_Lady_Aparecida($date, $validity) 76 | { 77 | $date = Carbon::parse($date); 78 | 79 | $this->assertSame($validity, $date->isTheDayOfOurLadyAparecida()); 80 | } 81 | 82 | public function provideDayOfOurLadyAparecidaData() 83 | { 84 | return [ 85 | '1963-10-12' => ['1963-10-12', true], 86 | '1999-04-22' => ['1999-04-22', false], 87 | '1974-05-19' => ['1974-05-19', false], 88 | '1984-06-21' => ['1984-06-21', false], 89 | '2014-10-12' => ['2014-10-12', true], 90 | ]; 91 | } 92 | 93 | /** 94 | * @dataProvider provideBrazilianRepublicProclamationDay 95 | */ 96 | public function test_it_recognizes_the_brazilian_republic_proclamation_day($date, $validity) 97 | { 98 | $date = Carbon::parse($date); 99 | 100 | $this->assertSame($validity, $date->isBrazilianRepublicProclamationDay()); 101 | } 102 | 103 | public function provideBrazilianRepublicProclamationDay() 104 | { 105 | return [ 106 | '1963-11-15`' => ['1963-11-15', true], 107 | '1999-04-22' => ['1999-04-22', false], 108 | '1974-05-19' => ['1974-05-19', false], 109 | '1984-06-21' => ['1984-06-21', false], 110 | '2014-11-15' => ['2014-11-15', true], 111 | ]; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /tests/CanadianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isNewYearsDay()); 15 | } 16 | 17 | public function provideNewYearsDayData() 18 | { 19 | return [ 20 | '1963-11-22' => ['1963-11-22', false], 21 | '1970-01-01' => ['1970-01-01', true], 22 | '1982-01-01' => ['1982-01-01', true], 23 | '1999-12-31' => ['1999-12-31', false], 24 | '2020-01-01' => ['2020-01-01', true], 25 | '2020-01-02' => ['2020-01-02', false], 26 | '2050-01-01' => ['2050-01-01', true], 27 | '2038-01-19' => ['2038-01-19', false], 28 | ]; 29 | } 30 | 31 | /** 32 | * @dataProvider provideEasterSundayData 33 | */ 34 | public function test_it_knows_easter_sunday($date, $validity) 35 | { 36 | $date = Carbon::parse($date); 37 | 38 | $this->assertSame($validity, $date->isEasterSunday()); 39 | } 40 | 41 | public function provideEasterSundayData() 42 | { 43 | return [ 44 | '1905-04-23' => ['1905-04-23', true], 45 | '1970-03-28' => ['1970-03-28', false], 46 | '1970-03-28' => ['1970-03-28', false], 47 | '1970-03-29' => ['1970-03-29', true], 48 | '1970-03-30' => ['1970-03-30', false], 49 | '1990-04-14' => ['1990-04-14', false], 50 | '1990-04-15' => ['1990-04-15', true], 51 | '1990-04-16' => ['1990-04-16', false], 52 | '2020-04-12' => ['2020-04-12', true], 53 | '2020-04-13' => ['2020-04-13', false], 54 | '2050-04-10' => ['2050-04-10', true], 55 | '2050-04-11' => ['2050-04-11', false], 56 | ]; 57 | } 58 | 59 | /** 60 | * @dataProvider provideGoodFridayData 61 | */ 62 | public function test_it_knows_good_friday($date, $validity) 63 | { 64 | $date = Carbon::parse($date); 65 | 66 | $this->assertSame($validity, $date->isGoodFriday()); 67 | } 68 | 69 | public function provideGoodFridayData() 70 | { 71 | return [ 72 | '1905-04-21' => ['1905-04-21', true], 73 | '1970-03-26' => ['1970-03-26', false], 74 | '1970-03-27' => ['1970-03-27', true], 75 | '1970-03-28' => ['1970-03-28', false], 76 | '1970-03-30' => ['1970-03-30', false], 77 | '1990-04-14' => ['1990-04-14', false], 78 | '1990-04-13' => ['1990-04-13', true], 79 | '1990-04-16' => ['1990-04-16', false], 80 | '2020-04-10' => ['2020-04-10', true], 81 | '2020-04-13' => ['2020-04-13', false], 82 | '2050-04-08' => ['2050-04-08', true], 83 | '2050-04-11' => ['2050-04-11', false], 84 | ]; 85 | } 86 | 87 | /** 88 | * @dataProvider provideFamilyDayData 89 | */ 90 | public function test_it_knows_family_day($date, $validity) 91 | { 92 | $date = Carbon::parse($date); 93 | 94 | $this->assertSame($validity, $date->isFamilyDay()); 95 | } 96 | 97 | public function provideFamilyDayData() 98 | { 99 | return [ 100 | '1989-02-20' => ['1989-02-20', false], 101 | '1990-02-19' => ['1990-02-19', true], 102 | '2007-02-19' => ['1990-02-19', true], 103 | '2020-02-16' => ['2020-02-16', false], 104 | '2020-02-17' => ['2020-02-17', true], 105 | '2020-02-18' => ['2020-02-18', false], 106 | '2050-02-18' => ['2020-02-18', false], 107 | ]; 108 | } 109 | 110 | /** 111 | * @dataProvider provideVictoriaDayData 112 | */ 113 | public function test_it_knows_victoria_day($date, $validity) 114 | { 115 | $date = Carbon::parse($date); 116 | 117 | $this->assertSame($validity, $date->isVictoriaDay()); 118 | } 119 | 120 | public function provideVictoriaDayData() 121 | { 122 | return [ 123 | '2018-05-20' => ['2018-05-20', false], 124 | '2018-05-21' => ['2018-05-21', true], 125 | '2018-05-22' => ['2018-05-22', false], 126 | '2019-05-19' => ['2019-05-19', false], 127 | '2019-05-20' => ['2019-05-20', true], 128 | '2019-05-21' => ['2019-05-21', false], 129 | '2020-05-17' => ['2020-05-17', false], 130 | '2020-05-18' => ['2020-05-18', true], 131 | '2020-05-19' => ['2020-05-19', false], 132 | '2021-05-23' => ['2021-05-23', false], 133 | '2021-05-24' => ['2021-05-24', true], 134 | '2021-05-25' => ['2021-05-25', false], 135 | ]; 136 | } 137 | 138 | /** 139 | * @dataProvider provideCanadaDayData 140 | */ 141 | public function test_it_knows_canada_day($date, $validity) 142 | { 143 | $date = Carbon::parse($date); 144 | 145 | $this->assertSame($validity, $date->isCanadaDay()); 146 | } 147 | 148 | public function provideCanadaDayData() 149 | { 150 | return [ 151 | '1970-06-30' => ['1970-06-30', false], 152 | '1970-07-01' => ['1970-07-01', true], 153 | '1970-07-02' => ['1970-07-02', false], 154 | '1982-06-30' => ['1982-06-30', false], 155 | '1982-07-01' => ['1982-07-01', true], 156 | '1982-07-02' => ['1982-07-02', false], 157 | '2015-07-01' => ['2015-07-01', true], 158 | '2018-07-01' => ['2018-07-01', true], 159 | '2020-07-01' => ['2020-07-01', true], 160 | ]; 161 | } 162 | 163 | /** 164 | * @dataProvider provideLabourDayData 165 | */ 166 | public function test_it_knows_labour_day($date, $validity) 167 | { 168 | $date = Carbon::parse($date); 169 | 170 | $this->assertSame($validity, $date->isLabourDay()); 171 | } 172 | 173 | public function provideLabourDayData() 174 | { 175 | return [ 176 | '1893-09-04' => ['1893-09-04', false], 177 | '1894-09-03' => ['1894-09-03', true], 178 | '2015-09-07' => ['2015-09-07', true], 179 | '2016-09-05' => ['2016-09-05', true], 180 | '2020-09-06' => ['2020-09-06', false], 181 | '2020-09-07' => ['2020-09-07', true], 182 | '2020-09-08' => ['2020-09-08', false], 183 | '2025-09-01' => ['2025-09-01', true], 184 | '2025-09-02' => ['2025-09-02', false], 185 | ]; 186 | } 187 | 188 | /** 189 | * @dataProvider provideCanadianThanksgivingData 190 | */ 191 | public function test_it_knows_canadian_thanksgiving($date, $validity) 192 | { 193 | $date = Carbon::parse($date); 194 | 195 | $this->assertSame($validity, $date->isCanadianThanksgiving()); 196 | } 197 | 198 | public function provideCanadianThanksgivingData() 199 | { 200 | return [ 201 | '1956-10-08' => ['1956-10-08', false], 202 | '1957-10-14' => ['1957-10-14', true], 203 | '2019-10-13' => ['2019-10-13', false], 204 | '2019-10-14' => ['2019-10-14', true], 205 | '2019-10-15' => ['2019-10-15', false], 206 | '2020-10-12' => ['2020-10-12', true], 207 | '2021-10-11' => ['2021-10-11', true], 208 | '2022-10-10' => ['2022-10-10', true], 209 | ]; 210 | } 211 | 212 | /** 213 | * @dataProvider provideRemembranceDayData 214 | */ 215 | public function test_it_knows_remembrance_day($date, $validity) 216 | { 217 | $date = Carbon::parse($date); 218 | 219 | $this->assertSame($validity, $date->isRemembranceDay()); 220 | } 221 | 222 | public function provideRemembranceDayData() 223 | { 224 | return [ 225 | '1900-11-11' => ['1900-11-11', false], 226 | '1930-11-11' => ['1930-11-11', false], 227 | '1931-11-11' => ['1931-11-11', true], 228 | '1950-11-11' => ['1950-11-11', true], 229 | '2020-11-10' => ['2020-11-10', false], 230 | '2020-11-11' => ['2020-11-11', true], 231 | '2020-11-12' => ['2020-11-12', false], 232 | '2050-11-11' => ['2050-11-11', true], 233 | ]; 234 | } 235 | 236 | /** 237 | * @dataProvider provideChristmasDayData 238 | */ 239 | public function test_it_knows_christmas_day($date, $validity) 240 | { 241 | $date = Carbon::parse($date); 242 | 243 | $this->assertSame($validity, $date->isChristmasDay()); 244 | } 245 | 246 | public function provideChristmasDayData() 247 | { 248 | return [ 249 | '1900-12-25' => ['1900-12-25', true], 250 | '1900-12-26' => ['1900-12-26', false], 251 | '1920-12-25' => ['1920-12-25', true], 252 | '1950-12-25' => ['1950-12-25', true], 253 | '1980-12-24' => ['1980-12-24', false], 254 | '1980-12-25' => ['1980-12-25', true], 255 | '1980-12-26' => ['1980-12-26', false], 256 | '2020-12-25' => ['2020-12-25', true], 257 | '2021-12-25' => ['2021-12-25', true], 258 | '2021-12-26' => ['2021-12-26', false], 259 | '2050-12-25' => ['2050-12-25', true], 260 | ]; 261 | } 262 | 263 | /** 264 | * @dataProvider provideBoxingDayData 265 | */ 266 | public function test_it_knows_boxing_day($date, $validity) 267 | { 268 | $date = Carbon::parse($date); 269 | 270 | $this->assertSame($validity, $date->isBoxingDay()); 271 | } 272 | 273 | public function provideBoxingDayData() 274 | { 275 | return [ 276 | '1950-12-26' => ['1950-12-26', true], 277 | '1950-12-27' => ['1950-12-27', false], 278 | '2020-12-26' => ['2020-12-26', true], 279 | '2050-12-25' => ['2050-12-25', false], 280 | '2050-12-26' => ['2050-12-26', true], 281 | ]; 282 | } 283 | 284 | /** 285 | * @dataProvider provideCivicHolidayData 286 | */ 287 | public function test_it_knows_the_canadian_civic_holiday($date, $validity) 288 | { 289 | $date = Carbon::parse($date); 290 | 291 | $this->assertSame($validity, $date->isCivicHoliday()); 292 | } 293 | 294 | public function provideCivicHolidayData() 295 | { 296 | return [ 297 | '1970-08-03' => ['1970-08-03', true], 298 | '1970-08-04' => ['1970-08-04', false], 299 | '2019-08-04' => ['2019-08-04', false], 300 | '2019-08-05' => ['2019-08-05', true], 301 | '2019-08-06' => ['2019-08-06', false], 302 | '2022-08-01' => ['2022-08-01', true], 303 | '2022-08-02' => ['2022-08-02', false], 304 | '2050-08-01' => ['2050-08-01', true], 305 | '2050-08-02' => ['2050-08-02', false], 306 | ]; 307 | } 308 | } 309 | -------------------------------------------------------------------------------- /tests/DutchHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isDutchNationalDay()); 18 | } 19 | 20 | /** 21 | * @dataProvider provideDutchRemembranceDayData 22 | */ 23 | public function test_it_recognizes_dutch_rememberance_day($date, $validity) 24 | { 25 | $date = Carbon::parse($date); 26 | 27 | $this->assertSame($validity, $date->isDutchRemembranceDay()); 28 | } 29 | 30 | /** 31 | * @dataProvider provideDutchLiberationDayData 32 | */ 33 | public function test_it_recognizes_dutch_liberation_day($date, $validity) 34 | { 35 | $date = Carbon::parse($date); 36 | 37 | $this->assertSame($validity, $date->isDutchLiberationDay()); 38 | } 39 | 40 | /** 41 | * @dataProvider provideSaintNicholasEveData 42 | */ 43 | public function test_it_recognizes_saint_nicholas_eve($date, $validity) 44 | { 45 | $date = Carbon::parse($date); 46 | 47 | $this->assertSame($validity, $date->isSaintNicholasEve()); 48 | } 49 | 50 | /** 51 | * @return array[] 52 | */ 53 | public function provideDutchNationalDayData() 54 | { 55 | return [ 56 | '1930-04-30' => ['1930-04-30', false], 57 | '1949-04-30' => ['1949-04-30', true], 58 | '2013-04-30' => ['2013-04-30', true], 59 | '2014-04-26' => ['2014-04-26', true], 60 | '2014-04-27' => ['2014-04-27', false], 61 | '2014-04-30' => ['2014-04-30', false], 62 | '2015-04-26' => ['2015-04-26', false], 63 | '2015-04-27' => ['2015-04-27', true], 64 | '2041-04-27' => ['2041-04-27', true], 65 | '2041-04-28' => ['2041-04-28', false], 66 | '2042-04-26' => ['2042-04-26', true], 67 | '2042-04-27' => ['2042-04-27', false], 68 | ]; 69 | } 70 | 71 | /** 72 | * @return array[] 73 | */ 74 | public function provideDutchRemembranceDayData() 75 | { 76 | return [ 77 | '1944-05-04' => ['1944-05-04', false], 78 | '1946-05-04' => ['1946-05-04', true], 79 | '1960-05-04' => ['1960-05-04', true], 80 | ]; 81 | } 82 | 83 | /** 84 | * @return array[] 85 | */ 86 | public function provideDutchLiberationDayData() 87 | { 88 | return [ 89 | '1944-05-05' => ['1944-05-05', false], 90 | '1946-05-05' => ['1946-05-05', true], 91 | '1960-05-05' => ['1960-05-05', true], 92 | ]; 93 | } 94 | 95 | /** 96 | * @return array[] 97 | */ 98 | public function provideSaintNicholasEveData() 99 | { 100 | return [ 101 | '2012-12-04' => ['2012-12-04', false], 102 | '2012-12-05' => ['2012-12-05', true], 103 | '2012-12-06' => ['2012-12-06', false], 104 | '2013-12-05' => ['2013-12-05', true], 105 | '2014-12-05' => ['2014-12-05', true], 106 | ]; 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /tests/EgyptianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isEgyptianChristmasDay()); 16 | } 17 | 18 | public function provideEgyptianChristmasDayData() 19 | { 20 | return [ 21 | '1900-12-25' => ['1900-12-25', false], 22 | '1900-12-26' => ['1900-12-26', false], 23 | '1920-01-07' => ['1920-01-07', true], 24 | '1950-12-25' => ['1950-12-25', false], 25 | '1980-12-24' => ['1980-12-24', false], 26 | '1980-12-25' => ['1980-12-25', false], 27 | '1980-12-26' => ['1980-12-26', false], 28 | '2014-01-07' => ['2014-01-07', true], 29 | '2021-01-01' => ['2021-01-01', false], 30 | '2021-01-08' => ['2021-01-08', false], 31 | '2050-01-07' => ['2050-01-07', true], 32 | ]; 33 | } 34 | 35 | /** 36 | * @dataProvider provideEgyptianNationalPoliceDayData 37 | */ 38 | public function test_it_knows_egyptian_national_police_day($date, $validity) 39 | { 40 | $date = Carbon::parse($date); 41 | 42 | $this->assertSame($validity, $date->isEgyptianNationalPoliceDay()); 43 | } 44 | 45 | public function provideEgyptianNationalPoliceDayData() 46 | { 47 | return [ 48 | '1900-12-25' => ['1900-12-25', false], 49 | '1900-01-25' => ['1900-01-25', false], 50 | '1920-01-07' => ['1920-01-07', false], 51 | '1950-01-25' => ['1950-01-25', false], 52 | '1952-01-25' => ['1952-01-25', true], 53 | '1980-12-24' => ['1980-12-24', false], 54 | '1980-12-25' => ['1980-12-25', false], 55 | '2011-02-25' => ['2011-02-25', false], 56 | '2014-01-25' => ['2014-01-25', true], 57 | '2021-01-01' => ['2021-01-01', false], 58 | '2021-01-08' => ['2021-01-08', false], 59 | '2050-01-25' => ['2050-01-25', true], 60 | ]; 61 | } 62 | 63 | /** 64 | * @dataProvider provideEgyptian2011RevolutionDayData 65 | */ 66 | public function test_it_knows_egyptian_2011_revolution_day($date, $validity) 67 | { 68 | $date = Carbon::parse($date); 69 | 70 | $this->assertSame($validity, $date->isEgyptian2011RevolutionDay()); 71 | } 72 | 73 | public function provideEgyptian2011RevolutionDayData() 74 | { 75 | return [ 76 | '1900-12-25' => ['1900-12-25', false], 77 | '1900-01-25' => ['1900-01-25', false], 78 | '1920-01-07' => ['1920-01-07', false], 79 | '1950-01-25' => ['1950-01-25', false], 80 | '1952-01-25' => ['1952-01-25', false], 81 | '1980-12-24' => ['1980-12-24', false], 82 | '1980-12-25' => ['1980-12-25', false], 83 | '2010-01-25' => ['2010-01-25', false], 84 | '2011-01-25' => ['2011-01-25', true], 85 | '2011-02-25' => ['2011-02-25', false], 86 | '2014-01-25' => ['2014-01-25', true], 87 | '2021-01-01' => ['2021-01-01', false], 88 | '2021-01-08' => ['2021-01-08', false], 89 | '2050-01-25' => ['2050-01-25', true], 90 | ]; 91 | } 92 | 93 | /** 94 | * @dataProvider provideEgyptianSinaLiberationDayData 95 | */ 96 | public function test_it_knows_egyptian_sina_liberation_day($date, $validity) 97 | { 98 | $date = Carbon::parse($date); 99 | 100 | $this->assertSame($validity, $date->isEgyptianSinaLiberationDay()); 101 | } 102 | 103 | public function provideEgyptianSinaLiberationDayData() 104 | { 105 | return [ 106 | '1900-12-25' => ['1900-12-25', false], 107 | '1900-01-25' => ['1900-01-25', false], 108 | '1920-04-25' => ['1920-04-25', false], 109 | '1950-01-25' => ['1950-01-25', false], 110 | '1952-04-25' => ['1952-04-25', false], 111 | '1980-04-25' => ['1980-04-25', false], 112 | '1982-04-25' => ['1982-04-25', true], 113 | '2010-01-25' => ['2010-01-25', false], 114 | '2011-04-25' => ['2011-04-25', true], 115 | '2011-02-25' => ['2011-02-25', false], 116 | '2014-01-25' => ['2014-01-25', false], 117 | '2021-04-25' => ['2021-04-25', true], 118 | '2021-01-08' => ['2021-01-08', false], 119 | '2050-04-25' => ['2050-04-25', true], 120 | ]; 121 | } 122 | 123 | /** 124 | * @dataProvider provideEgyptianLabourDayData 125 | */ 126 | public function test_it_knows_egyptian_labour_day($date, $validity) 127 | { 128 | $date = Carbon::parse($date); 129 | 130 | $this->assertSame($validity, $date->isEgyptianLabourDay()); 131 | } 132 | 133 | public function provideEgyptianLabourDayData() 134 | { 135 | return [ 136 | '1900-12-25' => ['1900-12-25', false], 137 | '1900-01-25' => ['1900-01-25', false], 138 | '1920-05-01' => ['1920-05-01', true], 139 | '1980-04-25' => ['1980-04-25', false], 140 | '1982-05-01' => ['1982-05-01', true], 141 | '2010-01-25' => ['2010-01-25', false], 142 | '2011-05-01' => ['2011-05-01', true], 143 | '2011-02-25' => ['2011-02-25', false], 144 | '2014-04-29' => ['2014-04-29', false], 145 | '2021-05-01' => ['2021-05-01', true], 146 | '2021-05-02' => ['2021-05-02', false], 147 | '2050-05-01' => ['2050-05-01', true], 148 | ]; 149 | } 150 | 151 | 152 | /** 153 | * @dataProvider provideEgyptian30JuneRevolutionDayData 154 | */ 155 | public function test_it_knows_egyptian_30_june_revolution_day($date, $validity) 156 | { 157 | $date = Carbon::parse($date); 158 | 159 | $this->assertSame($validity, $date->isEgyptian30JuneRevolutionDay()); 160 | } 161 | 162 | public function provideEgyptian30JuneRevolutionDayData() 163 | { 164 | return [ 165 | '1900-06-30' => ['1900-06-30', false], 166 | '1900-01-25' => ['1900-01-25', false], 167 | '1920-06-30' => ['1920-06-30', false], 168 | '1980-04-25' => ['1980-04-25', false], 169 | '1982-06-30' => ['1982-06-30', false], 170 | '2010-01-25' => ['2010-01-25', false], 171 | '2011-06-30' => ['2011-06-30', false], 172 | '2013-06-30' => ['2013-06-30', true], 173 | '2014-06-30' => ['2014-06-30', true], 174 | '2021-05-02' => ['2021-05-02', false], 175 | '2050-06-30' => ['2050-06-30', true], 176 | ]; 177 | } 178 | 179 | /** 180 | * @dataProvider provideEgyptian23JulyRevolutionDayData 181 | */ 182 | public function test_it_knows_egyptian_23_july_revolution_day($date, $validity) 183 | { 184 | $date = Carbon::parse($date); 185 | 186 | $this->assertSame($validity, $date->isEgyptian23JulyRevolutionDay()); 187 | } 188 | 189 | public function provideEgyptian23JulyRevolutionDayData() 190 | { 191 | return [ 192 | '1900-07-23' => ['1900-07-23', false], 193 | '1900-01-25' => ['1900-01-25', false], 194 | '1920-07-23' => ['1920-07-23', false], 195 | '1952-07-23' => ['1952-07-23', true], 196 | '1980-04-25' => ['1980-04-25', false], 197 | '1982-07-23' => ['1982-07-23', true], 198 | '2010-01-25' => ['2010-01-25', false], 199 | '2011-07-23' => ['2011-07-23', true], 200 | '2013-07-23' => ['2013-07-23', true], 201 | '2014-07-23' => ['2014-07-23', true], 202 | '2021-05-02' => ['2021-05-02', false], 203 | '2050-07-23' => ['2050-07-23', true], 204 | ]; 205 | } 206 | 207 | 208 | /** 209 | * @dataProvider provideEgyptian6OctoberVictoryDayData 210 | */ 211 | public function test_it_knows_egyptian_6_october_victory_day($date, $validity) 212 | { 213 | $date = Carbon::parse($date); 214 | 215 | $this->assertSame($validity, $date->isEgyptian6OctoberVictoryDay()); 216 | } 217 | 218 | public function provideEgyptian6OctoberVictoryDayData() 219 | { 220 | return [ 221 | '1900-10-06' => ['1900-10-06', false], 222 | '1900-01-25' => ['1900-01-25', false], 223 | '1920-10-06' => ['1920-10-06', false], 224 | '1952-10-06' => ['1952-10-06', false], 225 | '1973-10-06' => ['1973-10-06', true], 226 | '1982-10-06' => ['1982-10-06', true], 227 | '2010-01-25' => ['2010-01-25', false], 228 | '2011-10-06' => ['2011-10-06', true], 229 | '2013-10-06' => ['2013-10-06', true], 230 | '2014-10-06' => ['2014-10-06', true], 231 | '2021-05-02' => ['2021-05-02', false], 232 | '2050-10-06' => ['2050-10-06', true], 233 | ]; 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /tests/FrenchHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isAllSaintsDay()); 17 | } 18 | 19 | /** 20 | * @dataProvider provideAssumptionDayData 21 | */ 22 | public function test_it_recognizes_assumption_day($date, $validity) 23 | { 24 | $date = Carbon::parse($date); 25 | 26 | $this->assertSame($validity, $date->isAssumptionDay()); 27 | } 28 | 29 | /** 30 | * @dataProvider provideAscensionDayData 31 | */ 32 | public function test_it_recognizes_ascension_day($date, $validity) 33 | { 34 | $date = Carbon::parse($date); 35 | 36 | $this->assertSame($validity, $date->isAscensionDay()); 37 | } 38 | 39 | /** 40 | * @dataProvider provideFirstWarArmisticeDayData 41 | */ 42 | public function test_it_recognizes_first_war_armistice_day($date, $validity) 43 | { 44 | $date = Carbon::parse($date); 45 | 46 | $this->assertSame($validity, $date->isFirstWarArmisticeDay()); 47 | } 48 | 49 | /** 50 | * @dataProvider provideEasterMondayDayData 51 | */ 52 | public function test_it_recognizes_easter_monday_day($date, $validity) 53 | { 54 | $date = Carbon::parse($date); 55 | 56 | $this->assertSame($validity, $date->isEasterMonday()); 57 | } 58 | 59 | /** 60 | * @dataProvider provideFrenchNationalDayData 61 | */ 62 | public function test_it_recognizes_french_national_day($date, $validity) 63 | { 64 | $date = Carbon::parse($date); 65 | 66 | $this->assertSame($validity, $date->isFrenchNationalDay()); 67 | } 68 | 69 | /** 70 | * @dataProvider providePentecostDayData 71 | */ 72 | public function test_it_recognizes_pentecost_day($date, $validity) 73 | { 74 | $date = Carbon::parse($date); 75 | 76 | $this->assertSame($validity, $date->isPentecostDay()); 77 | } 78 | 79 | /** 80 | * @dataProvider provideSecondWarArmisticeDayData 81 | */ 82 | public function test_it_recognizes_second_war_armistice_day($date, $validity) 83 | { 84 | $date = Carbon::parse($date); 85 | 86 | $this->assertSame($validity, $date->isSecondWarArmisticeDay()); 87 | } 88 | 89 | /** 90 | * @return array[] 91 | */ 92 | public function provideAllSaintsDayData() 93 | { 94 | return [ 95 | '1982-11-01' => ['1982-11-01', true], 96 | '1982-01-01' => ['1982-01-01', false], 97 | '1982-11-02' => ['1982-11-02', false], 98 | ]; 99 | } 100 | 101 | /** 102 | * @return array[] 103 | */ 104 | public function provideAssumptionDayData() 105 | { 106 | return [ 107 | '1982-08-15' => ['1982-08-15', true], 108 | '1982-08-16' => ['1982-08-16', false], 109 | '1982-07-15' => ['1982-07-15', false], 110 | ]; 111 | } 112 | 113 | /** 114 | * @return array[] 115 | */ 116 | public function provideAscensionDayData() 117 | { 118 | return [ 119 | '2019-05-30' => ['2019-05-30', true], 120 | '2019-05-29' => ['2919-05-20', false], 121 | '2019-05-31' => ['2019-05-31', false], 122 | '2020-05-21' => ['2020-05-21', true], 123 | '2020-05-20' => ['2020-05-20', false], 124 | '2020-05-22' => ['2020-05-22', false], 125 | ]; 126 | } 127 | 128 | /** 129 | * @return array[] 130 | */ 131 | public function provideEasterMondayDayData() 132 | { 133 | return [ 134 | '2019-04-22' => ['2019-04-22', true], 135 | '2019-04-21' => ['2019-04-21', false], 136 | '2019-04-23' => ['2019-04-23', false], 137 | '2020-04-13' => ['2020-04-13', true], 138 | '2020-04-12' => ['2020-04-12', false], 139 | '2020-04-14' => ['2020-04-14', false], 140 | ]; 141 | } 142 | 143 | /** 144 | * @return array[] 145 | */ 146 | public function provideFirstWarArmisticeDayData() 147 | { 148 | return [ 149 | '1982-11-11' => ['1982-11-11', true], 150 | '1911-11-11' => ['1911-11-11', false], 151 | '1982-11-12' => ['1918-11-12', false], 152 | '1982-10-11' => ['1918-10-11', false], 153 | ]; 154 | } 155 | 156 | /** 157 | * @return array[] 158 | */ 159 | public function provideFrenchNationalDayData() 160 | { 161 | return [ 162 | '1982-07-14' => ['1982-07-14', true], 163 | '1990-07-14' => ['1990-07-14', true], 164 | '1880-07-14' => ['1880-07-14', true], 165 | '1879-07-14' => ['1879-07-14', false], 166 | '1982-07-12' => ['1918-07-12', false], 167 | '1982-06-14' => ['1918-06-14', false], 168 | ]; 169 | } 170 | 171 | /** 172 | * @return array[] 173 | */ 174 | public function providePentecostDayData() 175 | { 176 | return [ 177 | '2019-06-09' => ['2019-06-09', true], 178 | '2019-06-08' => ['2019-06-08', false], 179 | '2019-06-10' => ['2019-06-10', false], 180 | '2020-05-31' => ['2020-05-31', true], 181 | '2020-05-30' => ['2020-05-30', false], 182 | '2020-06-01' => ['2020-06-01', false], 183 | ]; 184 | } 185 | 186 | /** 187 | * @return array[] 188 | */ 189 | public function provideSecondWarArmisticeDayData() 190 | { 191 | return [ 192 | '1982-05-08' => ['1982-05-08', true], 193 | '1911-05-08' => ['1911-05-08', false], 194 | '1982-05-07' => ['1918-05-07', false], 195 | '1982-05-09' => ['1918-05-09', false], 196 | ]; 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /tests/GermanHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isGermanLabourDay()); 15 | } 16 | 17 | function provideGermanLabourDayData() 18 | { 19 | return [ 20 | '1994-03-16 (not labor day)' => ['1994-03-16', false], 21 | '1894-09-03 (Canadian labor day)' => ['1894-09-03', false], 22 | '1894-05-01 (German labor day)' => ['1894-05-01', true], 23 | '2015-09-07 (Canadian labor day)' => ['2015-09-07', false], 24 | '2015-05-01 (German labor day)' => ['2015-05-01', true], 25 | '2016-09-05 (Canadian labor day)' => ['2016-09-05', false], 26 | '2016-05-01 (German labor day)' => ['2016-05-01', true], 27 | ]; 28 | } 29 | 30 | /** 31 | * @dataProvider provideAscensionOfJesusData 32 | */ 33 | function test_it_knows_ascension_of_jesus($date, $validity) 34 | { 35 | $date = Carbon::parse($date); 36 | 37 | $this->assertSame($validity, $date->isAscensionOfJesus()); 38 | } 39 | 40 | function provideAscensionOfJesusData() 41 | { 42 | return [ 43 | '2019-05-30' => ['2019-05-30', true], 44 | '1990-05-29' => ['1990-05-29', false], 45 | '2019-05-29' => ['2019-05-29', false], 46 | '2020-05-21' => ['2020-05-21', true], 47 | '2021-05-13' => ['2021-05-13', true], 48 | '2021-06-13' => ['2021-06-13', false], 49 | '2022-05-26' => ['2022-05-26', true], 50 | ]; 51 | } 52 | 53 | /** 54 | * @dataProvider provideWhitSundayData 55 | */ 56 | function test_it_knows_whitsunday($date, $validity) 57 | { 58 | $date = Carbon::parse($date); 59 | 60 | $this->assertSame($validity, $date->isWhitSunday()); 61 | } 62 | 63 | function provideWhitSundayData() 64 | { 65 | return [ 66 | '1990-06-09' => ['1990-06-09', false], 67 | '2019-06-09' => ['2019-06-09', true], 68 | '2019-09-06' => ['2019-09-06', false], 69 | '2020-05-31' => ['2020-05-31', true], 70 | '2021-05-23' => ['2021-05-23', true], 71 | '2021-06-13' => ['2021-06-13', false], 72 | '2022-06-05' => ['2022-06-05', true], 73 | ]; 74 | } 75 | 76 | /** 77 | * @dataProvider provideWhitSundayData 78 | */ 79 | function test_it_knows_whitsun($date, $validity) 80 | { 81 | $date = Carbon::parse($date); 82 | 83 | $this->assertSame($validity, $date->isWhitsun()); 84 | } 85 | 86 | /** 87 | * @dataProvider provideWhitSundayData 88 | */ 89 | function test_it_knows_pentecost($date, $validity) 90 | { 91 | $date = Carbon::parse($date); 92 | 93 | $this->assertSame($validity, $date->isPentecost()); 94 | } 95 | 96 | /** 97 | * @dataProvider provideWhitSundayData 98 | */ 99 | function test_it_knows_pentecost_sunday($date, $validity) 100 | { 101 | $date = Carbon::parse($date); 102 | 103 | $this->assertSame($validity, $date->isPentecostSunday()); 104 | } 105 | 106 | /** 107 | * @dataProvider provideWhitMondayData 108 | */ 109 | function test_it_knows_whitmonday($date, $validity) 110 | { 111 | $date = Carbon::parse($date); 112 | 113 | $this->assertSame($validity, $date->isWhitMonday()); 114 | } 115 | 116 | function provideWhitMondayData() 117 | { 118 | return [ 119 | '1990-06-10' => ['1990-06-10', false], 120 | '2019-06-10' => ['2019-06-10', true], 121 | '2019-10-06' => ['2019-10-06', false], 122 | '2020-06-01' => ['2020-06-01', true], 123 | '2021-05-24' => ['2021-05-24', true], 124 | '2021-06-14' => ['2021-06-14', false], 125 | '2022-06-06' => ['2022-06-06', true], 126 | ]; 127 | } 128 | 129 | /** 130 | * @dataProvider provideWhitMondayData 131 | */ 132 | function test_it_knows_pentecost_monday($date, $validity) 133 | { 134 | $date = Carbon::parse($date); 135 | 136 | $this->assertSame($validity, $date->isPentecostMonday()); 137 | } 138 | 139 | /** 140 | * @dataProvider provideCorpusChristiData 141 | */ 142 | function test_it_knows_corpus_christi($date, $validity) 143 | { 144 | $date = Carbon::parse($date); 145 | 146 | $this->assertSame($validity, $date->isCorpusChristi()); 147 | } 148 | 149 | function provideCorpusChristiData() 150 | { 151 | return [ 152 | '1990-06-20' => ['1990-06-20', false], 153 | '2019-06-20' => ['2019-06-20', true], 154 | '2019-06-21' => ['2019-06-21', false], 155 | '2020-06-11' => ['2020-06-11', true], 156 | '2021-03-06' => ['2021-03-06', false], 157 | '2021-06-03' => ['2021-06-03', true], 158 | '2022-06-16' => ['2022-06-16', true], 159 | ]; 160 | } 161 | 162 | /** 163 | * @dataProvider provideGermanUnityDayData 164 | */ 165 | function test_it_knows_german_unity_day($date, $validity) 166 | { 167 | $date = Carbon::parse($date); 168 | 169 | $this->assertSame($validity, $date->isGermanUnityDay()); 170 | } 171 | 172 | function provideGermanUnityDayData() 173 | { 174 | return [ 175 | '1990-03-10' => ['1990-03-10', false], 176 | '1990-10-02' => ['1990-10-02', false], 177 | '1990-10-03' => ['1990-10-03', true], 178 | '1989-10-03' => ['1989-10-03', false], 179 | '2020-10-03' => ['2020-10-03', true], 180 | '2020-10-04' => ['2020-10-04', false], 181 | '2022-10-03' => ['2022-10-03', true], 182 | ]; 183 | } 184 | 185 | /** 186 | * @dataProvider provideChristmasEveData 187 | */ 188 | function test_it_knows_heiliger_abend($date, $validity) 189 | { 190 | $date = Carbon::parse($date); 191 | 192 | $this->assertSame($validity, $date->isHeiligerAbend()); 193 | } 194 | 195 | function provideChristmasEveData() 196 | { 197 | return [ 198 | '1963-12-24' => ['1963-12-24', true], 199 | '1972-12-25' => ['1972-12-25', false], 200 | '1987-12-24' => ['1987-12-24', true], 201 | '1993-12-24' => ['1993-12-24', true], 202 | '2004-12-23' => ['2004-12-23', false], 203 | '2020-12-24' => ['2020-12-24', true], 204 | '2020-01-24' => ['2020-01-24', false], 205 | '2037-12-24' => ['2037-12-24', true], 206 | '2057-12-25' => ['2057-12-25', false], 207 | ]; 208 | } 209 | 210 | /** 211 | * @dataProvider provideChristmasEveData 212 | */ 213 | function test_it_knows_heilig_abend($date, $validity) 214 | { 215 | $date = Carbon::parse($date); 216 | 217 | $this->assertSame($validity, $date->isHeiligAbend()); 218 | } 219 | } 220 | -------------------------------------------------------------------------------- /tests/IndianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isIndianRepublicDay()); 17 | } 18 | 19 | /** 20 | * @return array[] 21 | */ 22 | public function provideRepublicDayData() 23 | { 24 | return [ 25 | '1950-01-26' => ['1950-01-26', true], 26 | '1949-01-26' => ['1949-01-26', false], 27 | '1969-01-26' => ['1969-01-26', true], 28 | '2020-01-26' => ['2020-01-26', true], 29 | '1949-01-28' => ['1949-01-28', false], 30 | '1950-01-28' => ['1950-01-28', false], 31 | ]; 32 | } 33 | 34 | /** 35 | * @dataProvider provideIndependenceDayData 36 | */ 37 | public function test_it_recognizes_independence_day($date, $validity) 38 | { 39 | $date = Carbon::parse($date); 40 | 41 | $this->assertSame($validity, $date->isIndianIndependenceDay()); 42 | } 43 | 44 | /** 45 | * @return array[] 46 | */ 47 | public function provideIndependenceDayData() 48 | { 49 | return [ 50 | '1947-08-15' => ['1947-08-15', true], 51 | '1946-08-15' => ['1946-08-15', false], 52 | '1947-08-17' => ['1947-08-17', false], 53 | '1950-08-15' => ['1950-08-15', true], 54 | '2020-08-15' => ['2020-08-15', true], 55 | ]; 56 | } 57 | 58 | 59 | /** 60 | * @dataProvider provideGandhiJayantiData 61 | */ 62 | public function test_it_recognizes_gandhi_jayanti($date, $validity) 63 | { 64 | $date = Carbon::parse($date); 65 | 66 | $this->assertSame($validity, $date->isGandhiJayanti()); 67 | } 68 | 69 | /** 70 | * @return array[] 71 | */ 72 | public function provideGandhiJayantiData() 73 | { 74 | return [ 75 | '1869-10-02' => ['1869-10-02', true], 76 | '1859-10-02' => ['1859-10-02', false], 77 | '1869-10-10' => ['1869-10-10', false], 78 | '1969-10-02' => ['1969-10-02', true], 79 | '2020-10-02' => ['2020-10-02', true], 80 | ]; 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /tests/IndonesianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isIndonesianIndependenceDay()); 17 | } 18 | 19 | public function provideIndonesianIndependenceDayData() 20 | { 21 | return [ 22 | '1945-08-17' => ['1945-08-17', true], 23 | '1955-09-17' => ['1955-09-17', false], 24 | '1965-01-10' => ['1965-01-10', false], 25 | '1975-08-17' => ['1975-08-17', true], 26 | '1985-04-17' => ['1985-04-17', false], 27 | '1995-08-17' => ['1995-08-17', true], 28 | '2005-12-17' => ['2005-12-17', false], 29 | '2015-08-17' => ['2015-08-17', true], 30 | '2020-08-17' => ['2020-08-17', true], 31 | ]; 32 | } 33 | 34 | /** 35 | * @dataProvider providePancasilaDayData 36 | */ 37 | public function test_it_recognizes_pancasila_day($date, $validity) 38 | { 39 | $date = Carbon::parse($date); 40 | 41 | $this->assertSame($validity, $date->isPancasilaDay()); 42 | } 43 | 44 | public function providePancasilaDayData() 45 | { 46 | return [ 47 | '1945-06-01' => ['1945-06-01', true], 48 | '1955-06-02' => ['1955-06-02', false], 49 | '1965-07-01' => ['1965-07-01', false], 50 | '1975-06-01' => ['1975-06-01', true], 51 | '1985-12-01' => ['1985-12-01', false], 52 | '1995-06-01' => ['1995-06-01', true], 53 | '2005-05-05' => ['2005-05-05', false], 54 | '2015-06-01' => ['2015-06-01', true], 55 | '2020-06-01' => ['2020-06-01', true], 56 | ]; 57 | } 58 | 59 | /** 60 | * @dataProvider provideIndonesianLaborDayData 61 | */ 62 | public function test_it_recognizes_indonesian_labor_day($date, $validity) 63 | { 64 | $date = Carbon::parse($date); 65 | 66 | $this->assertSame($validity, $date->isIndonesianLaborDay()); 67 | } 68 | 69 | public function provideIndonesianLaborDayData() 70 | { 71 | return [ 72 | '1945-05-01' => ['1945-05-01', true], 73 | '1955-06-02' => ['1955-06-02', false], 74 | '1965-07-01' => ['1965-07-01', false], 75 | '1975-05-01' => ['1975-05-01', true], 76 | '1985-12-01' => ['1985-12-01', false], 77 | '1995-05-01' => ['1995-05-01', true], 78 | '2005-05-05' => ['2005-05-05', false], 79 | '2015-05-01' => ['2015-05-01', true], 80 | '2020-05-01' => ['2020-05-01', true], 81 | ]; 82 | } 83 | 84 | /** 85 | * @dataProvider provideKartiniDayData 86 | */ 87 | public function test_it_recognizes_kartini_day($date, $validity) 88 | { 89 | $date = Carbon::parse($date); 90 | 91 | $this->assertSame($validity, $date->isKartiniDay()); 92 | } 93 | 94 | public function provideKartiniDayData() 95 | { 96 | return [ 97 | '1990-04-21' => ['1990-04-21', true], 98 | '1995-06-02' => ['1995-06-02', false], 99 | '2000-04-21' => ['2000-04-21', true], 100 | '2015-02-20' => ['2015-02-20', false], 101 | '2020-04-21' => ['2020-04-21', true], 102 | ]; 103 | } 104 | 105 | /** 106 | * @dataProvider provideIndonesianEducationDayData 107 | */ 108 | public function test_it_recognizes_indonesian_education_day($date, $validity) 109 | { 110 | $date = Carbon::parse($date); 111 | 112 | $this->assertSame($validity, $date->isIndonesianEducationDay()); 113 | } 114 | 115 | public function provideIndonesianEducationDayData() 116 | { 117 | return [ 118 | '1990-05-02' => ['1990-05-02', true], 119 | '1995-06-02' => ['1995-06-02', false], 120 | '2000-05-02' => ['2000-05-02', true], 121 | '2015-02-20' => ['2015-02-20', false], 122 | '2020-05-02' => ['2020-05-02', true], 123 | ]; 124 | } 125 | 126 | /** 127 | * @dataProvider provideIndonesianCustomerDayData 128 | */ 129 | public function test_it_recognizes_indonesian_customer_day($date, $validity) 130 | { 131 | $date = Carbon::parse($date); 132 | 133 | $this->assertSame($validity, $date->isIndonesiaCustomerDay()); 134 | } 135 | 136 | public function provideIndonesianCustomerDayData() 137 | { 138 | return [ 139 | '1990-09-04' => ['1990-09-04', false], 140 | '1995-06-02' => ['1995-06-02', false], 141 | '2000-09-04' => ['2000-09-04', false], 142 | '2002-09-04' => ['2002-09-04', false], 143 | '2003-09-04' => ['2003-09-04', true], 144 | '2010-09-04' => ['2010-09-04', true], 145 | '2015-02-20' => ['2015-02-20', false], 146 | '2020-09-04' => ['2020-09-04', true], 147 | ]; 148 | } 149 | 150 | /** 151 | * @dataProvider provideIndonesianHeroesDayData 152 | */ 153 | public function test_it_recognizes_indonesian_heroes_day($date, $validity) 154 | { 155 | $date = Carbon::parse($date); 156 | 157 | $this->assertSame($validity, $date->isIndonesianHeroesDay()); 158 | } 159 | 160 | public function provideIndonesianHeroesDayData() 161 | { 162 | return [ 163 | '1990-11-10' => ['1990-11-10', true], 164 | '1995-06-02' => ['1995-06-02', false], 165 | '2000-11-10' => ['2000-11-10', true], 166 | '2015-02-20' => ['2015-02-20', false], 167 | '2020-11-10' => ['2020-11-10', true], 168 | ]; 169 | } 170 | 171 | /** 172 | * @dataProvider provideIndonesianMothersDayData 173 | */ 174 | public function test_it_recognizes_indonesian_mothers_day($date, $validity) 175 | { 176 | $date = Carbon::parse($date); 177 | 178 | $this->assertSame($validity, $date->isIndonesianMothersDay()); 179 | } 180 | 181 | public function provideIndonesianMothersDayData() 182 | { 183 | return [ 184 | '1990-12-22' => ['1990-12-22', true], 185 | '1995-06-02' => ['1995-06-02', false], 186 | '2000-12-22' => ['2000-12-22', true], 187 | '2015-02-20' => ['2015-02-20', false], 188 | '2020-12-22' => ['2020-12-22', true], 189 | ]; 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /tests/ItalianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isLiberationDay()); 14 | } 15 | 16 | public function provideLiberationDayDate(){ 17 | return [ 18 | '1945-04-25' => ['1945-04-25', false], 19 | '2020-12-11' => ['2020-12-11', false], 20 | '2050-04-25' => ['2050-04-25', true], 21 | '2001-08-03' => ['2001-08-03', false], 22 | '1946-04-25' => ['1946-04-25', true], 23 | '1997-02-06' => ['1997-02-06', false] 24 | ]; 25 | } 26 | 27 | /** 28 | * @dataProvider provideRepublicDayDate 29 | */ 30 | public function test_it_recognizes_republic_day($date, $validity){ 31 | $date = Carbon::parse($date); 32 | 33 | $this->assertSame($validity, $date->isRepublicDay()); 34 | } 35 | 36 | public function provideRepublicDayDate(){ 37 | return [ 38 | '1945-06-02' => ['1945-06-02', false], 39 | '2020-11-30' => ['2020-11-30', false], 40 | '2050-08-25' => ['2050-08-25', false], 41 | '2005-09-03' => ['2005-09-03', false], 42 | '1946-06-02' => ['1946-06-02', true], 43 | '1900-06-02' => ['1900-06-02', false] 44 | ]; 45 | } 46 | 47 | /** 48 | * @dataProvider provideImmaculateConceptionFeastDate 49 | */ 50 | public function test_it_recognizes_immaculate_conception_feast($date, $validity){ 51 | $date = Carbon::parse($date); 52 | 53 | $this->assertSame($validity, $date->isImmaculateConceptionFeast()); 54 | } 55 | 56 | public function provideImmaculateConceptionFeastDate(){ 57 | return [ 58 | '1945-12-08' => ['1945-12-08', true], 59 | '1300-12-08' => ['1300-12-08', true], 60 | '2050-08-25' => ['2050-08-25', false], 61 | '2005-12-10' => ['2005-12-10', false], 62 | '2077-12-08' => ['2077-12-08', true], 63 | '1900-08-09' => ['1900-08-09', false] 64 | ]; 65 | } 66 | 67 | /** 68 | * @dataProvider provideAllSaintsDayDate 69 | */ 70 | public function test_it_recognizes_all_saints_day($date, $validity){ 71 | $date = Carbon::parse($date); 72 | 73 | $this->assertSame($validity, $date->isAllSaintsDay()); 74 | } 75 | 76 | public function provideAllSaintsDayDate(){ 77 | return [ 78 | '1968-08-29' => ['1968-08-29', false], 79 | '1970-05-10' => ['1970-05-10', false], 80 | '2000-11-01' => ['2000-11-01', true], 81 | '1356-12-10' => ['1356-12-10', false], 82 | '1993-11-01' => ['1993-11-01', true], 83 | '2033-12-09' => ['2033-12-09', false] 84 | ]; 85 | } 86 | 87 | /** 88 | * @dataProvider provideAssumptionOfMaryFeastDate 89 | */ 90 | public function test_it_recognizes_is_assumption_of_mary_feast($date, $validity){ 91 | $date = Carbon::parse($date); 92 | 93 | $this->assertSame($validity, $date->isAssumptionOfMaryFeast()); 94 | } 95 | 96 | public function provideAssumptionOfMaryFeastDate(){ 97 | return [ 98 | '1968-08-15' => ['1968-08-15', true], 99 | '2006-03-25' => ['2006-03-25', false], 100 | '2000-07-16' => ['2000-07-16', false], 101 | '1996-08-15' => ['1996-08-15', true], 102 | '1994-11-15' => ['1994-11-15', false], 103 | '2056-08-15' => ['2056-08-15', true] 104 | ]; 105 | } 106 | 107 | /** 108 | * @dataProvider provideEpiphanyDate 109 | */ 110 | public function test_it_recognizes_epiphany($date, $validity){ 111 | $date = Carbon::parse($date); 112 | 113 | $this->assertSame($validity, $date->isEpiphany()); 114 | } 115 | 116 | public function provideEpiphanyDate(){ 117 | return [ 118 | '1999-06-01' => ['1999-06-01', false], 119 | '1996-07-12' => ['1996-07-12', false], 120 | '2007-01-06' => ['2007-01-06', true], 121 | '1997-08-09' => ['1997-08-09', false], 122 | '2008-01-06' => ['2008-01-06', true], 123 | '2011-05-11' => ['2011-05-11', false] 124 | ]; 125 | } 126 | 127 | /** 128 | * @dataProvider provideSaintStephenDayDate 129 | */ 130 | public function test_it_recognizes_saint_stephen_day($date, $validity){ 131 | $date = Carbon::parse($date); 132 | 133 | $this->assertSame($validity, $date->isSaintStephenDay()); 134 | } 135 | 136 | public function provideSaintStephenDayDate(){ 137 | return [ 138 | '2015-08-23' => ['2015-08-23', false], 139 | '2065-12-26' => ['2065-12-26', true], 140 | '2015-05-29' => ['2015-05-29', false], 141 | '2019-02-26' => ['2019-02-26', false], 142 | '2077-12-25' => ['2077-12-25', false], 143 | '2022-09-11' => ['2022-09-11', false] 144 | ]; 145 | } 146 | 147 | /** 148 | * @dataProvider provideSaintSylvesterDayDate 149 | */ 150 | public function test_it_recognizes_saint_sylvester_day($date, $validity){ 151 | $date = Carbon::parse($date); 152 | 153 | $this->assertSame($validity, $date->isSaintSylvesterDay()); 154 | } 155 | 156 | public function provideSaintSylvesterDayDate(){ 157 | return [ 158 | '2015-03-18' => ['2015-03-18', false], 159 | '2065-12-26' => ['2065-12-26', false], 160 | '2015-05-29' => ['2015-05-29', false], 161 | '2019-02-26' => ['2019-02-26', false], 162 | '2077-12-31' => ['2077-12-31', true], 163 | '2022-09-11' => ['2022-09-11', false] 164 | ]; 165 | } 166 | 167 | /** 168 | * @dataProvider provideWorkersDayDate 169 | */ 170 | public function test_it_recognizes_workers_day($date, $validity){ 171 | $date = Carbon::parse($date); 172 | 173 | $this->assertSame($validity, $date->isWorkersDay()); 174 | } 175 | 176 | public function provideWorkersDayDate(){ 177 | return [ 178 | '1930-04-21' => ['1930-04-21', true], 179 | '1880-03-23' => ['1880-03-23', false], 180 | '2015-05-01' => ['2015-05-01', true], 181 | '2019-04-21' => ['2019-04-21', false], 182 | '1924-04-21' => ['1924-04-21', true], 183 | '1944-05-01' => ['1944-05-01', false] 184 | ]; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /tests/KenyanHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isKenyanIndependenceDay()); 15 | } 16 | 17 | public function provideKenyanIndependenceDayData() 18 | { 19 | return [ 20 | '1963-12-12' => ['1963-12-12', true], 21 | '1963-12-11' => ['1963-12-11', false], 22 | '2020-10-19' => ['2020-10-19', false], 23 | '2020-12-12' => ['2020-12-12', true], 24 | '1800-12-12' => ['1800-12-12', false], 25 | ]; 26 | } 27 | 28 | /** 29 | * @dataProvider provideKenyanJamhuriDayData 30 | */ 31 | public function test_it_recognizes_kenyan_jamhuri_day($date, $validity) 32 | { 33 | $date = Carbon::parse($date); 34 | 35 | $this->assertSame($validity, $date->isKenyanJamhuriDay()); 36 | } 37 | 38 | public function provideKenyanJamhuriDayData() 39 | { 40 | return [ 41 | '1963-12-12' => ['1963-12-12', true], 42 | '1963-12-11' => ['1963-12-11', false], 43 | '2020-10-19' => ['2020-10-19', false], 44 | '2020-12-12' => ['2020-12-12', true], 45 | '1800-12-12' => ['1800-12-12', false], 46 | ]; 47 | } 48 | 49 | /** 50 | * @dataProvider provideKenyanLabourDayData 51 | */ 52 | public function test_it_recognizes_kenyan_labour_day($date, $validity) 53 | { 54 | $date = Carbon::parse($date); 55 | 56 | $this->assertSame($validity, $date->isKenyanLabourDay()); 57 | } 58 | 59 | public function provideKenyanLabourDayData() 60 | { 61 | return [ 62 | '1963-05-01' => ['1963-05-01', true], 63 | '1963-12-11' => ['1963-12-11', false], 64 | '2020-10-19' => ['2020-10-19', false], 65 | '2020-05-01' => ['2020-05-01', true], 66 | '2010-05-01' => ['2010-05-01', true], 67 | ]; 68 | } 69 | 70 | /** 71 | * @dataProvider provideKenyanMadarakaDayData 72 | */ 73 | public function test_it_recognizes_kenyan_madaraka_day($date, $validity) 74 | { 75 | $date = Carbon::parse($date); 76 | 77 | $this->assertSame($validity, $date->isKenyanMadarakaDay()); 78 | } 79 | 80 | public function provideKenyanMadarakaDayData() 81 | { 82 | return [ 83 | '1963-06-01' => ['1963-06-01', true], 84 | '1920-06-01' => ['1920-06-01', true], 85 | '2020-06-01' => ['2020-06-01', true], 86 | '2020-05-01' => ['2020-05-01', false], 87 | '1920-05-01' => ['1920-05-01', false], 88 | ]; 89 | } 90 | 91 | /** 92 | * @dataProvider provideKenyanHudumaDayData 93 | */ 94 | public function test_it_recognizes_kenyan_huduma_day($date, $validity) 95 | { 96 | $date = Carbon::parse($date); 97 | 98 | $this->assertSame($validity, $date->isKenyanHudumaDay()); 99 | } 100 | 101 | public function provideKenyanHudumaDayData() 102 | { 103 | return [ 104 | '1963-10-10' => ['1963-10-10', true], 105 | '1920-10-09' => ['1920-10-09', false], 106 | '2020-10-10' => ['2020-10-10', true], 107 | '2020-11-10' => ['2020-11-10', false], 108 | '1920-10-11' => ['1920-10-11', false], 109 | ]; 110 | } 111 | 112 | /** 113 | * @dataProvider provideKenyanMashujaaDayData 114 | */ 115 | public function test_it_recognizes_kenyan_mashujaa_day($date, $validity) 116 | { 117 | $date = Carbon::parse($date); 118 | 119 | $this->assertSame($validity, $date->isKenyanMashujaaDay()); 120 | } 121 | 122 | public function provideKenyanMashujaaDayData() 123 | { 124 | return [ 125 | '1963-10-20' => ['1963-10-20', true], 126 | '1920-10-10' => ['1920-10-10', false], 127 | '2020-10-20' => ['2020-10-20', true], 128 | '2020-10-10' => ['2020-10-10', false], 129 | '2000-10-20' => ['2000-10-20', true], 130 | ]; 131 | } 132 | 133 | 134 | /** 135 | * @dataProvider provideKenyanUtamaduniDayData 136 | */ 137 | public function test_it_recognizes_kenyan_utamaduni_day($date, $validity) 138 | { 139 | $date = Carbon::parse($date); 140 | 141 | $this->assertSame($validity, $date->isKenyanUtamaduniDay()); 142 | } 143 | 144 | public function provideKenyanUtamaduniDayData() 145 | { 146 | return [ 147 | '1963-12-26' => ['1963-12-26', true], 148 | '1920-12-25' => ['1920-12-25', false], 149 | '2020-12-26' => ['2020-12-26', true], 150 | '2020-12-27' => ['2020-12-27', false], 151 | '2000-12-25' => ['2000-12-25', false], 152 | ]; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /tests/SwedishHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isSwedishMidsummerDay()); 15 | } 16 | 17 | function provideSwedishMidsummerDayData() 18 | { 19 | return [ 20 | '1963-05-24' => ['1963-05-24', false], 21 | '1978-06-24' => ['1978-06-24', true], 22 | '1986-06-21' => ['1986-06-21', true], 23 | '1997-06-26' => ['1997-06-26', false], 24 | '2020-06-20' => ['2020-06-20', true], 25 | '2020-01-26' => ['2020-01-26', false], 26 | '2035-06-23' => ['2035-06-23', true], 27 | '2046-06-26' => ['2046-06-26', false], 28 | ]; 29 | } 30 | 31 | /** 32 | * @dataProvider provideSwedishNationalDayData 33 | */ 34 | function test_it_knows_swedish_national_day($date, $validity) 35 | { 36 | $date = Carbon::parse($date); 37 | 38 | $this->assertSame($validity, $date->isSwedishNationalDay()); 39 | } 40 | 41 | function provideSwedishNationalDayData() 42 | { 43 | return [ 44 | '1960-06-06' => ['1960-06-06', true], 45 | '1975-05-06' => ['1975-05-06', false], 46 | '1984-06-06' => ['1984-06-06', true], 47 | '1994-01-06' => ['1994-01-06', false], 48 | '2000-06-06' => ['2000-06-06', true], 49 | '2020-06-06' => ['2020-06-06', true], 50 | '2034-06-04' => ['2035-06-04', false], 51 | '2060-06-05' => ['2060-06-05', false], 52 | ]; 53 | } 54 | 55 | /** 56 | * @dataProvider provideChristmasEveData 57 | */ 58 | function test_it_knows_christmas_eve($date, $validity) 59 | { 60 | $date = Carbon::parse($date); 61 | 62 | $this->assertSame($validity, $date->isChristmasEve()); 63 | } 64 | 65 | function provideChristmasEveData() 66 | { 67 | return [ 68 | '1963-12-24' => ['1963-12-24', true], 69 | '1972-12-25' => ['1972-12-25', false], 70 | '1987-12-24' => ['1987-12-24', true], 71 | '1993-12-24' => ['1993-12-24', true], 72 | '2004-12-23' => ['2004-12-23', false], 73 | '2020-12-24' => ['2020-12-24', true], 74 | '2020-01-24' => ['2020-01-24', false], 75 | '2037-12-24' => ['2037-12-24', true], 76 | '2057-12-25' => ['2057-12-25', false], 77 | ]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isMlkJrDay()); 15 | } 16 | 17 | public function provideMlkJrDayData() 18 | { 19 | return [ 20 | '1950-01-16' => ['1950-01-16', false], 21 | '2020-01-19' => ['2020-01-19', false], 22 | '2020-01-20' => ['2020-01-20', true], 23 | '2020-01-21' => ['2020-01-21', false], 24 | '2025-01-19' => ['2025-01-19', false], 25 | '2025-01-20' => ['2025-01-20', true], 26 | '2025-01-21' => ['2025-01-21', false], 27 | '2025-02-21' => ['2025-02-21', false], 28 | ]; 29 | } 30 | 31 | /** 32 | * @dataProvider provideIndependenceDayData 33 | */ 34 | public function test_it_knows_independence_day($date, $validity) 35 | { 36 | $date = Carbon::parse($date); 37 | 38 | $this->assertSame($validity, $date->isIndependenceDay()); 39 | } 40 | 41 | public function provideIndependenceDayData() 42 | { 43 | return [ 44 | '1780-07-04' => ['1780-07-04', false], 45 | '1781-07-04' => ['1781-07-04', true], 46 | '1950-07-04' => ['1950-07-04', true], 47 | '2020-07-03' => ['2020-07-03', false], 48 | '2020-07-04' => ['2020-07-04', true], 49 | '2020-07-05' => ['2020-07-05', false], 50 | '2050-07-04' => ['2050-07-04', true], 51 | ]; 52 | } 53 | 54 | /** 55 | * @dataProvider provideMemorialDayData 56 | */ 57 | public function test_it_knows_memorial_day($date, $validity) 58 | { 59 | $date = Carbon::parse($date); 60 | 61 | $this->assertSame($validity, $date->isMemorialDay()); 62 | } 63 | 64 | public function provideMemorialDayData() 65 | { 66 | return [ 67 | '1873-05-26' => ['1873-05-26', false], 68 | '1874-05-25' => ['1874-05-25', true], 69 | '2019-05-27' => ['2019-05-27', true], 70 | '2020-05-24' => ['2020-05-24', false], 71 | '2020-05-25' => ['2020-05-25', true], 72 | '2020-05-26' => ['2020-05-26', false], 73 | '2021-05-31' => ['2021-05-31', true], 74 | '2022-05-30' => ['2022-05-30', true], 75 | '2050-05-29' => ['2050-05-29', false], 76 | '2050-05-30' => ['2050-05-30', true], 77 | ]; 78 | } 79 | 80 | /** 81 | * @dataProvider provideLaborDayData 82 | */ 83 | public function test_it_knows_labor_day($date, $validity) 84 | { 85 | $date = Carbon::parse($date); 86 | 87 | $this->assertSame($validity, $date->isLaborDay()); 88 | } 89 | 90 | public function provideLaborDayData() 91 | { 92 | return [ 93 | '1893-09-04' => ['1893-09-04', false], 94 | '1894-09-03' => ['1894-09-03', true], 95 | '2015-09-07' => ['2015-09-07', true], 96 | '2016-09-05' => ['2016-09-05', true], 97 | '2020-09-06' => ['2020-09-06', false], 98 | '2020-09-07' => ['2020-09-07', true], 99 | '2020-09-08' => ['2020-09-08', false], 100 | '2025-09-01' => ['2025-09-01', true], 101 | '2025-09-02' => ['2025-09-02', false], 102 | ]; 103 | } 104 | 105 | /** 106 | * @dataProvider provideVeteransDayData 107 | */ 108 | public function test_it_knows_veterans_day($date, $validity) 109 | { 110 | $date = Carbon::parse($date); 111 | 112 | $this->assertSame($validity, $date->isVeteransDay()); 113 | } 114 | 115 | public function provideVeteransDayData() 116 | { 117 | return [ 118 | '1953-11-11' => ['1953-11-11', false], 119 | '1954-11-11' => ['1954-11-11', true], 120 | '2020-11-10' => ['2020-11-10', false], 121 | '2020-11-11' => ['2020-11-11', true], 122 | '2020-11-12' => ['2020-11-12', false], 123 | '2050-11-11' => ['2050-11-11', true], 124 | ]; 125 | } 126 | 127 | /** 128 | * @dataProvider provideAmericanThanksgivingData 129 | */ 130 | public function test_it_knows_us_thanksgiving_day($date, $validity) 131 | { 132 | $date = Carbon::parse($date); 133 | 134 | $this->assertSame($validity, $date->isAmericanThanksgiving()); 135 | } 136 | 137 | public function provideAmericanThanksgivingData() 138 | { 139 | return [ 140 | '1788-11-27' => ['1788-11-27', false], 141 | '1789-11-26' => ['1789-11-26', true], 142 | '2019-11-27' => ['2019-11-27', false], 143 | '2019-11-28' => ['2019-11-28', true], 144 | '2020-11-25' => ['2020-11-25', false], 145 | '2020-11-26' => ['2020-11-26', true], 146 | '2020-11-27' => ['2020-11-27', false], 147 | '2021-11-25' => ['2021-11-25', true], 148 | '2022-11-24' => ['2022-11-24', true], 149 | ]; 150 | } 151 | 152 | /** 153 | * @dataProvider providePresidentsDayData 154 | */ 155 | public function test_it_knows_presidents_day($date, $validity) 156 | { 157 | $date = Carbon::parse($date); 158 | 159 | $this->assertSame($validity, $date->isPresidentsDay()); 160 | } 161 | 162 | public function providePresidentsDayData() 163 | { 164 | return [ 165 | '1879-02-17' => ['1879-02-17', false], 166 | '1880-02-16' => ['1880-02-16', true], 167 | '2017-02-20' => ['2017-02-20', true], 168 | '2018-02-19' => ['2018-02-19', true], 169 | '2019-02-18' => ['2019-02-18', true], 170 | '2020-02-17' => ['2020-02-17', true], 171 | '2029-02-19' => ['2029-02-19', true], 172 | ]; 173 | } 174 | 175 | /** 176 | * @dataProvider provideColumbusDayData 177 | */ 178 | public function test_it_knows_columbus_day($date, $validity) 179 | { 180 | $date = Carbon::parse($date); 181 | 182 | $this->assertSame($validity, $date->isColumbusDay()); 183 | } 184 | 185 | public function provideColumbusDayData() 186 | { 187 | return [ 188 | '1868-10-12' => ['1868-10-12', false], 189 | '1869-10-11' => ['1869-10-11', true], 190 | '2020-10-13' => ['2020-10-13', false], 191 | '2022-10-11' => ['2022-10-11', false], 192 | '2015-10-12' => ['2015-10-12', true], 193 | '2016-10-10' => ['2016-10-10', true], 194 | '2017-10-09' => ['2017-10-09', true], 195 | '2018-10-08' => ['2018-10-08', true], 196 | '2019-10-14' => ['2019-10-14', true], 197 | '2019-10-15' => ['2019-10-15', false], 198 | '2020-10-12' => ['2020-10-12', true], 199 | '2021-10-11' => ['2021-10-11', true], 200 | '2022-10-10' => ['2022-10-10', true], 201 | '2023-10-09' => ['2023-10-09', true], 202 | '2024-10-14' => ['2024-10-14', true], 203 | '2025-10-13' => ['2025-10-13', true], 204 | ]; 205 | } 206 | 207 | /** 208 | * @dataProvider provideNewYearsEveData 209 | */ 210 | public function test_it_knows_new_years_eve($date, $validity) 211 | { 212 | $date = Carbon::parse($date); 213 | 214 | $this->assertSame($validity, $date->isNewYearsEve()); 215 | } 216 | 217 | public function provideNewYearsEveData() 218 | { 219 | return [ 220 | '1800-12-31' => ['1800-12-31', true], 221 | '1950-12-31' => ['1950-12-31', true], 222 | '2020-07-04' => ['2020-07-04', false], 223 | '2020-12-30' => ['2020-12-30', false], 224 | '2020-12-31' => ['2020-12-31', true], 225 | '2021-01-01' => ['2021-01-01', false], 226 | '2050-12-31' => ['2050-12-31', true], 227 | ]; 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /tests/UkrainianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isUkrainianIndependenceDay()); 16 | } 17 | 18 | public function provideIndependenceDayData() 19 | { 20 | return [ 21 | '1980-08-24' => ['1980-08-24', false], 22 | '2019-08-24' => ['2019-08-24', true], 23 | '2019-08-05' => ['2019-08-05', false], 24 | '2010-03-06' => ['2010-03-06', false], 25 | '2022-08-24' => ['2022-08-24', true], 26 | '1991-08-24' => ['1991-08-24', true], 27 | '2050-08-01' => ['2050-08-01', false], 28 | '2050-08-24' => ['2050-08-24', true], 29 | ]; 30 | } 31 | 32 | /** 33 | * @dataProvider provideConstitutionDayData 34 | */ 35 | public function test_it_knows_constitution_day($date, $validity) 36 | { 37 | $date = Carbon::parse($date); 38 | 39 | $this->assertSame($validity, $date->isUkrainianConstitutionDay()); 40 | } 41 | 42 | public function provideConstitutionDayData() 43 | { 44 | return [ 45 | '1979-08-24' => ['1979-08-28', false], 46 | '2019-08-24' => ['2019-06-28', true], 47 | '2019-08-05' => ['2019-08-05', false], 48 | '1991-06-06' => ['1991-06-06', false], 49 | '2022-08-24' => ['2022-08-24', false], 50 | '1996-06-28' => ['1996-06-28', true], 51 | '2050-12-01' => ['2050-12-01', false], 52 | '2050-06-28' => ['2050-06-28', true], 53 | ]; 54 | } 55 | 56 | /** 57 | * @dataProvider provideLabourDayData 58 | */ 59 | public function test_it_knows_ukrainian_labour_day($date, $validity) 60 | { 61 | $date = Carbon::parse($date); 62 | 63 | $this->assertSame($validity, $date->isUkrainianLabourDay()); 64 | } 65 | 66 | public function provideLabourDayData() 67 | { 68 | return [ 69 | '1986-05-01' => ['1986-05-01', true], 70 | '2019-05-01' => ['2019-05-01', true], 71 | '2019-10-05' => ['2019-10-05', false], 72 | '2010-12-01' => ['2010-12-01', false], 73 | '2022-05-01' => ['2022-05-01', true], 74 | '1992-05-01' => ['1992-05-01', true], 75 | '2050-08-01' => ['2050-08-01', false], 76 | '2050-05-01' => ['2050-05-01', true], 77 | ]; 78 | } 79 | 80 | /** 81 | * @dataProvider provideUkraineDefenderDay 82 | */ 83 | public function test_it_knows_ukraine_defender_day($date, $validity) 84 | { 85 | $date = Carbon::parse($date); 86 | 87 | $this->assertSame($validity, $date->isUkraineDefenderDay()); 88 | } 89 | 90 | public function provideUkraineDefenderDay() 91 | { 92 | return [ 93 | '1970-08-14' => ['1970-08-14', false], 94 | '2019-10-14' => ['2019-10-14', true], 95 | '2019-10-05' => ['2019-10-05', false], 96 | '2010-10-14' => ['2010-10-14', false], 97 | '2015-10-14' => ['2015-10-14', true], 98 | '2005-11-14' => ['2005-11-14', false], 99 | '2040-02-23' => ['2040-02-23', false], 100 | '2050-10-14' => ['2050-10-14', true], 101 | ]; 102 | } 103 | 104 | /** 105 | * @dataProvider provideKupalaNight 106 | */ 107 | public function test_it_knows_kupala_night($date, $validity) 108 | { 109 | $date = Carbon::parse($date); 110 | 111 | $this->assertSame($validity, $date->isKupalaNight()); 112 | } 113 | 114 | public function provideKupalaNight() 115 | { 116 | return [ 117 | '1987-08-14' => ['1987-08-14', false], 118 | '2019-07-06' => ['2019-07-06', true], 119 | '2015-07-07' => ['2015-07-07', true], 120 | '2019-07-05' => ['2019-07-05', false], 121 | '2010-10-14' => ['2010-10-14', false], 122 | '2005-11-14' => ['2005-11-14', false], 123 | '2040-07-06' => ['2040-07-06', true], 124 | '2050-07-06' => ['2050-07-06', true], 125 | ]; 126 | } 127 | 128 | /** 129 | * @dataProvider provideVictoryDayOverNazism 130 | */ 131 | public function test_it_knows_victory_day($date, $validity) 132 | { 133 | $date = Carbon::parse($date); 134 | 135 | $this->assertSame($validity, $date->isVictoryDayOverNazism()); 136 | } 137 | 138 | public function provideVictoryDayOverNazism() 139 | { 140 | return [ 141 | '1990-05-09' => ['1990-05-09', false], 142 | '2019-05-09' => ['2019-05-09', true], 143 | '2015-05-09' => ['2015-05-09', true], 144 | '2010-05-09' => ['2010-05-09', false], 145 | '2006-10-11' => ['2006-10-11', false], 146 | '2005-11-14' => ['2005-11-14', false], 147 | '2040-02-26' => ['2040-02-26', false], 148 | '2050-05-09' => ['2050-05-09', true], 149 | ]; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /tests/ZambianHolidaysTest.php: -------------------------------------------------------------------------------- 1 | assertSame($validity, $date->isZambianIndependenceDay()); 17 | } 18 | 19 | public function provideZambianIndependenceDayData() 20 | { 21 | return [ 22 | '1963-10-24' => ['1964-10-24', true], 23 | '1963-10-23' => ['1964-10-23', false], 24 | '2020-01-19' => ['2020-01-19', false], 25 | '2022-10-24' => ['2022-10-24', true], 26 | '1800-02-18' => ['1800-02-18', false], 27 | ]; 28 | } 29 | /** 30 | * @dataProvider provideZambianLabourDayData 31 | */ 32 | public function test_it_recognizes_zambian_labour_day($date, $validity) 33 | { 34 | $date = Carbon::parse($date); 35 | 36 | $this->assertSame($validity, $date->isZambianLabourDay()); 37 | } 38 | 39 | public function provideZambianLabourDayData() 40 | { 41 | return [ 42 | '1963-05-01' => ['1963-05-01', true], 43 | '1963-12-11' => ['1963-12-11', false], 44 | '2020-10-19' => ['2020-10-19', false], 45 | '2020-05-01' => ['2020-05-01', true], 46 | '2010-05-01' => ['2010-05-01', true], 47 | ]; 48 | } 49 | /** 50 | * @dataProvider provideZambianWomensDayData 51 | */ 52 | public function test_it_recognizes_zambian_womens_day($date, $validity) 53 | { 54 | $date = Carbon::parse($date); 55 | 56 | $this->assertSame($validity, $date->isZambianWomensDay()); 57 | } 58 | 59 | public function provideZambianWomensDayData() 60 | { 61 | return [ 62 | '1997-03-08' => ['1997-03-08', false], 63 | '2019-03-08' => ['2019-03-08', true], 64 | '2019-03-09' => ['2019-03-09', false], 65 | '2020-03-08' => ['2020-03-08', false], 66 | '2020-03-09' => ['2020-03-09', true], 67 | '2021-03-08' => ['2021-03-08', true], 68 | '2019-12-08' => ['2019-12-08', false], 69 | '2025-03-08' => ['2025-03-08', false], 70 | '2025-03-10' => ['2025-03-10', true], 71 | ]; 72 | } 73 | 74 | /** 75 | * @dataProvider provideZambianYouthDayData 76 | */ 77 | public function test_it_recognizes_zambian_youth_day($date, $validity) 78 | { 79 | $date = Carbon::parse($date); 80 | 81 | $this->assertSame($validity, $date->isZambianYouthDay()); 82 | } 83 | 84 | public function provideZambianYouthDayData() 85 | { 86 | return [ 87 | '1963-03-12' => ['1963-03-12', false], 88 | '1993-12-11' => ['1993-12-11', false], 89 | '1966-03-12' => ['1966-03-12', true], 90 | '2002-03-12' => ['2002-03-12', true], 91 | '2025-03-12' => ['2025-03-12', true], 92 | ]; 93 | } 94 | /** 95 | * @dataProvider provideZambianAfricanUnityDayData 96 | */ 97 | public function test_it_recognizes_zambian_african_unity_day($date, $validity) 98 | { 99 | $date = Carbon::parse($date); 100 | 101 | $this->assertSame($validity, $date->isZambianAfricanUnityDay()); 102 | } 103 | 104 | public function provideZambianAfricanUnityDayData() 105 | { 106 | return [ 107 | '1963-03-12' => ['1963-03-12', false], 108 | '1993-12-11' => ['1993-12-11', false], 109 | '1966-05-25' => ['1966-05-25', true], 110 | '2002-05-25' => ['2002-05-25', true], 111 | '2025-05-25' => ['2025-05-25', true], 112 | ]; 113 | } 114 | /** 115 | * @dataProvider provideZambianAfricaDayData 116 | */ 117 | public function test_it_recognizes_zambian_africa_day($date, $validity) 118 | { 119 | $date = Carbon::parse($date); 120 | 121 | $this->assertSame($validity, $date->isZambianAfricaDay()); 122 | } 123 | 124 | public function provideZambianAfricaDayData() 125 | { 126 | return [ 127 | '1963-03-12' => ['1963-03-12', false], 128 | '1993-12-11' => ['1993-12-11', false], 129 | '1966-05-25' => ['1966-05-25', true], 130 | '2002-05-25' => ['2002-05-25', true], 131 | '2025-05-25' => ['2025-05-25', true], 132 | ]; 133 | } 134 | /** 135 | * @dataProvider provideZambianHeroesDayData 136 | */ 137 | public function test_it_recognizes_zambian_heroes_day($date, $validity) 138 | { 139 | $date = Carbon::parse($date); 140 | 141 | $this->assertSame($validity, $date->isZambianHeroesDay()); 142 | } 143 | 144 | public function provideZambianHeroesDayData() 145 | { 146 | return [ 147 | '1963-07-01' => ['1963-07-01', false], 148 | '1993-03-11' => ['1993-03-11', false], 149 | '1966-07-04' => ['1966-07-04', true], 150 | '2002-07-01' => ['2002-07-01', true], 151 | '2025-07-07' => ['2025-07-07', true], 152 | ]; 153 | } 154 | /** 155 | * @dataProvider provideZambianUnityDayData 156 | */ 157 | public function test_it_recognizes_zambian_unity_day($date, $validity) 158 | { 159 | $date = Carbon::parse($date); 160 | 161 | $this->assertSame($validity, $date->isZambianUnityDay()); 162 | } 163 | 164 | public function provideZambianUnityDayData() 165 | { 166 | return [ 167 | '1963-01-02' => ['1963-01-02', false], 168 | '1993-07-12' => ['1993-07-12', false], 169 | '1966-07-05' => ['1966-07-05', true], 170 | '2002-07-02' => ['2002-07-02', true], 171 | '2025-07-08' => ['2025-07-08', true], 172 | ]; 173 | } 174 | /** 175 | * @dataProvider provideZambianFarmersDayData 176 | */ 177 | public function test_it_recognizes_zambian_farmers_day($date, $validity) 178 | { 179 | $date = Carbon::parse($date); 180 | 181 | $this->assertSame($validity, $date->isZambianFarmersDay()); 182 | } 183 | 184 | public function provideZambianFarmersDayData() 185 | { 186 | return [ 187 | '1963-08-02' => ['1963-08-02', false], 188 | '1993-12-12' => ['1993-12-12', false], 189 | '1966-08-01' => ['1966-08-01', true], 190 | '2002-08-05' => ['2002-08-05', true], 191 | '2025-08-04' => ['2025-08-04', true], 192 | ]; 193 | } 194 | /** 195 | * @dataProvider provideZambianNationalPrayerDayData 196 | */ 197 | public function test_it_recognizes_zambian_national_prayer_day($date, $validity) 198 | { 199 | $date = Carbon::parse($date); 200 | 201 | $this->assertSame($validity, $date->isZambianNationalPrayerDay()); 202 | } 203 | 204 | public function provideZambianNationalPrayerDayData() 205 | { 206 | return [ 207 | '1963-10-02' => ['1963-10-02', false], 208 | '1993-03-12' => ['1993-03-12', false], 209 | '1966-10-18' => ['1966-10-18', false], 210 | '2018-10-18' => ['2018-10-18', true], 211 | '2025-10-18' => ['2025-10-18', true], 212 | ]; 213 | } 214 | } 215 | --------------------------------------------------------------------------------