mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2026-02-02 15:50:44 +03:00
Initial refactor (routes and utils to respective folders)
This commit is contained in:
13
src/utils/getFormattedTime.js
Normal file
13
src/utils/getFormattedTime.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//converts time in seconds to minutes:seconds
|
||||
module.exports = function getFormattedTime(seconds) {
|
||||
let minutes = Math.floor(seconds / 60);
|
||||
let secondsDisplay = Math.round(seconds - minutes * 60);
|
||||
if (secondsDisplay < 10) {
|
||||
//add a zero
|
||||
secondsDisplay = "0" + secondsDisplay;
|
||||
}
|
||||
|
||||
let formatted = minutes+ ":" + secondsDisplay;
|
||||
|
||||
return formatted;
|
||||
}
|
||||
Reference in New Issue
Block a user