I have a token and I want to save it in cookie for only 1 hour.
Here is my code :
time= 3600 * 1000;
let expires = new Date();
expires.setDate(expires + time);
console.log(expires);
document.cookie =`${name}=${value};expires=${expires.toUTCString()};path=/`;
When I run it in chrome I see the following:
Invalid Date
For more info I use the following for implementing my function:
How to set a cookie to expire in 1 hour in Javascript?
Can anyone shed light on this? what am I doing wrong?