diff --git a/src/Generator.php b/src/Generator.php index daadae5..e5429df 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -271,7 +271,9 @@ protected function makeContentGenerationClosures($pages, $request) $oldCarbonFormat = $this->getToStringFormat(); if ($this->shouldSetCarbonFormat($page)) { - Carbon::setToStringFormat(Statamic::dateFormat()); + Date::setToStringFormat(function (Carbon $date) { + return $date->setTimezone(config('statamic.system.display_timezone'))->format(Statamic::dateFormat()); + }); } $this->updateCurrentSite($page->site()); @@ -489,7 +491,7 @@ protected function shouldRejectPage($page, $outputError = false) * * @throws \ReflectionException */ - protected function getToStringFormat(): ?string + protected function getToStringFormat(): string|\Closure|null { $reflection = new ReflectionClass($date = Date::now());