1
This commit is contained in:
9
src/shared/time_format.ts
Normal file
9
src/shared/time_format.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* 秒格式化成 00:00
|
||||
* @param totalSeconds
|
||||
*/
|
||||
export function formatSeconds(totalSeconds: number): string {
|
||||
const minutes = Math.floor(totalSeconds / 60).toString().padStart(2, '0');
|
||||
const seconds = (totalSeconds % 60).toString().padStart(2, '0');
|
||||
return `${minutes}:${seconds}`;
|
||||
}
|
||||
Reference in New Issue
Block a user