mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-17 03:44:20 +03:00
migrate to typescript
This commit is contained in:
committed by
Dainius Dauksevicius
parent
c462323dd5
commit
08d27265fc
14
src/utils/getFormattedTime.ts
Normal file
14
src/utils/getFormattedTime.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Converts time in seconds to minutes:seconds
|
||||
*/
|
||||
export function getFormattedTime(totalSeconds: number) {
|
||||
let minutes = Math.floor(totalSeconds / 60);
|
||||
let seconds = totalSeconds - minutes * 60;
|
||||
let secondsDisplay = seconds.toFixed(3);
|
||||
if (seconds < 10) {
|
||||
//add a zero
|
||||
secondsDisplay = '0' + secondsDisplay;
|
||||
}
|
||||
|
||||
return minutes + ':' + secondsDisplay;
|
||||
}
|
||||
Reference in New Issue
Block a user