From c0c81ef3f2298cb00b90ce539fb7f9fb71aa7c9c Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Tue, 24 Sep 2024 16:28:12 -0600 Subject: [PATCH] Handle input with tags --- web/src/components/input/InputWithTags.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/web/src/components/input/InputWithTags.tsx b/web/src/components/input/InputWithTags.tsx index 802e4acaa..432a59be9 100644 --- a/web/src/components/input/InputWithTags.tsx +++ b/web/src/components/input/InputWithTags.tsx @@ -183,6 +183,7 @@ export default function InputWithTags({ if (allSuggestions[type as FilterType]?.includes(value)) { const newFilters = { ...filters }; let timestamp = 0; + let times = ["", ""]; switch (type) { case "before": @@ -222,6 +223,25 @@ export default function InputWithTags({ newFilters[type] = timestamp / 1000; } break; + case "timeRange": + if (!value.includes(",")) { + toast.error("The correct format is after,before.", { + position: "top-center", + }); + return; + } + + times = value.split(","); + + if (times[0] < "00" || times[1] > "24") { + toast.error("Times not in valid range", { + position: "top-center", + }); + return; + } + + newFilters[type] = value; + break; case "search_type": if (!newFilters.search_type) newFilters.search_type = []; if (