From 388bc2e103143b22e483c99f7359a92435b6b8d7 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 21 Jul 2021 15:33:04 +0000 Subject: [PATCH] --- ayanova/src/api/locale.js | 78 ++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 2ac6a953..4e2d2601 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -178,56 +178,50 @@ export default { // Turn a duration value into a display // durationLocalized(value, hideSeconds) { + if (value == null || value == "00:00:00") { + return ""; + } + let theDays = 0; let theHours = 0; let theMinutes = 0; let theSeconds = 0; let ret = ""; - if (value == null) { - return ret; + let work = value.split(":"); + //has days? + if (work[0].includes(".")) { + let dh = work[0].split("."); + theDays = Number(dh[0]); + theHours = Number(dh[1]); } else { - let work = value.split(":"); - //has days? - if (work[0].includes(".")) { - let dh = work[0].split("."); - theDays = Number(dh[0]); - theHours = Number(dh[1]); - } else { - theHours = Number(work[0]); - } - theMinutes = Number(work[1]); - //has milliseconds? (ignore them) - if (work[2].includes(".")) { - let dh = work[2].split("."); - theSeconds = Number(dh[0]); - } else { - theSeconds = Number(work[2]); - } - - if (theDays != 0) { - ret += theDays + " " + window.$gz.translation.get("TimeSpanDays") + " "; - } - if (theHours != 0) { - ret += - theHours + " " + window.$gz.translation.get("TimeSpanHours") + " "; - } - if (theMinutes != 0) { - ret += - theMinutes + - " " + - window.$gz.translation.get("TimeSpanMinutes") + - " "; - } - if (!hideSeconds && theSeconds != 0) { - ret += - theSeconds + - " " + - window.$gz.translation.get("TimeSpanSeconds") + - " "; - } - return ret; + theHours = Number(work[0]); } + theMinutes = Number(work[1]); + //has milliseconds? (ignore them) + if (work[2].includes(".")) { + let dh = work[2].split("."); + theSeconds = Number(dh[0]); + } else { + theSeconds = Number(work[2]); + } + + if (theDays != 0) { + ret += theDays + " " + window.$gz.translation.get("TimeSpanDays") + " "; + } + if (theHours != 0) { + ret += theHours + " " + window.$gz.translation.get("TimeSpanHours") + " "; + } + if (theMinutes != 0) { + ret += + theMinutes + " " + window.$gz.translation.get("TimeSpanMinutes") + " "; + } + if (!hideSeconds && theSeconds != 0) { + ret += + theSeconds + " " + window.$gz.translation.get("TimeSpanSeconds") + " "; + } + + return ret; }, /////////////////////////////////////////////// // Convert a utc date to local time zone