diff --git a/admin/assets/app.js b/admin/assets/app.js index ee5b8b4..cc18e0f 100644 --- a/admin/assets/app.js +++ b/admin/assets/app.js @@ -736,23 +736,33 @@ function newCleanupQuery() { }); document.getElementById('cleanup-kinds').value = ''; document.getElementById('cleanup-from-date').value = ''; + document.getElementById('cleanup-from-time').value = ''; document.getElementById('cleanup-to-date').value = ''; + document.getElementById('cleanup-to-time').value = ''; document.getElementById('cleanup-max-events').value = '0'; document.getElementById('cleanup-results-group').style.display = 'none'; document.getElementById('cleanup-name').focus(); } +// ── Combine date + time inputs into a single datetime string ─────────── +function combineDateTime(dateId, timeId) { + const dateVal = document.getElementById(dateId).value; + const timeVal = document.getElementById(timeId).value; + if (!dateVal) return ''; + return timeVal ? dateVal + ' ' + timeVal : dateVal; +} + // ── Read filter values from the form ─────────────────────────────────── function readCleanupFilters() { const followsEl = document.querySelector('input[name="cleanup-follows"]:checked'); const follows_filter = followsEl ? followsEl.value : 'all'; const kindsRaw = document.getElementById('cleanup-kinds').value.trim(); const kinds = kindsRaw ? kindsRaw.split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n) && n > 0) : []; - const fromDate = document.getElementById('cleanup-from-date').value; - const toDate = document.getElementById('cleanup-to-date').value; + const from_date = combineDateTime('cleanup-from-date', 'cleanup-from-time'); + const to_date = combineDateTime('cleanup-to-date', 'cleanup-to-time'); const max_events = parseInt(document.getElementById('cleanup-max-events').value, 10) || 0; const name = document.getElementById('cleanup-name').value.trim(); - return { name, follows_filter, kinds, from_date: fromDate, to_date: toDate, max_events }; + return { name, follows_filter, kinds, from_date, to_date, max_events }; } // ── Preview ──────────────────────────────────────────────────────────── @@ -950,8 +960,13 @@ async function loadSavedCleanupQuery(id) { r.checked = r.value === q.follows_filter; }); document.getElementById('cleanup-kinds').value = (q.kinds || []).join(', '); - document.getElementById('cleanup-from-date').value = q.from_date || ''; - document.getElementById('cleanup-to-date').value = q.to_date || ''; + // Split stored datetime into date + time parts + const fromParts = (q.from_date || '').split(' '); + document.getElementById('cleanup-from-date').value = fromParts[0] || ''; + document.getElementById('cleanup-from-time').value = fromParts[1] || ''; + const toParts = (q.to_date || '').split(' '); + document.getElementById('cleanup-to-date').value = toParts[0] || ''; + document.getElementById('cleanup-to-time').value = toParts[1] || ''; document.getElementById('cleanup-max-events').value = q.max_events; document.getElementById('cleanup-results-group').style.display = 'none'; diff --git a/admin/assets/index.css b/admin/assets/index.css index 6aee1f2..4252f04 100644 --- a/admin/assets/index.css +++ b/admin/assets/index.css @@ -281,6 +281,39 @@ body { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); } +/* Cleanup Date/Time Inputs */ +.datetime-group { + display: flex; + align-items: center; + gap: 6px; + flex-wrap: wrap; +} +.cleanup-date-input { + font-family: var(--font-family); + font-size: 13px; + padding: 4px 6px; + border: var(--border-width) solid var(--border-color); + border-radius: var(--border-radius); + background: var(--secondary-color); + color: var(--primary-color); + width: 160px; +} +.cleanup-time-input { + font-family: var(--font-family); + font-size: 13px; + padding: 4px 6px; + border: var(--border-width) solid var(--border-color); + border-radius: var(--border-radius); + background: var(--secondary-color); + color: var(--primary-color); + width: 110px; +} +.datetime-hint { + font-size: 11px; + color: var(--muted-color); + font-style: italic; +} + /* Cleanup Confirmation Modal */ .modal-overlay { position: fixed; diff --git a/admin/index.php b/admin/index.php index 6055b4d..caacc49 100644 --- a/admin/index.php +++ b/admin/index.php @@ -453,12 +453,20 @@ $display_name = $relay_version ? ($relay_name . ' ' . $relay_version) : $relay_n