Skip to content

Commit 003757e

Browse files
committed
Bring back dates key in return array
1 parent afe0029 commit 003757e

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

src/Tags/Events.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,23 @@ public function upcoming(): EntryCollection|array
138138

139139
private function day(string $date, EntryCollection $occurrences): array
140140
{
141+
$occurrences = $occurrences->map(function (Entry $occurrence) use ($date): Entry {
142+
if (!$occurrence->spanning) {
143+
return $occurrence;
144+
}
145+
146+
$carbonDate = Carbon::parse($date)->shiftTimezone($occurrence->start->timezone);
147+
$occurrence
148+
->setSupplement('spanning_start', $occurrence->start->isSameDay($carbonDate))
149+
->setSupplement('spanning_end', $occurrence->end->isSameDay($carbonDate));
150+
151+
return clone $occurrence;
152+
})->values();
153+
141154
return [
142155
'date' => $date,
143-
'occurrences' => $occurrences->map(function (Entry $occurrence) use ($date): Entry {
144-
if (!$occurrence->spanning) {
145-
return $occurrence;
146-
}
147-
148-
$carbonDate = Carbon::parse($date)->shiftTimezone($occurrence->start->timezone);
149-
$occurrence
150-
->setSupplement('spanning_start', $occurrence->start->isSameDay($carbonDate))
151-
->setSupplement('spanning_end', $occurrence->end->isSameDay($carbonDate));
152-
153-
return clone $occurrence;
154-
})->values(),
156+
'dates'=> $occurrences,
157+
'occurrences' => $occurrences,
155158
];
156159
}
157160

0 commit comments

Comments
 (0)