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

99
Views
Time-based expiration After 30 minutes of inactivity and At midnight

I created a cookie function to set 30-minute cookies. And it's working.

I want to alter the code and want to handle a single case. The cookie should expire automatically at midnight (or 12 a.m.). (i.e., if the cookie is set at 11:45, it should expire at midnight and after 12 a.m. new cookie should be set)

So it should work fine in both cases with a 30-minute cookie and a midnight expiration.

Code Example:

**

function set30MinuteCookie(cname, cvalue) {
  var d = new Date();
  d.setTime(d.getTime() + 30 * 60 * 1000);
  var expires = "expires=" + d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires;
}
set30MinuteCookie();

**

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!