fix: 🐛 Cookie CN was set in past date

This commit is contained in:
Jérémy Munsch 2024-07-03 11:20:45 +02:00
parent 51384e9c71
commit 63cd8d2df6
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC

View file

@ -186,8 +186,7 @@ export default class CookieNotice {
/** Get a new expiration date */
private getNewExpirationDate(): Date {
const expDate = new Date();
expDate.setMonth(this.cookieExpirationDate.getMonth() + this.cookieTimeLife);
return expDate;
return new Date(expDate.setMonth(expDate.getMonth() + this.cookieTimeLife));
}
// * - CN Browser Cookie Manipulation
@ -274,8 +273,7 @@ export default class CookieNotice {
const key = keyValue[0], value = keyValue[1];
// * Exp Date
if (key === this.cookieExpirationName) {
let expDate = new Date();
expDate.setMonth(this.cookieExpirationDate.getMonth() + this.cookieTimeLife);
let expDate = this.getNewExpirationDate();
try {
const epochExpiration = Number.parseInt(value);
if (!isNaN(epochExpiration)) {