mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 20:34:28 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
export const formatTime = (seconds: number): string => {
|
||||
if (isNaN(seconds)) return '00:00'
|
||||
const date = new Date(seconds * 1000)
|
||||
const hh = date.getUTCHours()
|
||||
const mm = date.getUTCMinutes()
|
||||
const ss = date.getUTCSeconds().toString().padStart(2, '0')
|
||||
if (hh) {
|
||||
return `${hh}:${mm.toString().padStart(2, '0')}:${ss}`
|
||||
}
|
||||
return `${mm}:${ss}`
|
||||
}
|
||||
|
||||
export const formatFrame = (seconds: number, fps: number): number => {
|
||||
if (isNaN(seconds) || !fps) return 0
|
||||
return Math.floor(seconds * fps)
|
||||
}
|
||||
Reference in New Issue
Block a user