mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
- Todos point logic changes to use the current day for points
This commit is contained in:
@ -140,7 +140,7 @@ export const useUpdateTodo = () => {
|
|||||||
Sunday: 0,
|
Sunday: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentDay = getSelectedDateDay(todoUpdate.date);
|
const currentDay = getCurrentDay();
|
||||||
const updatedPointsPerDay = todoData.done
|
const updatedPointsPerDay = todoData.done
|
||||||
? pointsPerDay[currentDay] + todoUpdate.points
|
? pointsPerDay[currentDay] + todoUpdate.points
|
||||||
: pointsPerDay[currentDay] - todoUpdate.points;
|
: pointsPerDay[currentDay] - todoUpdate.points;
|
||||||
@ -185,8 +185,8 @@ export const useUpdateTodo = () => {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedDateDay = (date) => {
|
const getCurrentDay = () => {
|
||||||
let selectedDate = new Date(date.seconds * 1000);
|
|
||||||
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
||||||
return days[selectedDate.getDay()];
|
const now = new Date();
|
||||||
|
return days[now.getDay()];
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user