From 4586632c468798bdd8e2cf9af78b925b31a8feb8 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 9 Sep 2024 08:11:49 +0200 Subject: [PATCH] fix: ensure valid datetime format for task dueTime Converted `dueTime` to a valid datetime-local format to fix display issues in the task edit modal. This resolves inconsistencies where the due time would not display correctly due to format mismatches. --- kanblendar.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kanblendar.js b/kanblendar.js index 1cfbe14..9eab3aa 100644 --- a/kanblendar.js +++ b/kanblendar.js @@ -293,7 +293,11 @@ class Kanblendar { document.getElementById('kanblendar-modalTitle').innerText = 'Edit Task'; document.getElementById('kanblendar-taskTitle').value = task.querySelector('.kanblendar-task-title').innerText; document.getElementById('kanblendar-taskDescription').value = task.querySelector('.kanblendar-task-desc').innerText; - document.getElementById('kanblendar-taskDueTime').value = task.dataset.dueTime || ''; + + // Convert task's dueTime to a valid datetime-local format + const dueTime = task.dataset.dueTime ? new Date(task.dataset.dueTime).toISOString().slice(0,16) : ''; + document.getElementById('kanblendar-taskDueTime').value = dueTime; + document.getElementById('kanblendar-taskColumn').value = task.dataset.column || ''; document.getElementById('kanblendar-taskNotify').value = task.dataset.notifyBefore || ''; this.deleteTaskBtn.style.display = 'block'; // Show delete button when editing @@ -304,6 +308,7 @@ class Kanblendar { } this.taskModal.style.display = 'flex'; } + closeModalFunc() { this.taskModal.style.display = 'none';