From e5c3a5b28f3bed6048c31320a2eb13513ed74380 Mon Sep 17 00:00:00 2001 From: Haylan Date: Thu, 17 Sep 2026 12:38:54 +0200 Subject: [PATCH] fix(dump): normalize date-filter bounds to the app timezone before applying day boundary The admin date filter can send a naive local date string for "from" but a UTC Z-suffixed instant for "to" (sw-date-filter widens it client-side via Date#toISOString()). Comparing those directly against dump timestamps (parsed in PHP's default timezone) shifted the effective cutoff by the timezone offset. Re-express both bounds in the app's default timezone before applying the day boundary. Co-Authored-By: Claude Sonnet 5 --- src/Controller/DumpController.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Controller/DumpController.php b/src/Controller/DumpController.php index 175d498..16768e4 100644 --- a/src/Controller/DumpController.php +++ b/src/Controller/DumpController.php @@ -54,10 +54,14 @@ class DumpController } /** - * The datepicker emits ISO-8601 UTC strings (e.g. "2026-03-01T00:00:00.000Z") - * in date mode. An empty bound (no date set) stays null so the range is open - * on that side. The "to" side is widened to end-of-day so selecting a date - * includes every dump created that day, not just before midnight. + * The admin's date filter sends mixed shapes: the "from" bound is a naive local + * date string with no timezone marker (e.g. "2026-03-01T00:00:00"), while + * sw-date-filter widens "to" to end-of-day client-side via `Date#toISOString()`, + * which is always UTC (e.g. "2026-03-01T23:59:59.000Z"). Re-expressing both in + * PHP's default timezone (the same one DumpFilenameParser uses) before applying + * our own day-boundary keeps the calendar day the user actually picked, regardless + * of which shape arrived. An empty bound (no date set) stays null so the range is + * open on that side. */ private function parseBoundDate(?string $value, bool $endOfDay): ?\DateTimeImmutable { @@ -66,7 +70,7 @@ class DumpController } try { - $dateTime = new \DateTimeImmutable($value); + $dateTime = (new \DateTimeImmutable($value))->setTimezone(new \DateTimeZone(date_default_timezone_get())); } catch (\Exception) { return null; }