time thing

This commit is contained in:
maaa 2023-07-12 19:56:01 +02:00
parent e44b6752e7
commit 81704c32e6
1 changed files with 1 additions and 8 deletions

View File

@ -19,14 +19,7 @@ async function updateMessages(id) {
messageParagraph.id = "messageParagraph" + messages[i]["id"] messageParagraph.id = "messageParagraph" + messages[i]["id"]
messageParagraph.appendChild(timeParagraph) messageParagraph.appendChild(timeParagraph)
let date = new Date(Number(messages[i]["created"].split(".")[0])); let time = new Intl.DateTimeFormat("en-GB", { hour: "numeric", minute: "numeric" }).format(Number(messages[i]["created"].split(".")[0]) * 1000 + 20275)
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)
messageParagraph.innerHTML = "<span style='color: #515051; font-size: 14px;'>" + time + "</span> " + messageParagraph.innerHTML messageParagraph.innerHTML = "<span style='color: #515051; font-size: 14px;'>" + time + "</span> " + messageParagraph.innerHTML
messageDiv.append(messageParagraph) messageDiv.append(messageParagraph)