From ec046f4cf55a2051eeb52f998b3f45b1e92b3baf Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 28 Oct 2023 10:30:16 +0200 Subject: [PATCH] fix time in logbook --- frontend/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/main.ts b/frontend/main.ts index 4593315..f65bfe0 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -22,7 +22,11 @@ document.addEventListener('DOMContentLoaded', function() { function setCurrentdate(input: HTMLInputElement) { if(input) { - input.value = (new Date().toJSON().slice(0,16)); + const inputElement = document.getElementById("departure") as HTMLInputElement; + const now = new Date(); + const formattedDateTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}T${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`; + + inputElement.value = formattedDateTime; } }