### Newest Testing Versions:
```
+2.0.0-testing.4 (2025-10-22)
+- Fixed a bug, that showed wrong weekdays in the calendar
+- Added a feature to choose the first day of the week (Monday or Sunday) in the settings.
+
2.0.0-testing.3 (2025-10-13)
- Updated the migration process in the frontend. When migration fails on serverside, the user now gets notified.
<script>
import { cal, selectedDate, readingDate } from '$lib/calendarStore.js';
- import { readingMode } from '$lib/settingsStore.js';
+ import { readingMode, settings } from '$lib/settingsStore.js';
import { onMount } from 'svelte';
import { fly } from 'svelte/transition';
import * as bootstrap from 'bootstrap';
const lastDay = new Date(year, month + 1, 0);
let tempDays = [];
- // monday is first day
- let firstDayIndex = firstDay.getDay() - 1;
- if (firstDayIndex === -1) firstDayIndex = 6; // sunday gets 6
+ let firstDayIndex;
+
+ if ($settings.firstDayOfWeek === 'sunday') {
+ // sunday is first day
+ firstDayIndex = firstDay.getDay();
+ } else {
+ // monday is first day
+ firstDayIndex = firstDay.getDay() - 1;
+ if (firstDayIndex === -1) firstDayIndex = 6; // sunday gets 6
+ }
for (let i = 0; i < firstDayIndex; i++) {
tempDays.push(null); // Fill empty slots before the first day
}
};
- // weekdays
- const weekDays = [
- $t('calendar.day_short.monday'),
- $t('calendar.day_short.tuesday'),
- $t('calendar.day_short.wednesday'),
- $t('calendar.day_short.thursday'),
- $t('calendar.day_short.friday'),
- $t('calendar.day_short.saturday'),
- $t('calendar.day_short.sunday')
- ];
+ // weekdays (reordered when first day of week is Sunday)
+ const weekDays = $derived.by(() => {
+ const base = [
+ $t('calendar.day_short.monday'),
+ $t('calendar.day_short.tuesday'),
+ $t('calendar.day_short.wednesday'),
+ $t('calendar.day_short.thursday'),
+ $t('calendar.day_short.friday'),
+ $t('calendar.day_short.saturday'),
+ $t('calendar.day_short.sunday')
+ ];
+ return $settings.firstDayOfWeek === 'sunday' ? [base[6], ...base.slice(0, 6)] : base;
+ });
// --- Swipe Navigation (month) ---
let swipeActive = false;
</div>
</div>
+ <div id="FirstDayOfWeek">
+ {#if $tempSettings.firstDayOfWeek !== $settings.firstDayOfWeek}
+ {@render unsavedChanges()}
+ {/if}
+ <h5>{$t('settings.first_day_of_week')}</h5>
+ <div class="form-text mt-2">
+ {$t('settings.first_day_of_week.help_text')}
+ </div>
+ <select class="form-select w-auto" bind:value={$tempSettings.firstDayOfWeek}>
+ <option value="sunday">{$t('weekdays.sunday')}</option>
+ <option value="monday">{$t('weekdays.monday')}</option>
+ </select>
+ </div>
+
<div id="aLookBack">
{#if $tempSettings.useALookBack !== $settings.useALookBack || JSON.stringify(aLookBackYears
.trim()