document.addEventListener('DOMContentLoaded', function() { // Task form submission const taskForm = document.getElementById('taskForm'); const taskList = document.getElementById('taskList'); taskForm.addEventListener('submit', function(e) { e.preventDefault(); // Get form values const taskName = this.elements[0].value; const description = this.elements[1].value; const dueDate = this.elements[2].value; const recurrence = this.elements[3].value; const telegramNotify = this.elements[4].checked; // Create new task element const taskItem = document.createElement('div'); taskItem.className = 'task-item bg-gray-800 rounded-lg p-4 border border-gray-700 hover:border-secondary transition duration-200'; const formattedDate = new Date(dueDate).toLocaleString('en-US', { weekday: 'short', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }); taskItem.innerHTML = `
Due: ${formattedDate}