mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 17:17:40 +03:00
Ensure returned day is parsed as midnight in specified timezone
This commit is contained in:
parent
c37f28880f
commit
8f2854f93e
@ -13,6 +13,7 @@ import { FrigateConfig } from "@/types/frigateConfig";
|
|||||||
import { useFormattedTimestamp, useTimezone } from "@/hooks/use-date-utils";
|
import { useFormattedTimestamp, useTimezone } from "@/hooks/use-date-utils";
|
||||||
import { RecordingsSummary } from "@/types/review";
|
import { RecordingsSummary } from "@/types/review";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { TZDate } from "react-day-picker";
|
||||||
|
|
||||||
type CameraStorage = {
|
type CameraStorage = {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
@ -66,9 +67,10 @@ export default function StorageMetrics({
|
|||||||
const earliestDate = useMemo(() => {
|
const earliestDate = useMemo(() => {
|
||||||
const keys = Object.keys(recordingsSummary || {});
|
const keys = Object.keys(recordingsSummary || {});
|
||||||
return keys.length
|
return keys.length
|
||||||
? new Date(keys[keys.length - 1]).getTime() / 1000
|
? new TZDate(keys[keys.length - 1] + "T00:00:00", timezone).getTime() /
|
||||||
|
1000
|
||||||
: null;
|
: null;
|
||||||
}, [recordingsSummary]);
|
}, [recordingsSummary, timezone]);
|
||||||
|
|
||||||
const timeFormat = config?.ui.time_format === "24hour" ? "24hour" : "12hour";
|
const timeFormat = config?.ui.time_format === "24hour" ? "24hour" : "12hour";
|
||||||
const format = useMemo(() => {
|
const format = useMemo(() => {
|
||||||
@ -80,7 +82,7 @@ export default function StorageMetrics({
|
|||||||
const formattedEarliestDate = useFormattedTimestamp(
|
const formattedEarliestDate = useFormattedTimestamp(
|
||||||
earliestDate || 0,
|
earliestDate || 0,
|
||||||
format,
|
format,
|
||||||
"UTC", // timezone is already converted from recordings summary endpoint
|
timezone,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!cameraStorage || !stats || !totalStorage || !config) {
|
if (!cameraStorage || !stats || !totalStorage || !config) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user