mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 13:07:44 +03:00
fix notifications
This commit is contained in:
parent
f01b4e175e
commit
4a1c24dd75
@ -45,6 +45,7 @@ import {
|
|||||||
useNotificationSuspend,
|
useNotificationSuspend,
|
||||||
} from "@/api/ws";
|
} from "@/api/ws";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useDateLocale } from "@/hooks/use-date-locale";
|
||||||
|
|
||||||
type LiveContextMenuProps = {
|
type LiveContextMenuProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -235,18 +236,25 @@ export default function LiveContextMenu({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const locale = useDateLocale();
|
||||||
|
|
||||||
const formatSuspendedUntil = (timestamp: string) => {
|
const formatSuspendedUntil = (timestamp: string) => {
|
||||||
// Some languages require a change in word order
|
// Some languages require a change in word order
|
||||||
if (timestamp === "0") return t("time.untilForRestart", { ns: "common" });
|
if (timestamp === "0") return t("time.untilForRestart", { ns: "common" });
|
||||||
|
|
||||||
const time = formatUnixTimestampToDateTime(Number.parseInt(timestamp), {
|
const time = formatUnixTimestampToDateTime(parseInt(timestamp), {
|
||||||
time_style: "medium",
|
time_style: "medium",
|
||||||
date_style: "medium",
|
date_style: "medium",
|
||||||
timezone: config?.ui.timezone,
|
timezone: config?.ui.timezone,
|
||||||
strftime_fmt:
|
date_format:
|
||||||
config?.ui.time_format == "24hour"
|
config?.ui.time_format == "24hour"
|
||||||
? t("time.formattedTimestampExcludeSeconds.24hour", { ns: "common" })
|
? t("time.formattedTimestampMonthDayHourMinute.24hour", {
|
||||||
: t("time.formattedTimestampExcludeSeconds.12hour", { ns: "common" }),
|
ns: "common",
|
||||||
|
})
|
||||||
|
: t("time.formattedTimestampMonthDayHourMinute.12hour", {
|
||||||
|
ns: "common",
|
||||||
|
}),
|
||||||
|
locale: locale,
|
||||||
});
|
});
|
||||||
return t("time.untilForTime", { ns: "common", time });
|
return t("time.untilForTime", { ns: "common", time });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -44,6 +44,7 @@ import { formatUnixTimestampToDateTime } from "@/utils/dateUtil";
|
|||||||
import FilterSwitch from "@/components/filter/FilterSwitch";
|
import FilterSwitch from "@/components/filter/FilterSwitch";
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
|
import { useDateLocale } from "@/hooks/use-date-locale";
|
||||||
|
|
||||||
const NOTIFICATION_SERVICE_WORKER = "notifications-worker.js";
|
const NOTIFICATION_SERVICE_WORKER = "notifications-worker.js";
|
||||||
|
|
||||||
@ -645,6 +646,8 @@ export function CameraNotificationSwitch({
|
|||||||
sendNotificationSuspend(0);
|
sendNotificationSuspend(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const locale = useDateLocale();
|
||||||
|
|
||||||
const formatSuspendedUntil = (timestamp: string) => {
|
const formatSuspendedUntil = (timestamp: string) => {
|
||||||
// Some languages require a change in word order
|
// Some languages require a change in word order
|
||||||
if (timestamp === "0") return t("time.untilForRestart", { ns: "common" });
|
if (timestamp === "0") return t("time.untilForRestart", { ns: "common" });
|
||||||
@ -653,10 +656,15 @@ export function CameraNotificationSwitch({
|
|||||||
time_style: "medium",
|
time_style: "medium",
|
||||||
date_style: "medium",
|
date_style: "medium",
|
||||||
timezone: config?.ui.timezone,
|
timezone: config?.ui.timezone,
|
||||||
strftime_fmt:
|
date_format:
|
||||||
config?.ui.time_format == "24hour"
|
config?.ui.time_format == "24hour"
|
||||||
? t("time.formattedTimestampExcludeSeconds.24hour", { ns: "common" })
|
? t("time.formattedTimestampMonthDayHourMinute.24hour", {
|
||||||
: t("time.formattedTimestampExcludeSeconds.12hour", { ns: "common" }),
|
ns: "common",
|
||||||
|
})
|
||||||
|
: t("time.formattedTimestampMonthDayHourMinute.12hour", {
|
||||||
|
ns: "common",
|
||||||
|
}),
|
||||||
|
locale: locale,
|
||||||
});
|
});
|
||||||
return t("time.untilForTime", { ns: "common", time });
|
return t("time.untilForTime", { ns: "common", time });
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user