diff --git a/README.md b/README.md index d17598b..844c8b4 100644 --- a/README.md +++ b/README.md @@ -403,22 +403,16 @@ $ XDEBUG_MODE=coverage ./vendor/bin/phpunit ---- -Test against Carbon v1 -``` -$ ./tests/carbon-1.sh -``` - Test against Carbon v2 ``` $ ./tests/carbon-2.sh ``` -Test Both Carbon v1 and v2 +Test against Carbon v3 ``` -$ ./tests/carbon-1-2.sh +$ ./tests/carbon-3.sh ``` - ### See It Used in the Wild [GBPN](https://gbpn.com/resources/branding-and-design/us-holiday-calendar) - Ongoing US Holiday Calendar [Canny Armadillo](https://cannyarmadillo.com/resources/us-holiday-calendar) - Next 12 Months diff --git a/Tests/carbon-3.sh b/Tests/carbon-3.sh new file mode 100755 index 0000000..14728d5 --- /dev/null +++ b/Tests/carbon-3.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cp composer.json original-composer.json +rm composer.lock + +rm -rf vendor +composer remove nesbot/carbon +composer require nesbot/carbon:3.* --no-plugins + +rm composer.json +mv original-composer.json composer.json + +./vendor/bin/phpunit diff --git a/composer.json b/composer.json index e798559..c3d38d9 100644 --- a/composer.json +++ b/composer.json @@ -4,8 +4,8 @@ "keywords": ["Bank Holiday", "Holiday", "Holidays", "Carbon", "US Holiday", "US Holidays"], "license": "MIT", "require": { - "nesbot/carbon": "^1.22|^2.24.0", - "php": "^7.1 || ^8.0", + "nesbot/carbon": "^2.24.0|^3.0", + "php": "^7.4 || ^8.0", "ext-calendar": "*" }, "autoload": { @@ -19,7 +19,7 @@ } }, "require-dev": { - "phpunit/phpunit": "^5|^6|^7.5|^8.0|^9.0", + "phpunit/phpunit": "^5|^6|^7.5|^8.0|^9.0|^10.0", "php-coveralls/php-coveralls": "^2.5" }, "config": { diff --git a/phpunit.xml b/phpunit.xml index d8a934b..99efb73 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,30 +1,23 @@ - - - - src/ - - - - - - - - - Tests - - - - - - + + + + + + + + + + Tests + + + + + + + + + src/ + + diff --git a/src/USHolidays/Carbon.php b/src/USHolidays/Carbon.php index 984d2ce..722921d 100644 --- a/src/USHolidays/Carbon.php +++ b/src/USHolidays/Carbon.php @@ -115,7 +115,7 @@ public function getHolidaysByYear($name='all', int $year=null): array $date = call_user_func($holidays[$index]['date']); $this->year = $currentYear; - $days_until = $this->diffInDays($date); + $days_until = abs($this->diffInDays($date)); $bankHoliday = $holidays[$index]['bank_holiday']; // if($bankHoliday && $bankHolidayCheck) { @@ -162,7 +162,7 @@ public function getHolidaysByYear($name='all', int $year=null): array $date = call_user_func($holidays[$index]['date']); $this->year = $currentYear; - $days_until = $this->diffInDays($date); + $days_until = abs($this->diffInDays($date)); $bankHoliday = $holidays[$index]['bank_holiday'];