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"))