mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-05 14:47:40 +03:00
History snapshot filenames use Frigate timeline timezone
(cherry picked from commit 5c3b0fb11b859a8d2b8a5c1e630d7e10b355d08b)
This commit is contained in:
parent
24b27dfa4a
commit
997f15ab9c
@ -369,6 +369,7 @@ export default function HlsVideoPlayer({
|
||||
generateSnapshotFilename(
|
||||
camera ?? "recording",
|
||||
snapshotTimestamp,
|
||||
config?.ui?.timezone,
|
||||
),
|
||||
);
|
||||
toast.success(
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { baseUrl } from "@/api/baseUrl";
|
||||
import { formatUnixTimestampToDateTime } from "@/utils/dateUtil";
|
||||
|
||||
type SnapshotResponse = {
|
||||
dataUrl: string;
|
||||
@ -97,9 +98,25 @@ export function downloadSnapshot(dataUrl: string, filename: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function generateSnapshotFilename(cameraName: string): string {
|
||||
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
||||
return `${cameraName}_snapshot_${timestamp}.jpg`;
|
||||
export function generateSnapshotFilename(
|
||||
cameraName: string,
|
||||
timestampSeconds?: number,
|
||||
timezone?: string,
|
||||
): string {
|
||||
const seconds = timestampSeconds ?? Date.now() / 1000;
|
||||
const timestamp = formatUnixTimestampToDateTime(seconds, {
|
||||
timezone,
|
||||
date_format: "yyyy-MM-dd'T'HH-mm-ss",
|
||||
});
|
||||
|
||||
const safeTimestamp =
|
||||
timestamp === "Invalid time"
|
||||
? new Date(seconds * 1000)
|
||||
.toISOString()
|
||||
.replace(/[:.]/g, "-")
|
||||
.slice(0, -5)
|
||||
: timestamp;
|
||||
return `${cameraName}_snapshot_${safeTimestamp}.jpg`;
|
||||
}
|
||||
|
||||
export async function grabVideoSnapshot(): Promise<SnapshotResult> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user