From e2d18cf7d53a48a3b59a3f84370724a350a5d56a Mon Sep 17 00:00:00 2001 From: Dejan Date: Tue, 15 Oct 2024 22:52:53 +0200 Subject: [PATCH] - Sorted the todo list and showed the todos by sorted date --- components/pages/todos/ToDosList.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/pages/todos/ToDosList.tsx b/components/pages/todos/ToDosList.tsx index 3492785..0a68263 100644 --- a/components/pages/todos/ToDosList.tsx +++ b/components/pages/todos/ToDosList.tsx @@ -7,7 +7,8 @@ import { AntDesign } from "@expo/vector-icons"; import {IToDo} from "@/hooks/firebase/types/todoData"; const groupToDosByDate = (toDos: IToDo[]) => { - return toDos.reduce((groups, toDo) => { + let sortedTodos = toDos.sort((a, b) => a.date - b.date); + return sortedTodos.reduce((groups, toDo) => { let dateKey; if (toDo.date === null) {