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>
This commit is contained in:
@@ -207,7 +207,11 @@ const getClientLabel = (client) => [
|
|||||||
|
|
||||||
const formatCzechDate = (dateValue) => new Date(`${dateValue}T00:00:00`).toLocaleDateString("cs-CZ");
|
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());
|
const getIssueDate = () => issueDateInput.value || toDateInputValue(new Date());
|
||||||
|
|
||||||
@@ -365,7 +369,7 @@ const clearInvoiceEditor = () => {
|
|||||||
currentInvoiceId = null;
|
currentInvoiceId = null;
|
||||||
invoiceNumberDisplay.textContent = "Nová faktura";
|
invoiceNumberDisplay.textContent = "Nová faktura";
|
||||||
invoiceSaveStatus.textContent = "";
|
invoiceSaveStatus.textContent = "";
|
||||||
issueDateInput.value = "";
|
issueDateInput.value = toDateInputValue(new Date());
|
||||||
dueDateInput.value = "";
|
dueDateInput.value = "";
|
||||||
writeProfileFields("odberatel", {});
|
writeProfileFields("odberatel", {});
|
||||||
clientSelect.value = "";
|
clientSelect.value = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user