From 63cd8d2df6c93d3a062ea40dad2d60c6e7d37e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 3 Jul 2024 11:20:45 +0200 Subject: [PATCH] fix: :bug: Cookie CN was set in past date --- src/ts/classes/CookieNotice.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ts/classes/CookieNotice.ts b/src/ts/classes/CookieNotice.ts index 7176cfe..4679ff6 100644 --- a/src/ts/classes/CookieNotice.ts +++ b/src/ts/classes/CookieNotice.ts @@ -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)) {