diff --git a/src/components/Vod/Card.tsx b/src/components/Vod/Card.tsx index e1ed196..c113728 100644 --- a/src/components/Vod/Card.tsx +++ b/src/components/Vod/Card.tsx @@ -176,6 +176,18 @@ export const VodCard = ({ vod, playback }: any) => { preloadImage(`${publicRuntimeConfig.CDN_URL}${vod.web_thumbnail_path}`); }, [vod.web_thumbnail_path]); + const formatDuration = (duration: number) => { + const hours = Math.floor(duration / 3600); + const minutes = Math.floor((duration % 3600) / 60); + const seconds = Math.floor(duration % 60); + + const formattedHours = hours.toString().padStart(2, "0"); + const formattedMinutes = minutes.toString().padStart(2, "0"); + const formattedSeconds = seconds.toString().padStart(2, "0"); + + return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`; + }; + return (
{!vod.processing ? ( @@ -213,7 +225,7 @@ export const VodCard = ({ vod, playback }: any) => { - {dayjs.duration(vod.duration, "seconds").format("HH:mm:ss")} + {formatDuration(vod.duration)} {watched && ( @@ -309,7 +321,7 @@ export const VodCard = ({ vod, playback }: any) => { - {dayjs.duration(vod.duration, "seconds").format("HH:mm:ss")} + {formatDuration(vod.duration)} {watched && (