const check=()=>{
const cacheIntervalInMin = 1;
const cacheExpiryTime = new Date();
cacheExpiryTime.setMinutes(cacheExpiryTime.getMinutes() + cacheIntervalInMin);
const lastRequest = new Date().toISOString();
let a= new Date(lastRequest);
if(a>cacheExpiryTime){
console.log(Expired')
}
else console.log('Not expired');
}
check();
I want to set the expiry time to 30 mins but everytime I call this function it is always false . a never becomes greater than expiry time. How to solve this? How to achieve this?