From 44eb5781cde3a4d7a304e24f1b6591f2cbab7d50 Mon Sep 17 00:00:00 2001 From: Andy O'Neill Date: Wed, 31 May 2023 19:12:54 -0400 Subject: [PATCH] fix: expire theme cookie in 1 year --- src/lib/themes/themePersistance.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/themes/themePersistance.js b/src/lib/themes/themePersistance.js index c94ff337a..605670865 100644 --- a/src/lib/themes/themePersistance.js +++ b/src/lib/themes/themePersistance.js @@ -31,11 +31,12 @@ const persistTheme = theme => { if (systemPreferencesTheme() === theme) { // Clear the cookie to represent using the system preferences - document.cookie = `${COOKIE_KEY}=`; + document.cookie = `${COOKIE_KEY}=;path=/`; return; } - document.cookie = `${COOKIE_KEY}=${theme}`; + const expires = new Date(new Date().setYear(new Date().getFullYear() + 1)).toUTCString(); + document.cookie = `${COOKIE_KEY}=${theme};expires=${expires};path=/`; }; export {