Enhance date formatting in NobilityView: Update formatDate method to display time for today's or future dates, improving user experience by providing more relevant information.

This commit is contained in:
Torsten Schulz (local)
2026-01-29 09:26:21 +01:00
parent 5351e3ea57
commit eecd947377

View File

@@ -138,6 +138,21 @@
}, },
formatDate(isoString) { formatDate(isoString) {
const d = new Date(isoString); const d = new Date(isoString);
const now = new Date();
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const dateOnly = new Date(d.getFullYear(), d.getMonth(), d.getDate());
// Wenn das Datum heute ist oder in der Zukunft liegt, zeige auch die Uhrzeit
if (dateOnly.getTime() >= today.getTime()) {
return d.toLocaleString(navigator.language, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
});
}
// Ansonsten nur das Datum
return d.toLocaleDateString(); return d.toLocaleDateString();
} }
} }