From 3081b2a99bafab1441e5b62b5243e15b1264a1d6 Mon Sep 17 00:00:00 2001 From: odweta Date: Thu, 10 Sep 2026 17:42:31 +0200 Subject: [PATCH] Default issue date field to today's date Prefill 'Datum vystaveni' with the current local date when opening a new invoice, instead of leaving it blank. Also switch date formatting to use local date components instead of toISOString() to avoid UTC timezone shifting the displayed date. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- app/src/static/script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/static/script.js b/app/src/static/script.js index 241f0b3..6e66931 100644 --- a/app/src/static/script.js +++ b/app/src/static/script.js @@ -207,7 +207,11 @@ const getClientLabel = (client) => [ const formatCzechDate = (dateValue) => new Date(`${dateValue}T00:00:00`).toLocaleDateString("cs-CZ"); -const toDateInputValue = (date) => date.toISOString().slice(0, 10); +const toDateInputValue = (date) => [ + date.getFullYear(), + String(date.getMonth() + 1).padStart(2, "0"), + String(date.getDate()).padStart(2, "0") +].join("-"); const getIssueDate = () => issueDateInput.value || toDateInputValue(new Date()); @@ -365,7 +369,7 @@ const clearInvoiceEditor = () => { currentInvoiceId = null; invoiceNumberDisplay.textContent = "Nová faktura"; invoiceSaveStatus.textContent = ""; - issueDateInput.value = ""; + issueDateInput.value = toDateInputValue(new Date()); dueDateInput.value = ""; writeProfileFields("odberatel", {}); clientSelect.value = ""; -- 2.54.0