var date = new Date();
date.setDate(date.getDate() + 1)
console.log(`streak=0; expires=${date.toLocaleString('en-us', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' })}`);
In my output, I get streak=0; expires=Sunday, January 2, 2022
My question is:
How can I format the date like this:
Thu, 18 Dec 2013 12:00:00 UTC
(12 and UTC don't need to be included)
I want the date number to go first then the month, not the other way around.
I am doing this because I need it to be formatted like that for a cookie:
document.cookie = "username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC";
(w3schools)
Tell me if that's not how you use cookies.