feat(transaction): #85 replace datetime with date
Some checks failed
Build Docker Image / Build-Docker-Image (push) Has been cancelled

This commit is contained in:
2025-05-16 22:50:39 +02:00
parent 7d71f5a519
commit 69be8182bb
5 changed files with 16 additions and 32 deletions

View File

@@ -9,17 +9,12 @@ document.addEventListener("DOMContentLoaded", () => {
})
function updateTime(e) {
const timezoneOffset = - new Date().getTimezoneOffset();
e.querySelectorAll("#timezone-offset").forEach((el) => {
el.value = timezoneOffset;
});
document.querySelectorAll(".datetime").forEach((el) => {
if (el.textContent !== "") {
el.textContent = el.textContent.includes("UTC") ? new Date(el.textContent).toLocaleString([], { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }) : el.textContent;
el.textContent = el.textContent.includes("UTC") ? new Date(el.textContent).toLocaleString([], { day: 'numeric', month: 'short', year: 'numeric' }) : el.textContent;
} else if (el.attributes['value'] !== "") {
const value = el.attributes['value'].value;
const newDate = value.includes("UTC") ? new Date(value) : value;
newDate.setTime(newDate.getTime() + timezoneOffset * 60 * 1000);
el.valueAsDate = newDate;
}
})