I want to read the expiration date of a cookie.
This is how I set up a cookie:
res.cookie("tokenCookie", token, {
secure: false,
httpOnly: true,
expires: dayjs().add(1, "hour").toDate(),
});
I used the cookie-parser
library and req.cookies
returned the key value pair of the cookie and its value. However, the value doesn’t include the expiration date of the cookie, only the value I assigned the cookie to store.
{
tokenCookie: 'sample.auth.token'
}
How can I read or access the expiration date in the expires
attribute?