File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66use Carbon \CarbonImmutable ;
77use Carbon \CarbonInterface ;
88use Carbon \CarbonPeriod ;
9+ use Carbon \CarbonPeriodImmutable ;
910use Illuminate \Pagination \Paginator ;
1011use Illuminate \Support \Collection ;
1112use Statamic \Contracts \Query \Builder ;
@@ -47,10 +48,14 @@ public function calendar(): Collection
4748 ->generator ()
4849 ->between (from: $ from , to: $ to )
4950 ->groupBy (function (Entry $ occurrence ) {
50- $ start = $ occurrence ->start ->setTimezone ($ this ->params ->get ('timezone ' ) ?? Generator::timezone ());
51- $ end = $ occurrence ->end ->setTimezone ($ this ->params ->get ('timezone ' ) ?? Generator::timezone ());
52-
53- return $ start ->isSameDay ($ end ) ? $ start ->toDateString () : [$ start ->toDateString (), $ end ->toDateString ()];
51+ $ periodInTimezone = CarbonPeriodImmutable::between (
52+ $ occurrence ->start ->setTimezone ($ this ->params ->get ('timezone ' ) ?? Generator::timezone ())->startOfDay (),
53+ $ occurrence ->end ->setTimezone ($ this ->params ->get ('timezone ' ) ?? Generator::timezone ())->endOfDay ()
54+ );
55+
56+ return collect ($ periodInTimezone ->toArray ())
57+ ->map (fn (CarbonImmutable $ date ) => $ date ->toDateString ())
58+ ->all ();
5459 })
5560 ->map (fn (EntryCollection $ occurrences , string $ date ) => $ this ->day (date: $ date , occurrences: $ occurrences ));
5661
You can’t perform that action at this time.
0 commit comments