I am using js-cookie to set a cookie with a 1 hour expiry like so:
const cookieExpiry = new Date( new Date().getTime() + 60 * 60 * 1000 );
const newCookie = Cookies.set("apiKey", "apiKeyFakeValue123456", { expires: cookieExpiry });
How would I check age of cookie is equal to or greater than 60m?
My best attempt (not even grabbing expiry value from the time it was set:):
if (newCookie.getTime >= 60){ return someFunction();}
Many thanks in advance:)
Barmar answered the question with: if (Cookies.get("apiKey"))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.