File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments