From 2851f11302fb604d348433c563127edc401a0d60 Mon Sep 17 00:00:00 2001 From: RoccoSmit Date: Thu, 24 Oct 2024 01:52:20 +1100 Subject: [PATCH] fix: use UTC date for calendar filter (#4046) --- web/src/pages/Home.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index 24fc7d52..f98a71be 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -34,7 +34,9 @@ const Home = () => { } else if (filter.factor === "property.hasCode") { filters.push(`has_code == true`); } else if (filter.factor === "displayTime") { - const timestampAfter = new Date(filter.value).getTime() / 1000; + const filterDate = new Date(filter.value); + const filterUtcTimestamp = filterDate.getTime() + filterDate.getTimezoneOffset() * 60 * 1000; + const timestampAfter = filterUtcTimestamp / 1000; filters.push(`display_time_after == ${timestampAfter}`); filters.push(`display_time_before == ${timestampAfter + 60 * 60 * 24}`); }