diff options
author | Danielh112 <Daniel@sbgsportssoftware.com> | 2020-08-18 11:29:25 +0100 |
---|---|---|
committer | Danielh112 <Daniel@sbgsportssoftware.com> | 2020-08-18 11:29:25 +0100 |
commit | f7e9ee56d2ed5447f59e5548f005fabdab2f0a72 (patch) | |
tree | a16300fa62e68b3310ae96e36dba65981f0024ef /src/js/utils/time.js | |
parent | 22af7f16ea4a4269321d29242d63ec23718c92da (diff) | |
parent | 423b7b276f1572eb666de32094a9aacd32e87d18 (diff) | |
download | plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.tar.lz plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.tar.xz plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.zip |
Fix merge conflicts
Diffstat (limited to 'src/js/utils/time.js')
-rw-r--r-- | src/js/utils/time.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/js/utils/time.js b/src/js/utils/time.js index 17228de5..31660c4a 100644 --- a/src/js/utils/time.js +++ b/src/js/utils/time.js @@ -11,25 +11,25 @@ export const getSeconds = value => Math.trunc(value % 60, 10); // Format time to UI friendly string export function formatTime(time = 0, displayHours = false, inverted = false) { - // Bail if the value isn't a number - if (!is.number(time)) { - return formatTime(undefined, displayHours, inverted); - } + // Bail if the value isn't a number + if (!is.number(time)) { + return formatTime(undefined, displayHours, inverted); + } - // Format time component to add leading zero - const format = value => `0${value}`.slice(-2); - // Breakdown to hours, mins, secs - let hours = getHours(time); - const mins = getMinutes(time); - const secs = getSeconds(time); + // Format time component to add leading zero + const format = value => `0${value}`.slice(-2); + // Breakdown to hours, mins, secs + let hours = getHours(time); + const mins = getMinutes(time); + const secs = getSeconds(time); - // Do we need to display hours? - if (displayHours || hours > 0) { - hours = `${hours}:`; - } else { - hours = ''; - } + // Do we need to display hours? + if (displayHours || hours > 0) { + hours = `${hours}:`; + } else { + hours = ''; + } - // Render - return `${inverted && time > 0 ? '-' : ''}${hours}${format(mins)}:${format(secs)}`; + // Render + return `${inverted && time > 0 ? '-' : ''}${hours}${format(mins)}:${format(secs)}`; } |