Fix date searches.

This commit is contained in:
James Cole 2020-08-22 13:02:33 +02:00
parent ab5a146277
commit 14df37712c
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D

View File

@ -487,7 +487,6 @@ class OperatorQuerySearch implements SearchInterface
case 'date_before': case 'date_before':
$range = $this->parseDateRange($value); $range = $this->parseDateRange($value);
Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d'))); Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));
$this->collector->setRange($range['start'], $range['end']);
// add to operators manually: // add to operators manually:
$this->operators->push(['type' => 'date_before', 'value' => $range['start']->format('Y-m-d'),]); $this->operators->push(['type' => 'date_before', 'value' => $range['start']->format('Y-m-d'),]);
@ -497,10 +496,9 @@ class OperatorQuerySearch implements SearchInterface
case 'date_after': case 'date_after':
$range = $this->parseDateRange($value); $range = $this->parseDateRange($value);
Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d'))); Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));
$this->collector->setRange($range['start'], $range['end']);
// add to operators manually: // add to operators manually:
$this->operators->push(['type' => 'date_before', 'value' => $range['end']->format('Y-m-d'),]); $this->operators->push(['type' => 'date_after', 'value' => $range['end']->format('Y-m-d'),]);
$this->collector->setAfter($range['end']); $this->collector->setAfter($range['end']);
return false; return false;