diff --git a/svelte-ui/src/pages/LogsPage.svelte b/svelte-ui/src/pages/LogsPage.svelte index 734e755..f314942 100644 --- a/svelte-ui/src/pages/LogsPage.svelte +++ b/svelte-ui/src/pages/LogsPage.svelte @@ -11,18 +11,29 @@ let minTime = formatFormTime($logStore.filter.minTime || startOfWeek(new Date())); let maxTime = formatFormTime(endOfWeek(new Date())); let emptyMessage = `No logs since ${formatWeekdayDate(minTime)}.`; + let error = ""; $: { const min = new Date(minTime); const max = new Date(maxTime); - if (!$logStore.loading) { - if ($logStore.stale || $logStore.filter.minTime?.getTime() != min.getTime() || $logStore.filter.maxTime?.getTime() != max.getTime()) { - logStore.load({ - minTime: min, - maxTime: max, - }); + error = ""; + + if (!Number.isNaN(min.getTime()) && !Number.isNaN(max.getTime())) { + if (min.getTime() < max.getTime()) { + if (!$logStore.loading) { + if ($logStore.stale || $logStore.filter.minTime?.getTime() != min.getTime() || $logStore.filter.maxTime?.getTime() != max.getTime()) { + logStore.load({ + minTime: min, + maxTime: max, + }); + } + } + } else { + error = "Time only goes one way in this universe, you should respect that." } + } elseĀ { + error = "The dates must be valid." } } @@ -82,6 +93,7 @@
+
{error}
{#each groupedLogs as logGroup (logGroup.day)}

{logGroup.text}

@@ -97,6 +109,14 @@