Fälligkeitsdatum-Anzeige zeitzonenunabhängig formatieren
This commit is contained in:
parent
89d2a911e1
commit
33881db9e1
@ -1215,6 +1215,17 @@
|
|||||||
return new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(n || 0);
|
return new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(n || 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Formatiert nur den Kalendertag eines ISO-Datums (YYYY-MM-DD-Präfix),
|
||||||
|
// ohne über `new Date(iso).toLocaleDateString()` zu gehen — das würde je
|
||||||
|
// nach Browser-Zeitzone auf den Vor-/Folgetag verschieben, wenn das
|
||||||
|
// Backend den Zeitpunkt nahe Mitternacht UTC serialisiert (z.B.
|
||||||
|
// Fälligkeitsdatum, das serverseitig auf 23:59:59 UTC gesetzt ist).
|
||||||
|
function formatIsoDateOnly(iso) {
|
||||||
|
if (!iso) return '';
|
||||||
|
const [year, month, day] = iso.slice(0, 10).split('-');
|
||||||
|
return `${day}.${month}.${year}`;
|
||||||
|
}
|
||||||
|
|
||||||
function el(tag, className, html) {
|
function el(tag, className, html) {
|
||||||
const e = document.createElement(tag);
|
const e = document.createElement(tag);
|
||||||
if (className) e.className = className;
|
if (className) e.className = className;
|
||||||
@ -1771,7 +1782,7 @@
|
|||||||
if (light.dueDate) {
|
if (light.dueDate) {
|
||||||
const dueDateRow = el('div', 'amount-row');
|
const dueDateRow = el('div', 'amount-row');
|
||||||
dueDateRow.appendChild(el('span', 'label', 'Fälligkeitsdatum'));
|
dueDateRow.appendChild(el('span', 'label', 'Fälligkeitsdatum'));
|
||||||
dueDateRow.appendChild(el('span', 'value', new Date(light.dueDate).toLocaleDateString('de-DE')));
|
dueDateRow.appendChild(el('span', 'value', formatIsoDateOnly(light.dueDate)));
|
||||||
card.appendChild(dueDateRow);
|
card.appendChild(dueDateRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user