From: PhiTux Date: Wed, 22 Oct 2025 16:55:41 +0000 (+0200) Subject: fixed wrong day-of-week in calendar X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=a528e13ef0ba17db2683bcf7cff5e672c11b2e03;p=DailyTxT.git fixed wrong day-of-week in calendar --- diff --git a/frontend/src/lib/Datepicker.svelte b/frontend/src/lib/Datepicker.svelte index eac204e..1fd4447 100644 --- a/frontend/src/lib/Datepicker.svelte +++ b/frontend/src/lib/Datepicker.svelte @@ -20,7 +20,11 @@ let lastYear = $cal.currentYear; $effect(() => { - if ($cal.currentMonth !== lastMonth || $cal.currentYear !== lastYear) { + if ( + ($cal.currentMonth !== lastMonth || $cal.currentYear !== lastYear) && + $settings.firstDayOfWeek !== undefined + ) { + console.log($settings.firstDayOfWeek); // set animation direction animationDirection = $cal.currentMonth > lastMonth ? 1 : -1; if ($cal.currentYear > lastYear) { @@ -114,9 +118,15 @@ } }); - onMount(() => { - days = updateCalendar(); + let firstDayOfWeekInitialized = false; + $effect(() => { + if (!firstDayOfWeekInitialized && $settings.firstDayOfWeek !== undefined) { + days = updateCalendar(); + firstDayOfWeekInitialized = true; + } + }); + onMount(() => { oc = document.querySelector('.offcanvas'); oc.addEventListener('hidden.bs.offcanvas', () => { $offcanvasIsOpen = false;