diff --git a/hooks/firebase/useUpdateTodo.ts b/hooks/firebase/useUpdateTodo.ts index 1baeee4..ed5ea3c 100644 --- a/hooks/firebase/useUpdateTodo.ts +++ b/hooks/firebase/useUpdateTodo.ts @@ -140,7 +140,7 @@ export const useUpdateTodo = () => { Sunday: 0, }; - const currentDay = getSelectedDateDay(todoUpdate.date); + const currentDay = getCurrentDay(); const updatedPointsPerDay = todoData.done ? pointsPerDay[currentDay] + todoUpdate.points : pointsPerDay[currentDay] - todoUpdate.points; @@ -185,8 +185,8 @@ export const useUpdateTodo = () => { }) }; -const getSelectedDateDay = (date) => { - let selectedDate = new Date(date.seconds * 1000); +const getCurrentDay = () => { const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; - return days[selectedDate.getDay()]; + const now = new Date(); + return days[now.getDay()]; }; \ No newline at end of file