I am building a food expiry tracker application and when food products are inserted into the application a timer starts. on refresh, the timer starts all over again. To resolve this I used browser local storage. It works but when the app is hosted and another browser opens the application, the timer starts all over again because the browser does not have the initial timer state.
How do I resolve this? do I store the timer in milliseconds in my Mongo DB? but how will the client timer update? Please how do I do this?
You can save the current time using
Date.now(), or by using other methods with storing the time in a record.Here's a quick example I made
Date Methods