Skip to content

Commit

Permalink
allow both carbon and carbonimmutable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jan 15, 2024
1 parent 68bd5c4 commit 7deb4f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Holidays.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Spatie\Holidays;

use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Spatie\Holidays\Countries\Country;

class Holidays
Expand Down Expand Up @@ -37,7 +38,7 @@ public static function get(?string $country = null, ?int $year = null): array
->toArray();
}

public function isHoliday(CarbonImmutable|string $date, string $countryCode): bool
public function isHoliday(CarbonInterface|string $date, string $countryCode): bool
{
if (! $date instanceof CarbonImmutable) {
$date = CarbonImmutable::parse($date);
Expand All @@ -58,7 +59,7 @@ public function isHoliday(CarbonImmutable|string $date, string $countryCode): bo
return false;
}

public function getName(CarbonImmutable|string $date, string $countryCode): ?string
public function getName(CarbonInterface|string $date, string $countryCode): ?string
{
if (! $date instanceof CarbonImmutable) {
$date = CarbonImmutable::parse($date);
Expand Down

0 comments on commit 7deb4f8

Please sign in to comment.