Skip to content

Commit

Permalink
Merge branch 'refs/heads/5.5' into 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyperghost committed Apr 26, 2024
2 parents 617fd39 + 9d555b2 commit fcdf916
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions wcfsetup/install/files/lib/system/search/SearchHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fcdf916

Please sign in to comment.