Set cookie expiration date 1000 days from current date instead of 1 day

Created on 14 August 2024, 3 months ago
Updated 15 August 2024, 3 months ago

Problem/Motivation

Comment in /targets/js/targets.cookies.js states that cookie will expire in 1000 days, in reality it is only 1 day.

        // The cookie will expire in 1000 days.
        const date = new Date();
        date.setTime(date.getTime() + 86400 * 1000);
        document.cookie = `${cookieName}=${target}; expires=${date.toUTCString()}; path=/`;

Steps to reproduce

Verify via browser console:

(function() {
  const date = new Date();
  date.setTime(date.getTime() + 86400 * 1000);
  console.log(date.toUTCString()); 
})();

Proposed resolution

Replace date.setTime(date.getTime() + 86400 * 1000); with date.setTime(date.getTime() + 86400 * 1000 * 1000);.

🐛 Bug report
Status

Needs review

Version

1.1

Component

Code

Created by

🇧🇪Belgium tvb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024