I have a question about auto-updating data when passing local midnight.
Scenario
I am building a web app that contains daily practice
content. Similar to Leetcode's everyday problem.
The daily practice
will auto-update when passing local midnight.
Thoughts
I have searched a lot about repeating and auto-update posts. But most of them are related to setInterval
which is mainly repeating after certain time duration, not to a certain time point.
There are two posts in the community:
How to make Javascript time automatically update
How to get date to auto refresh?
My naive solution:
If I could compromise, not updating exactly at local midnight, I can use setInterval with 24 hours. But it seems weird if a users found content updated at 2:00PM.
My question is: how to realize auto-update when passing local midnight?