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