diff --git a/inventory/templates/worklog.html b/inventory/templates/worklog.html index 4b43f27..c30d016 100644 --- a/inventory/templates/worklog.html +++ b/inventory/templates/worklog.html @@ -121,6 +121,7 @@ + {% endblock %} {% block script %} @@ -128,6 +129,12 @@ const deleteButton = document.getElementById("deleteButton"); const addUpdateButton = document.getElementById("addUpdateButton"); + function formatDate(date) { + const pad = (n) => String(n).padStart(2, '0'); + return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` + + `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`; + } + if (addUpdateButton) { addUpdateButton.addEventListener("click", (e) => { const row = document.createElement("div"); @@ -142,7 +149,7 @@ // Timestamp span (just display the current time) const ts = document.createElement("span"); ts.classList.add("input-group-text"); - const now = new Date().toLocaleString(); // you could go full ISO if you're feeling spicy + const now = formatDate(new Date()); ts.textContent = now; // Textarea for update content