Closed frankcollins3 closed 1 year ago
attempting to do: port <timer> code over from react to next
<timer>
error: no matter what is done the timer never gets set.
useEffect(() => { console.log("is this running?") const currentTime = new Date().getTime(); const currentHour = new Date().getHours();
// find the closest matching time const remainingReminders = hydroSchedule.filter((time) => { console.log('time', time) // if time > currentHour, it's marked as a time for reminder. return time > currentHour; }); **if (remainingReminders.length) { console.log('remainingReminders', remainingReminders) const nextHour = new Date(); nextHour.setMinutes(0); nextHour.setSeconds(0); const timeToNextRemind = Math.ceil( (nextHour.setHours(remainingReminders[0]) - currentTime) / 1000 ); console.log('time to next remind', timeToNextRemind) setTimer(timeToNextRemind); } else { console.log("no remainingReminders.length") }**
proposed approach: tinker for 40 minutes.
solution: the reminders ran from 8am - 4pm there are no remaining hours. change settings to allow for midnight or wait 20 minutes or call it a day.
// going nuts looking everywhere for why logs never get set.
👍 that was the problem. [11:50am]
attempting to do: port
<timer>
code over from react to nexterror: no matter what is done the timer never gets set.
useEffect(() => { console.log("is this running?") const currentTime = new Date().getTime(); const currentHour = new Date().getHours();
proposed approach: tinker for 40 minutes.
solution: the reminders ran from 8am - 4pm there are no remaining hours. change settings to allow for midnight or wait 20 minutes or call it a day.
// going nuts looking everywhere for why logs never get set.