I have a dashboard page that users left open on the TV overnight.
I noticed there was a bug last night, it needs to reload as soon as it detects a new day.
Let's say today is 4/29. So, right at the first second of 4/30, I need to reload the page.
I use moment.js in my application. I'm not sure if I should load the page at midnight 12:00 PM or at 12:01 AM. I'm afraid that when I do it at 12:00 PM, it still considering the day as 4/29 making the reloading never happen and the bug still being there.
if(moment("24:00:00", "hh:mm:ss").diff(moment(), 'seconds') == 0){
location.reload();
}
or should I do this?
if(moment().format("h") == 12){
location.reload();
}
How do I make sure that? How to verify that ?
Edit
I have this code
//====================================
// RUN every 1 mn = 60 s
//====================================
window.setInterval(function () {
getNextFeed('{{ $baby->id }}');
if(moment("24:00:00", "hh:mm:ss").diff(moment(), 'seconds') == -1){
location.reload();
}
}, 60000);
I just added it there.