Hola buenas noches, tengo un problema a la hora de de crear la constante complete. Me muestra en la consola undefined y por tal motivo en el local starage no me muestra el atributo complete. Anexo mi codigo
import checkComplete from "./checkComplete.js";
import deleteIcon from "./deleteIcon.js";
import { displayTasks } from "./readTasks.js";
export const addTask = (e) => {
e.preventDefault();
const list = document.querySelector('[data-list]');
const input = document.querySelector('[data-form-input]');
const calendar = document.querySelector('[data-form-date]');
const value = input.value;
const date = calendar.value;
const dateFormat = moment(date).format('DD/MM/YYYY');
if (value === '' || date === '') {
return;
}
input.value = '';
calendar.value = '';
const complete = false;
const taskObj = {
value,
dateFormat,
complete
};
list.innerHTML = '';
const taskList = JSON.parse(localStorage.getItem('tasks')) || [];
taskList.push({value, dateFormat});
localStorage.setItem('tasks', JSON.stringify(taskList));
displayTasks();
}
export const createTask = ({value, dateFormat, complete}) => {
const task = document.createElement('li');
task.classList.add('card');
const taskContent = document.createElement('div');
console.log(complete);
const titleTask = document.createElement('span');
titleTask.classList.add('task');
titleTask.innerText = value;
taskContent.appendChild(checkComplete());
taskContent.appendChild(titleTask);
const dateElement = document.createElement('span');
dateElement.innerHTML = dateFormat;
task.appendChild(taskContent);
task.appendChild(dateElement);
task.appendChild(deleteIcon());
return task;
};