From 209f0b5d796f1f49c4f0ecb9f3dd61fe63303b8b Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Date: Thu, 15 Sep 2022 16:24:01 +0530 Subject: [PATCH] Respect calendar entries over multiple days on start_date filter #67 Now, you will get the event if it is lies in start_date and end_date For Example: An event is created on 15th sept. and end on 22nd sept. then if you will be fetching the event by passing start_date=2022-09-18 then the event will be getting, because it is lies in the date range --- controllers/calendar/CalendarController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/calendar/CalendarController.php b/controllers/calendar/CalendarController.php index eb1c1c9..d9f2d57 100644 --- a/controllers/calendar/CalendarController.php +++ b/controllers/calendar/CalendarController.php @@ -35,7 +35,7 @@ public function actionFind(){ if(isset($_GET['start_date']) || isset($_GET['end_date'])){ if(isset($_GET['start_date']) && !isset($_GET['end_date'])) { $start = $_GET['start_date']; - $query->andFilterWhere(['>=', 'start_datetime', $start]); + $query->andFilterWhere(['>=', 'start_datetime', $start])->orFilterWhere(['>=', 'end_datetime', $start]); } elseif (!isset($_GET['start_date']) && isset($_GET['end_date'])){ $end = $_GET['end_date']; @@ -113,7 +113,7 @@ public function actionFindByContainer($containerId) if(isset($_GET['start_date']) || isset($_GET['end_date'])){ if(isset($_GET['start_date']) && !isset($_GET['end_date'])) { $start = $_GET['start_date']; - $query->andFilterWhere(['>=', 'start_datetime', $start]); + $query->andFilterWhere(['>=', 'start_datetime', $start])->orFilterWhere(['>=', 'end_datetime', $start]); } elseif (!isset($_GET['start_date']) && isset($_GET['end_date'])){ $end = $_GET['end_date'];