blakeblackshear.frigate/web/src/hooks/use-date-utils.ts

13 lines
369 B
TypeScript
Raw Normal View History

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;
}