Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysterious Cookie expiration date `1969-12-31T23:59:59.000Z`

Tags:

cookies

I'm setting a cookie expiration (using Express) to a current date. But upon inspection in Chrome, the date is 1969-12-31T23:59:59.000Z.

In Firefox the Cookie's expiration date value is session.

Why is my cookie being set to this date? I'm thinking it is a bug, because Chrome is still sending the cookie, meaning it ACTUALLY ISN'T expired.

like image 405
GN. Avatar asked Jul 13 '18 21:07

GN.


1 Answers

Unix time was started at the beginning of 1970, that means that -1 is in 1969. And that is a commonly used value for "unknown" if the expected value is usually positive. And for cookies MaxAge with a negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits.

source: https://stackoverflow.com/a/51497662/3892213

like image 185
best wishes Avatar answered Jan 25 '23 09:01

best wishes