From f86e29ac9ab8d841f0c4eb163097e6ede89f621a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tollk=C3=BChn?= Date: Wed, 30 Sep 2026 14:06:58 +0200 Subject: [PATCH] - set default length of a meeting to 30 minutes - round to the next quarter --- launch.html | 63 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/launch.html b/launch.html index 8336b8b..c5c89bb 100644 --- a/launch.html +++ b/launch.html @@ -460,12 +460,12 @@
- +
- +
- +
@@ -1422,6 +1422,51 @@ END:VCALENDAR`; return url; } + const MINUTES_STEP = 15; + const DEFAULT_DURATION_MINUTES = 30; + + /* + * Minuten auf das 15-Minuten-Raster aufrunden. + * + * Beispiel: + * + * 14:07 ergibt 14:15 + * 14:50 ergibt 15:00 + */ + function roundMinutes(date) { + const rounded = new Date(date); + + rounded.setSeconds(0, 0); + rounded.setMinutes( + Math.ceil(date.getMinutes() / MINUTES_STEP) * MINUTES_STEP + ); + + return rounded; + } + + /* + * Lokale Zeit für datetime-local formatieren. + * + * Beispiel: + * + * 1. Januar 2026, 14:15 ergibt "2026-01-01T14:15" + */ + function formatLocal(date) { + const pad = (num) => num.toString().padStart(2, "0"); + + return ( + date.getFullYear() + + "-" + + pad(date.getMonth() + 1) + + "-" + + pad(date.getDate()) + + "T" + + pad(date.getHours()) + + ":" + + pad(date.getMinutes()) + ); + } + function showMeetingCreator() { /* Hide all other views */ launcher.classList.add("hidden"); @@ -1441,11 +1486,13 @@ END:VCALENDAR`; icsSuccess.classList.add("hidden"); /* Set default start and end times */ - const now = new Date(); - const inOneHour = new Date(now.getTime() + 60 * 60 * 1000); - - meetingStartInput.value = now.toISOString().slice(0, 16); - meetingEndInput.value = inOneHour.toISOString().slice(0, 16); + const start = roundMinutes(new Date()); + const end = new Date( + start.getTime() + DEFAULT_DURATION_MINUTES * 60 * 1000 + ); + + meetingStartInput.value = formatLocal(start); + meetingEndInput.value = formatLocal(end); } function createMeeting() {