From c6c471b1a2d052592847d318a36655b9dc313535 Mon Sep 17 00:00:00 2001 From: Front <27463495+Frontesque@users.noreply.github.com> Date: Wed, 4 May 2022 21:24:45 -0400 Subject: [PATCH] add WIP "humanTime" function to utils --- NUXT/plugins/utils.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/NUXT/plugins/utils.js b/NUXT/plugins/utils.js index c45b16b..b883f12 100644 --- a/NUXT/plugins/utils.js +++ b/NUXT/plugins/utils.js @@ -77,6 +77,22 @@ function linkParser(url) { } const delay = (ms) => new Promise((res) => setTimeout(res, ms)); +//--- Convert Time To Human Readable String ---// +function humanTime(givenTime) { + const minutes = Math.floor(givenTime / 60); + const seconds = givenTime - minutes * 60; + const hours = Math.floor(givenTime / 3600); + return { + formatted: (hours ? hours+":" : "") + `${minutes}:${seconds}`, + raw: { + hours: hours, + minutes: minutes, + seconds: seconds + } + } +} +//--- End Convert Time To Human Readable String ---// + module.exports = { getBetweenStrings, hexToRgb,