mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-28 14:49:01 +03:00
Fix browser time format handling (#22694)
* implement hook to return resolved "24hour" | "12hour" string delegate to existing use24HourTime(), which correctly detects the browser's locale preference via Intl.DateTimeFormat * update frontend to use use24HourTime(config) or useTimeFormat(config) instead of directly comparing config.ui.time_format
This commit is contained in:
@@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
|
||||
import useSWR from "swr";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
import { useDateLocale } from "@/hooks/use-date-locale";
|
||||
import { useTimeFormat } from "@/hooks/use-date-utils";
|
||||
import { useMemo } from "react";
|
||||
|
||||
type DownloadVideoButtonProps = {
|
||||
@@ -26,7 +27,7 @@ export function DownloadVideoButton({
|
||||
const { data: config } = useSWR<FrigateConfig>("config");
|
||||
const locale = useDateLocale();
|
||||
|
||||
const timeFormat = config?.ui.time_format === "24hour" ? "24hour" : "12hour";
|
||||
const timeFormat = useTimeFormat(config);
|
||||
const format = useMemo(() => {
|
||||
return t(`time.formattedTimestampFilename.${timeFormat}`, { ns: "common" });
|
||||
}, [t, timeFormat]);
|
||||
|
||||
Reference in New Issue
Block a user