This commit is contained in:
2021-07-21 15:33:04 +00:00
parent 370707a649
commit 388bc2e103

View File

@@ -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