diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-28 14:02:01 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-28 14:02:01 -0600 |
commit | 117b8c82ef02b95d289cd1ad22f226828918a18b (patch) | |
tree | 5a8cdec24b2db8b6ed18d3663c9ff05da201644d /src/ToDo-UI/NewToDo.jsx | |
parent | c1f97240230ada378d77eeb8db726e0d936169c8 (diff) | |
download | ToDo-App-FE-117b8c82ef02b95d289cd1ad22f226828918a18b.tar.gz ToDo-App-FE-117b8c82ef02b95d289cd1ad22f226828918a18b.zip |
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.
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()); |