Skip to content

Commit 1813209

Browse files
authored
Refactor publication date query construction
1 parent 23e58da commit 1813209

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

greader.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -714,14 +714,16 @@ private static function streamContentsFilters(string $type, int|string $streamId
714714
}
715715

716716
if ($pub_start_time !== 0 || $pub_stop_time !== 0) {
717-
$pub_query = '';
718-
if ($pub_start_time !== 0) {
719-
$pub_query .= 'pubdate:>=' . $pub_start_time . ' ';
717+
/** @var string $range */
718+
$range = '';
719+
if ($pub_start_time !== 0 && $pub_stop_time !== 0) {
720+
$range = $pub_start_time . '/' . $pub_stop_time;
721+
} elseif ($pub_start_time !== 0) {
722+
$range = '>=' . $pub_start_time;
723+
} elseif ($pub_stop_time !== 0) {
724+
$range = '<=' . $pub_stop_time;
720725
}
721-
if ($pub_stop_time !== 0) {
722-
$pub_query .= 'pubdate:<=' . $pub_stop_time . ' ';
723-
}
724-
$pub_search = new FreshRSS_Search(trim($pub_query));
726+
$pub_search = new FreshRSS_Search('pubdate:' . $range);
725727
$searches->add($pub_search);
726728
}
727729

0 commit comments

Comments
 (0)