diff --git a/wcfsetup/install/files/lib/system/search/SearchHandler.class.php b/wcfsetup/install/files/lib/system/search/SearchHandler.class.php index 533dd401564..1640eeba322 100644 --- a/wcfsetup/install/files/lib/system/search/SearchHandler.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchHandler.class.php @@ -148,8 +148,30 @@ private function buildUserCondition(): void private function buildDateCondition(): void { - $startDate = !empty($this->parameters['startDate']) ? @\strtotime($this->parameters['startDate']) : 0; - $endDate = !empty($this->parameters['endDate']) ? @\strtotime($this->parameters['endDate']) : 0; + if (!empty($this->parameters['startDate'])) { + $startDateTime = \DateTime::createFromFormat( + "Y-m-d", + $this->parameters['startDate'], + WCF::getUser()->getTimezone() + ); + $startDateTime->setTime(0, 0, 0); + $startDate = $startDateTime->getTimestamp(); + } else { + $startDate = 0; + } + + if (!empty($this->parameters['endDate'])) { + $endDateTime = \DateTime::createFromFormat( + "Y-m-d", + $this->parameters['endDate'], + WCF::getUser()->getTimezone() + ); + $endDateTime->setTime(23, 59, 59); + $endDate = $endDateTime->getTimestamp(); + } else { + $endDate = 0; + } + if ($startDate && $endDate) { $this->conditionBuilder->add('time BETWEEN ? AND ?', [$startDate, $endDate]); } elseif ($startDate) {