Skip to content

Commit 69f29f4

Browse files
authored
[6.x] Fix TypeError with CarbonImmutable in Timezone Support (#13760)
1 parent 35438d5 commit 69f29f4

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Http/Middleware/CP/Localize.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Statamic\Http\Middleware\CP;
44

5-
use Carbon\Carbon;
5+
use Carbon\CarbonInterface;
66
use Closure;
77
use DateTime;
88
use Illuminate\Support\Facades\Date;
@@ -24,7 +24,7 @@ public function handle($request, Closure $next)
2424

2525
// Get original Carbon format so it can be restored later.
2626
$originalToStringFormat = $this->getToStringFormat();
27-
Date::setToStringFormat(function (Carbon $date) {
27+
Date::setToStringFormat(function (CarbonInterface $date) {
2828
return $date->setTimezone(Statamic::displayTimezone())->format(Statamic::dateFormat());
2929
});
3030

src/Http/Middleware/Localize.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Statamic\Http\Middleware;
44

5-
use Carbon\Carbon;
5+
use Carbon\CarbonInterface;
66
use Closure;
77
use Illuminate\Support\Facades\Date;
88
use ReflectionClass;
@@ -32,7 +32,7 @@ public function handle($request, Closure $next)
3232

3333
// Get original Carbon format so it can be restored later.
3434
$originalToStringFormat = $this->getToStringFormat();
35-
Date::setToStringFormat(function (Carbon $date) {
35+
Date::setToStringFormat(function (CarbonInterface $date) {
3636
return $date->setTimezone(Statamic::displayTimezone())->format(Statamic::dateFormat());
3737
});
3838

0 commit comments

Comments
 (0)