feat(dump): date-range filter, sortable columns, native date formatting #10

Merged
haylan merged 6 commits from feat/dump-list-view into main 2026-09-21 18:00:42 +00:00
Showing only changes of commit e5c3a5b28f - Show all commits
+9 -5
View File
@@ -54,10 +54,14 @@ class DumpController
} }
/** /**
* The datepicker emits ISO-8601 UTC strings (e.g. "2026-03-01T00:00:00.000Z") * The admin's date filter sends mixed shapes: the "from" bound is a naive local
* in date mode. An empty bound (no date set) stays null so the range is open * date string with no timezone marker (e.g. "2026-03-01T00:00:00"), while
* on that side. The "to" side is widened to end-of-day so selecting a date * sw-date-filter widens "to" to end-of-day client-side via `Date#toISOString()`,
* includes every dump created that day, not just before midnight. * 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 private function parseBoundDate(?string $value, bool $endOfDay): ?\DateTimeImmutable
{ {
@@ -66,7 +70,7 @@ class DumpController
} }
try { try {
$dateTime = new \DateTimeImmutable($value); $dateTime = (new \DateTimeImmutable($value))->setTimezone(new \DateTimeZone(date_default_timezone_get()));
} catch (\Exception) { } catch (\Exception) {
return null; return null;
} }