Added hours to time with skips

This commit is contained in:
Ajay Ramachandran 2020-07-12 18:52:36 -04:00
parent 48861439b7
commit 2d74ce2093

View file

@ -331,9 +331,10 @@ class Utils {
return seconds % 60; return seconds % 60;
} }
getFormattedTime(seconds: number, precise?: boolean) { getFormattedTime(seconds: number, precise?: boolean): string {
let minutes = Math.floor(seconds / 60); let hours = Math.floor(seconds / 60 / 60);
let secondsNum: number = seconds - minutes * 60; let minutes = Math.floor(seconds / 60) % 60;
let secondsNum = seconds % 60;
if (!precise) { if (!precise) {
secondsNum = Math.floor(secondsNum); secondsNum = Math.floor(secondsNum);
} }
@ -345,7 +346,7 @@ class Utils {
secondsDisplay = "0" + secondsDisplay; secondsDisplay = "0" + secondsDisplay;
} }
let formatted = minutes + ":" + secondsDisplay; let formatted = (hours ? hours + ":" : "") + minutes + ":" + secondsDisplay;
return formatted; return formatted;
} }