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