1export default function (time: number) { 2 if (time < 60) { 3 return `00:${time.toFixed(0).padStart(2, '0')}`; 4 } 5 const sec = time % 60; 6 time = Math.floor(time / 60); 7 const min = time % 60; 8 time = Math.floor(time / 60); 9 const formatted = `${min.toString().padStart(2, '0')}:${sec 10 .toFixed(0) 11 .padStart(2, '0')}`; 12 if (time === 0) { 13 return formatted; 14 } 15 16 return `${time}:${formatted}`; 17} 18