Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
How to set expiry time to 30 mins in javascript?
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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!