mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
13 lines
369 B
TypeScript
13 lines
369 B
TypeScript
|
import { formatUnixTimestampToDateTime } from "@/utils/dateUtil";
|
||
|
import { useMemo } from "react";
|
||
|
|
||
|
export function useFormattedTimestamp(timestamp: number, format: string) {
|
||
|
const formattedTimestamp = useMemo(() => {
|
||
|
return formatUnixTimestampToDateTime(timestamp, {
|
||
|
strftime_fmt: format,
|
||
|
});
|
||
|
}, [format, timestamp]);
|
||
|
|
||
|
return formattedTimestamp;
|
||
|
}
|