Best way to fetch all events between 2 dates #311
Unanswered
MatthiasBrodelet
asked this question in
Questions & Answers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the recommended way to fetch all events between 2 dates?
I have the following code which works for small events that do not take longer than a day.
However, events that span multiple days won't be returned this way.
Let's say we have an event that starts at the 1st of August and ends on the 31th.
How could I fetch these as well if they overlap with the given timeframe?
$criteria = Event::find(); $criteria->calendarId = $calendarId; $criteria->startsAfter = $startDate; $criteria->endsBefore = $endDate; $criteria->orderBy('startDate ASC'); $events = $criteria->all();
Beta Was this translation helpful? Give feedback.
All reactions