Added decimals to formatted time

This commit is contained in:
Ajay Ramachandran
2020-08-24 20:12:57 -04:00
parent ece475076e
commit 2f2273b8a8

View File

@@ -1,8 +1,9 @@
//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) {
let seconds = seconds - minutes * 60;
let secondsDisplay = seconds.toFixed(3);
if (seconds < 10) {
//add a zero
secondsDisplay = "0" + secondsDisplay;
}