diff options
Diffstat (limited to 'src/ToDo-UI/NewToDo.jsx')
-rw-r--r-- | src/ToDo-UI/NewToDo.jsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ToDo-UI/NewToDo.jsx b/src/ToDo-UI/NewToDo.jsx index 8c926b2..dc062db 100644 --- a/src/ToDo-UI/NewToDo.jsx +++ b/src/ToDo-UI/NewToDo.jsx @@ -59,15 +59,21 @@ export function NewToDo() { function handle_add_todo() { new_todo_api({ text: new_text, - due_date: new_due_date, + due_date: + new_due_date.length == 0 + ? "" + : new Date(new_due_date).toISOString(), priority: new_priority, }); dispatch( add_todo({ text: new_text, - due_date: new_due_date, + due_date: + new_due_date.length == 0 + ? "" + : new Date(new_due_date).toISOString(), priority: new_priority, - creation_date: new Date().toString(), + creation_date: new Date().toISOString(), }) ); dispatch(sort_todo()); |