diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 1a55ec9..2d74ef1 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -167,6 +167,8 @@ class DateController extends ActionController $demand->setSortBy((string)$this->settings['sortByDate']); $demand->setSortOrder((string)$this->settings['sortOrder']); $demand->setHighlight((int)$this->settings['highlight']); + $demand->setStart((string)$this->settings['start'] ?? ''); + $demand->setEnd((string)$this->settings['end'] ?? ''); if (!empty($this->settings['limit'])) { $demand->setLimit($this->settings['limit']); diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index 6ac94e9..6204037 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -80,14 +80,14 @@ class DateRepository extends Repository $constraints['userCategories'] = $query->in('event.categories.uid', $demand->getUserCategories()); } - if ($demand->getStart() !== '' && $demand->getEnd() != '') { - $constraints['daterange'] = $query->logicalAnd( - [ - $query->greaterThanOrEqual('start', $demand->getStart()), - $query->lessThanOrEqual('end', $demand->getEnd()) - ] - ); - } else { + if ($demand->getStart() !== '') { + $constraints['starts'] = $query->greaterThanOrEqual('start', $demand->getStart()); + } + if ($demand->getEnd() != '') { + $constraints['ends'] = $query->lessThanOrEqual('end', $demand->getEnd()); + } + + if ($demand->getStart() === '' && $demand->getEnd() === '') { $now = new \DateTime('now', new \DateTimeZone('Europe/Berlin')); $constraints['untilnow'] = $query->greaterThanOrEqual('start', $now); }