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/App.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 '')
-rw-r--r-- | src/App.jsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/App.jsx b/src/App.jsx index 832db93..6f1b14f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -14,14 +14,19 @@ function App() { const dispatch = useDispatch(); function handler(data) { data.map((todo) => { + const due_date = new Date(todo.dueDate); + const offset = due_date.getTimezoneOffset(); + dispatch( set_todo({ id: todo.id, text: todo.text, due_date: todo.dueDate != null - ? todo.dueDate.substring(0, 16) - : todo.dueDate, + ? new Date(due_date - offset * 60 * 1000) + .toISOString() + .slice(0, -1) + : "", done: todo.done, priority: todo.priority, creation_date: todo.creationDate, |