From 7e72033859f60f529d4d985da1e9cac0a691b2dc Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 15 Oct 2025 00:12:19 +0200 Subject: Filter on last user modified (#8093) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Example: `userdate:PT1H` to select only articles modified by user during the last hour Fix https://github.com/FreshRSS/FreshRSS/issues/4280#issuecomment-3393078024 Useful for instance to bulk mark as unread recently marked articles by error: 1. Click on the toggle button to show the read articles (making sure the toggle for the unread articles is off) 2. Sort by *User modified 9→1* 3. Filter by *user modified date*, for instance to the last 3 hours by typing `userdate:PT3H` 4. Click in the drop-down menu *Mark selection as unread* P.S.: I have added at the same time a bunch of unit tests for date-related logic --- lib/lib_date.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/lib_date.php b/lib/lib_date.php index 9d4bcaa07..a44710da1 100644 --- a/lib/lib_date.php +++ b/lib/lib_date.php @@ -74,7 +74,7 @@ function _dateRelative(?string $d1, ?string $d2): ?string { if ($d2 === null) { return $d1 !== null && $d1[0] !== 'P' ? $d1 : null; } - if ($d2 !== '' && $d2[0] != 'P' && $d1 !== null && $d1[0] !== 'P') { + if ($d2 !== '' && $d2[0] !== 'P' && $d1 !== null && $d1[0] !== 'P') { $y2 = substr($d2, 0, 4); if (strlen($y2) < 4 || !ctype_digit($y2)) { //Does not start by a year $d2 = _noDelimit($d2); @@ -91,7 +91,7 @@ function _dateRelative(?string $d1, ?string $d2): ?string { */ function parseDateInterval(string $dateInterval): array { $dateInterval = trim($dateInterval); - $dateInterval = str_replace('--', '/', $dateInterval); + $dateInterval = str_replace(['--', ' '], ['/', 'T'], $dateInterval); $dateInterval = strtoupper($dateInterval); $min = null; $max = null; -- cgit v1.2.3