We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 167f8f8 + e9d1fa1 commit d19ceecCopy full SHA for d19ceec
src/components/TrashTurns.js
@@ -19,12 +19,8 @@ const TrashTurns = ({ date }) => {
19
const turnObject = useMemo(() => trashTurns[trashTurnIndex], [trashTurns, trashTurnIndex]);
20
21
const shift = useMemo(() => {
22
- const timeDivider = 1000 * 60 * 60 * 24;
23
- const daysInMonth = new Date(selectedDate.getFullYear(),
24
- selectedDate.getMonth() + 1, 0).getDate();
25
const initialDate = new Date(startingDate);
26
-
27
- return Math.floor((selectedDate - initialDate) / (timeDivider * daysInMonth));
+ return (selectedDate.getMonth() - initialDate.getMonth()) + (12 * (selectedDate.getFullYear() - initialDate.getFullYear()));
28
}, [selectedDate]);
29
30
return (
0 commit comments