From 723fdc744935802fbc041633df4f49a206141a55 Mon Sep 17 00:00:00 2001 From: "Leon Etienne (ubuntu wsl)" Date: Sun, 24 Jan 2021 17:16:36 +0100 Subject: [PATCH] Fixed wrong timestamps --- .../components/DownloadEntry.vue | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tubio-frontend-nuxt-app/components/DownloadEntry.vue b/tubio-frontend-nuxt-app/components/DownloadEntry.vue index fb6888c..519b751 100644 --- a/tubio-frontend-nuxt-app/components/DownloadEntry.vue +++ b/tubio-frontend-nuxt-app/components/DownloadEntry.vue @@ -30,7 +30,7 @@ - +
@@ -105,17 +105,18 @@ export default { methods: { getQueuedDateString: function(unixTime) { - const date = new Date(unixTime * 1000); - const day = ("0" + date.getDay()).slice(-2); - const month = ("0" + date.getMonth()).slice(-2); - return day + "." + month + "." + date.getFullYear(); + return new Date(unixTime*1000).toLocaleDateString("de-DE"); }, getDurationString: function(unixTime) { - const time = new Date(unixTime * 1000); - const hours = String((time.getHours() - 1)); - const minutes = ("0" + (time.getMinutes())).slice(-2); - const seconds = ("0" + (time.getSeconds())).slice(-2); - return ((hours !== "0") ? (hours + ":") : "") + minutes + ":" + seconds; + const h = Math.floor(unixTime / 3600); + const m = Math.floor((unixTime % 3600) / 60); + const s = Math.floor((unixTime % 3600) % 60); + + var ret = ""; + if (h > 0) ret = String(h).padStart(2, '0') + ":"; + + ret += String(m).padStart(2, '0') + ":" + String(s).padStart(2, '0'); + return ret; }, linebreaksToBrTags: function(str) { return str.replace("\n", '
');