From c8a1748ae5e3dbfea1606dda57687846aa1b3683 Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Sun, 20 Sep 2026 01:42:53 +0200 Subject: [PATCH] Raids: use a real date/time picker instead of a free-text field The "Datum & Uhrzeit" input in raid create/edit is now , styled to match the dark theme. The backend still expects "TT.MM.JJJJ HH:MM" (the Discord bot parses it verbatim), so raids.js converts the picker's value to that format via a plain string reshuffle (no Date object, so no timezone drift) before posting it as date_raw. The edit form prefills the picker from the raid's existing timestamp. Co-Authored-By: Claude Sonnet 5 --- assets/css/style.css | 8 ++++++++ assets/js/raids.js | 15 +++++++++++++-- raids.php | 6 ++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 6dacff3..d0b40d0 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -359,6 +359,7 @@ label { font-weight: 600; font-size: 0.9rem; } input[type="text"], input[type="email"], input[type="password"], +input[type="datetime-local"], textarea, select { background: var(--bg-panel-alt); @@ -375,6 +376,13 @@ input:focus, select:focus, textarea:focus { border-color: var(--gold); } +/* Chrome/Edge faerben das Kalender-/Uhr-Icon standardmaessig schwarz, das im + dunklen Theme unsichtbar waere. */ +input[type="datetime-local"]::-webkit-calendar-picker-indicator { + filter: invert(1); + cursor: pointer; +} + .field-hint { color: var(--text-muted); font-size: 0.8rem; diff --git a/assets/js/raids.js b/assets/js/raids.js index d43facb..a28116a 100644 --- a/assets/js/raids.js +++ b/assets/js/raids.js @@ -19,6 +19,17 @@ }); } + // Wandelt den Wert eines ("YYYY-MM-DDTHH:MM") in das vom + // Bot erwartete Format "TT.MM.JJJJ HH:MM" um - reine Stringumformung ohne Date-Objekt, + // damit keine Zeitzonenverschiebung passieren kann. + function formatDateRaw(localValue) { + var parts = (localValue || '').split('T'); + if (parts.length !== 2) return ''; + var dateParts = parts[0].split('-'); + if (dateParts.length !== 3) return ''; + return dateParts[2] + '.' + dateParts[1] + '.' + dateParts[0] + ' ' + parts[1]; + } + // ---- Anmelde-Popup ---- var modal = document.getElementById('raid-signup-modal'); var groupPicker = document.getElementById('raid-signup-group-picker'); @@ -174,7 +185,7 @@ postJson('/raid_edit_action.php', { raid_id: form.getAttribute('data-raid-id'), title: form.title.value, - date_raw: form.date_raw.value, + date_raw: formatDateRaw(form.date_local.value), requirements: form.requirements.value, gearscore: form.gearscore.value, group_names: groupNames.join(', '), @@ -261,7 +272,7 @@ feedback.className = 'raid-create-feedback text-muted'; postJson('/raid_create_action.php', { title: raidCreateForm.title.value, - date_raw: raidCreateForm.date_raw.value, + date_raw: formatDateRaw(raidCreateForm.date_local.value), requirements: raidCreateForm.requirements.value, gearscore: raidCreateForm.gearscore.value, group_names: groupNames.join(', '), diff --git a/raids.php b/raids.php index f095d77..5b3a46e 100644 --- a/raids.php +++ b/raids.php @@ -102,7 +102,7 @@ include __DIR__ . '/includes/header.php';
- +
@@ -150,8 +150,10 @@ include __DIR__ . '/includes/header.php'; $title = (string) ($raid['title'] ?? 'Raid'); $dateRaw = (string) ($raid['date'] ?? ''); $dateLabel = $dateRaw; + $dateLocal = ''; if (!empty($raid['timestamp'])) { $dateLabel = date('d.m.Y H:i', (int) $raid['timestamp']) . ' Uhr'; + $dateLocal = date('Y-m-d\TH:i', (int) $raid['timestamp']); } $requirements = trim((string) ($raid['requirements'] ?? '')); $gearscore = trim((string) ($raid['gearscore'] ?? '')); @@ -257,7 +259,7 @@ include __DIR__ . '/includes/header.php';
- +