fix: use UTC date for calendar filter (#4046)

This commit is contained in:
RoccoSmit 2024-10-24 01:52:20 +11:00 committed by GitHub
parent 7e48d13834
commit 2851f11302
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,9 @@ const Home = () => {
} else if (filter.factor === "property.hasCode") { } else if (filter.factor === "property.hasCode") {
filters.push(`has_code == true`); filters.push(`has_code == true`);
} else if (filter.factor === "displayTime") { } 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_after == ${timestampAfter}`);
filters.push(`display_time_before == ${timestampAfter + 60 * 60 * 24}`); filters.push(`display_time_before == ${timestampAfter + 60 * 60 * 24}`);
} }