res.cookie("cookieJWT", accessToken, {
secure: false,
httpOnly: true,
expires: // This needs a javascript date object, how do I create one for tomorrow?
});
普通的nodeJS可以做到這一點嗎?還是我需要下載一些模塊?
uj5u.com熱心網友回復:
如果您的意思是“明天”在 24 小時后,這將起作用。
new Date(Date.now() 24 * 60 * 60 * 1000);
如果你的意思是明天的開始,你可以這樣做。但請注意,在這種情況下,當前時區會影響結果。
const tomorrow = new Date(Date.now() 24 * 60 * 60 * 1000);
new Date(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate());
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/436464.html
標籤:javascript 节点.js 约会时间
上一篇:如何將請求查詢id='[12eetftt76237,jhgasduyas7657]'轉換為元素陣列或字串數??組[12eetftt76237,jhgasduyas7657]?
