Timezone fix (#19293)

* Frontend timezone fixes

Last recording date timezone was being applied twice, so it displayed the wrong date
Also, TZDate from react-day-picker could have been behaving incorrectly at times without a full date string

* Ensure returned day is parsed as midnight in specified timezone
This commit is contained in:
Josh Hawkins 2025-07-26 19:24:08 -05:00 committed by GitHub
parent 0b7a33d670
commit 898d1de875
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -50,7 +50,7 @@ export default function ReviewActivityCalendar({
}
const parts = date.split("-");
const cal = new TZDate(date, timezone);
const cal = new TZDate(date + "T00:00:00", timezone);
cal.setFullYear(
parseInt(parts[0]),
@ -70,7 +70,7 @@ export default function ReviewActivityCalendar({
}
const parts = date.split("-");
const cal = new TZDate(date, timezone);
const cal = new TZDate(date + "T00:00:00", timezone);
cal.setFullYear(
parseInt(parts[0]),

View File

@ -13,6 +13,7 @@ import { FrigateConfig } from "@/types/frigateConfig";
import { useFormattedTimestamp, useTimezone } from "@/hooks/use-date-utils";
import { RecordingsSummary } from "@/types/review";
import { useTranslation } from "react-i18next";
import { TZDate } from "react-day-picker";
type CameraStorage = {
[key: string]: {
@ -66,9 +67,10 @@ export default function StorageMetrics({
const earliestDate = useMemo(() => {
const keys = Object.keys(recordingsSummary || {});
return keys.length
? new Date(keys[keys.length - 1]).getTime() / 1000
? new TZDate(keys[keys.length - 1] + "T00:00:00", timezone).getTime() /
1000
: null;
}, [recordingsSummary]);
}, [recordingsSummary, timezone]);
const timeFormat = config?.ui.time_format === "24hour" ? "24hour" : "12hour";
const format = useMemo(() => {