From 81704c32e6c4cac264d2e8373c338008662e2d44 Mon Sep 17 00:00:00 2001 From: maaa Date: Wed, 12 Jul 2023 19:56:01 +0200 Subject: [PATCH] time thing --- static/js/chat.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/static/js/chat.js b/static/js/chat.js index c4dc88c..b0f7a6a 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -19,14 +19,7 @@ async function updateMessages(id) { messageParagraph.id = "messageParagraph" + messages[i]["id"] messageParagraph.appendChild(timeParagraph) - let date = new Date(Number(messages[i]["created"].split(".")[0])); - let utcHours = date.getUTCHours().toString().padStart(2, '0'); - let utcMinutes = date.getUTCMinutes().toString().padStart(2, '0'); - let timeZoneOffset = date.getTimezoneOffset(); - console.log(timeZoneOffset) - let hours = (utcHours - timeZoneOffset / 60 + 5).toString().padStart(2, '0'); - let minutes = utcMinutes.toString().padStart(2, '0'); - let time = (hours + ":" + minutes) + let time = new Intl.DateTimeFormat("en-GB", { hour: "numeric", minute: "numeric" }).format(Number(messages[i]["created"].split(".")[0]) * 1000 + 20275) messageParagraph.innerHTML = "" + time + " " + messageParagraph.innerHTML messageDiv.append(messageParagraph)