diff --git a/web/src/components/button/DownloadVideoButton.tsx b/web/src/components/button/DownloadVideoButton.tsx index 094cf93082..607458af4a 100644 --- a/web/src/components/button/DownloadVideoButton.tsx +++ b/web/src/components/button/DownloadVideoButton.tsx @@ -4,6 +4,10 @@ import { FaDownload } from "react-icons/fa"; import { formatUnixTimestampToDateTime } from "@/utils/dateUtil"; import { cn } from "@/lib/utils"; import { useTranslation } from "react-i18next"; +import useSWR from "swr"; +import { FrigateConfig } from "@/types/frigateConfig"; +import { useDateLocale } from "@/hooks/use-date-locale"; +import { useMemo } from "react"; type DownloadVideoButtonProps = { source: string; @@ -19,10 +23,17 @@ export function DownloadVideoButton({ className, }: DownloadVideoButtonProps) { const { t } = useTranslation(["components/input"]); + const { data: config } = useSWR("config"); + const locale = useDateLocale(); + + const timeFormat = config?.ui.time_format === "24hour" ? "24hour" : "12hour"; + const format = useMemo(() => { + return t(`time.formattedTimestampFilename.${timeFormat}`, { ns: "common" }); + }, [t, timeFormat]); + const formattedDate = formatUnixTimestampToDateTime(startTime, { - strftime_fmt: "%D-%T", - time_style: "medium", - date_style: "medium", + date_format: format, + locale, }); const filename = `${camera}_${formattedDate}.mp4`; diff --git a/web/src/components/card/SearchThumbnailFooter.tsx b/web/src/components/card/SearchThumbnailFooter.tsx index 1cf607aa06..c86e9c3c60 100644 --- a/web/src/components/card/SearchThumbnailFooter.tsx +++ b/web/src/components/card/SearchThumbnailFooter.tsx @@ -32,8 +32,8 @@ export default function SearchThumbnailFooter({ const formattedDate = useFormattedTimestamp( searchResult.start_time, config?.ui.time_format == "24hour" - ? t("time.formattedTimestampExcludeSeconds.24hour", { ns: "common" }) - : t("time.formattedTimestampExcludeSeconds.12hour", { ns: "common" }), + ? t("time.formattedTimestampMonthDayHourMinute.24hour", { ns: "common" }) + : t("time.formattedTimestampMonthDayHourMinute.12hour", { ns: "common" }), config?.ui.timezone, ); diff --git a/web/src/components/overlay/detail/ObjectLifecycle.tsx b/web/src/components/overlay/detail/ObjectLifecycle.tsx index 3934b41135..6b711b65f8 100644 --- a/web/src/components/overlay/detail/ObjectLifecycle.tsx +++ b/web/src/components/overlay/detail/ObjectLifecycle.tsx @@ -578,7 +578,7 @@ export default function ObjectLifecycle({
{formatUnixTimestampToDateTime(item.timestamp, { timezone: config.ui.timezone, - strftime_fmt: + date_format: config.ui.time_format == "24hour" ? t("time.formattedTimestamp2.24hour", { ns: "common", diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index c238f3e539..2938bf3a27 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -320,8 +320,12 @@ function ObjectDetailsTab({ const formattedDate = useFormattedTimestamp( search?.start_time ?? 0, config?.ui.time_format == "24hour" - ? t("time.formattedTimestampWithYear.24hour", { ns: "common" }) - : t("time.formattedTimestampWithYear.12hour", { ns: "common" }), + ? t("time.formattedTimestampMonthDayYearHourMinute.24hour", { + ns: "common", + }) + : t("time.formattedTimestampMonthDayYearHourMinute.12hour", { + ns: "common", + }), config?.ui.timezone, );