The specified purchase restriction time is within 24 hours.

I have a need, for example, the current time is 20:23 on 2018-5-22
the user starts to place an order, but the amount has not been paid. This order is still valid during these 24 hours, that is, to
2018-5-23 22:23 minutes end
I want to update every minute with a timer to remind the user how many hours and minutes are left
. The effect is as follows

clipboard.png

Mar.13,2021

transfer the time when the user places an order plus 24 hours (expiration time) into a timestamp to the background, and then start a 24-hour timer;
page refreshes to the background to pick up the difference between the expiration time and the current time.


//
//
let tim=new Date().getTime();

//
let outtim=tim+1000*60*60*24;

//;

outtim-new Date().getTime()

//;
//setInterval(()=>{},1000)  
Menu