Skip to content

Commit

Permalink
Merge pull request #196 from spatie/fix/date-time-mutation-for-timezone
Browse files Browse the repository at this point in the history
Copy non immutable dates to apply timezone
  • Loading branch information
kylekatarnls authored Jul 23, 2022
2 parents 4f0a840 + 8343e61 commit bce146a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/OpeningHours.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,10 @@ protected function normalizeDayName(string $day)
protected function applyTimezone(DateTimeInterface $date)
{
if ($this->timezone) {
if ($date instanceof DateTime) {
$date = clone $date;
}

$date = $date->setTimezone($this->timezone);
}

Expand Down

0 comments on commit bce146a

Please sign in to comment.