fix: event date filters unusable (datetime-local, no apply)

The unit and vibration-location event tabs used datetime-local From/To inputs
with onchange. Picking a date but leaving the time blank left the value empty,
so nothing applied — and there was no Apply button, so date-only filtering was
impossible.

Switch From/To to plain date inputs (apply immediately on selection) and send
a full inclusive day to the backend (From 00:00:00 → To 23:59:59).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 19:39:31 +00:00
parent 93f01be471
commit c45fcd7804
2 changed files with 10 additions and 8 deletions
+5 -4
View File
@@ -473,12 +473,12 @@
</div>
<div class="flex flex-col gap-1">
<label class="text-xs text-gray-500 dark:text-gray-400">From</label>
<input type="datetime-local" id="ue-filter-from" onchange="loadUnitEvents()"
<input type="date" id="ue-filter-from" onchange="loadUnitEvents()"
class="px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-slate-700 text-gray-900 dark:text-white">
</div>
<div class="flex flex-col gap-1">
<label class="text-xs text-gray-500 dark:text-gray-400">To</label>
<input type="datetime-local" id="ue-filter-to" onchange="loadUnitEvents()"
<input type="date" id="ue-filter-to" onchange="loadUnitEvents()"
class="px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-slate-700 text-gray-900 dark:text-white">
</div>
<div class="flex flex-col gap-1">
@@ -2882,8 +2882,9 @@ async function loadUnitEvents() {
const ft = document.getElementById('ue-filter-ft').value;
const limit = document.getElementById('ue-filter-limit').value;
params.set('bucket', bucket);
if (from) params.set('from_dt', from.replace('T', ' '));
if (to) params.set('to_dt', to.replace('T', ' '));
// Date inputs: From = start of that day, To = inclusive end of that day.
if (from) params.set('from_dt', from + ' 00:00:00');
if (to) params.set('to_dt', to + ' 23:59:59');
if (ft) params.set('false_trigger', ft);
params.set('limit', limit);