From f30e546aa6536b0174b70a29dd3ae936cfef64c7 Mon Sep 17 00:00:00 2001 From: Jonathan Putney Date: Mon, 23 Dec 2019 20:40:13 -0500 Subject: [PATCH] Rounding seconds to 2 decimal places --- src/utilities.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utilities.js b/src/utilities.js index 2991a64..1e651c2 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -28,7 +28,7 @@ export function getSecondsAsHHMMSS(totalSeconds: Number) { const dateObj = new Date(totalSeconds * 1000); const minutes = dateObj.getUTCMinutes(); // make sure we add any possible decimal value - const seconds = dateObj.getSeconds() + (totalSeconds % 1.0); + const seconds = (dateObj.getSeconds() + (totalSeconds % 1.0)).toFixed(2); return hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0') + ':' + @@ -120,7 +120,7 @@ export function getDurationAsSeconds(duration: String, durationRegex: RegExp) { anchor.setMilliseconds(anchor.getMilliseconds() + milliseconds); } - return ((anchor * 1.0) - now) / 1000.0; + return (((anchor * 1.0) - now) / 1000.0).toFixed(2); } /**