Update localstorage on first load

This commit is contained in:
Zachary
2024-11-11 23:23:36 +01:00
parent 40abbe99ea
commit 1b5ba69b9a

View File

@@ -31,6 +31,9 @@
if (storedCountry) selectedCountry = storedCountry; if (storedCountry) selectedCountry = storedCountry;
if (storedDaysOff) daysOff = parseInt(storedDaysOff); if (storedDaysOff) daysOff = parseInt(storedDaysOff);
// Ensure holidays are updated after loading settings
updateHolidays();
fetchCountryCode(); fetchCountryCode();
adjustInputWidth(inputElement); adjustInputWidth(inputElement);
inputElement.addEventListener('input', () => { inputElement.addEventListener('input', () => {
@@ -73,6 +76,7 @@
} }
if (typeof window !== 'undefined') { // Check if running in the browser if (typeof window !== 'undefined') { // Check if running in the browser
localStorage.setItem('year', year); // Save to local storage localStorage.setItem('year', year); // Save to local storage
localStorage.setItem('daysOff', daysOff); // Save to local storage
} }
} }