From 117b8c82ef02b95d289cd1ad22f226828918a18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sun, 28 May 2023 14:02:01 -0600 Subject: Changed date format. On the user end it displays in a human readable way. On the database it is saved in ISO format. A lot of changes had to be made to control it. --- src/ToDo-UI/NewToDo.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/ToDo-UI/NewToDo.jsx') 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()); -- cgit v1.2.3