mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-06 19:07:20 +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:
@@ -31,6 +31,7 @@ import Chip from "@/components/indicators/Chip";
|
||||
import { TooltipPortal } from "@radix-ui/react-tooltip";
|
||||
import SearchActionGroup from "@/components/filter/SearchActionGroup";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { use24HourTime } from "@/hooks/use-date-utils";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||
|
||||
@@ -77,6 +78,7 @@ export default function SearchView({
|
||||
const { data: config } = useSWR<FrigateConfig>("config", {
|
||||
revalidateOnFocus: false,
|
||||
});
|
||||
const is24Hour = use24HourTime(config);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { data: exploreEvents } = useSWR<SearchResult[]>(
|
||||
@@ -191,10 +193,7 @@ export default function SearchView({
|
||||
sub_labels: allSubLabels,
|
||||
...(hasCustomClassificationModels && { attributes: allAttributes }),
|
||||
search_type: ["thumbnail", "description"] as SearchSource[],
|
||||
time_range:
|
||||
config?.ui.time_format == "24hour"
|
||||
? ["00:00-23:59"]
|
||||
: ["12:00AM-11:59PM"],
|
||||
time_range: is24Hour ? ["00:00-23:59"] : ["12:00AM-11:59PM"],
|
||||
before: [formatDateToLocaleString()],
|
||||
after: [formatDateToLocaleString(-5)],
|
||||
min_score: ["50"],
|
||||
@@ -209,6 +208,7 @@ export default function SearchView({
|
||||
}),
|
||||
[
|
||||
config,
|
||||
is24Hour,
|
||||
allLabels,
|
||||
allZones,
|
||||
allSubLabels,
|
||||
|
||||
Reference in New Issue
Block a user