Skip to content

Commit e257ea1

Browse files
committed
let Claude do some magic
1 parent 62fc8f1 commit e257ea1

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/Types/Event.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public function occurrencesBetween(string|CarbonInterface $from, string|CarbonIn
6767
$tz = $this->timezone['name'];
6868

6969
return $this->collect($this->rule()->getOccurrencesBetween(
70-
begin: $from->shiftTimezone($tz),
71-
end: $to->shiftTimezone($tz)
72-
));
70+
begin: $from->toImmutable()->shiftTimezone($tz)->subDay(),
71+
end: $to->toImmutable()->shiftTimezone($tz)->addDay()
72+
))->filter(fn (Entry $entry) => $entry->start >= $from && $entry->start <= $to);
7373
}
7474

7575
public function occursOnDate(string|CarbonInterface $date): bool
@@ -159,10 +159,12 @@ protected function eventUrl(): ?string
159159

160160
protected function supplement(CarbonInterface $date): ?Entry
161161
{
162+
$appTz = config('app.timezone');
163+
162164
return unserialize(serialize($this->event))
163165
->setSupplement('multi_day', false)
164-
->setSupplement('start', $date->setTimeFromTimeString($this->startTime()))
165-
->setSupplement('end', $date->setTimeFromTimeString($this->endTime()))
166+
->setSupplement('start', $date->setTimeFromTimeString($this->startTime())->setTimezone($appTz))
167+
->setSupplement('end', $date->setTimeFromTimeString($this->endTime())->setTimezone($appTz))
166168
->setSupplement('has_end_time', $this->hasEndTime());
167169
}
168170

0 commit comments

Comments
 (0)