fix: pay attention to week start setting

This commit is contained in:
kolaente 2021-12-29 16:51:21 +01:00
parent 8f8d25ece1
commit c24b8af00d
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,8 @@ const {t} = useI18n()
const emit = defineEmits(['dateChanged']) const emit = defineEmits(['dateChanged'])
const weekStart = computed<number>(() => store.state.auth.settings.weekStart) // FIXME: This seems to always contain the default value - that breaks the picker
const weekStart = computed<number>(() => store.state.auth.settings.weekStart ?? 0)
const flatPickerConfig = computed(() => ({ const flatPickerConfig = computed(() => ({
altFormat: t('date.altFormatLong'), altFormat: t('date.altFormatLong'),
altInput: true, altInput: true,
@ -55,10 +56,9 @@ const flatPickerConfig = computed(() => ({
enableTime: false, enableTime: false,
inline: true, inline: true,
mode: 'range', mode: 'range',
/*locale: { locale: {
// FIXME: This seems to always contain the default value - that breaks the picker
firstDayOf7Days: weekStart, firstDayOf7Days: weekStart,
},*/ },
})) }))
const dateRange = ref<string>('') const dateRange = ref<string>('')
@ -110,7 +110,7 @@ const datesToday = computed<string>(() => {
function thisWeek() { function thisWeek() {
const startDate = startOfDay(new Date()) const startDate = startOfDay(new Date())
const first = startDate.getDate() - startDate.getDay() const first = startDate.getDate() - startDate.getDay() + weekStart.value
startDate.setDate(first) startDate.setDate(first)
const endDate = endOfDay(new Date((new Date(startDate).setDate(first + 6)))) const endDate = endOfDay(new Date((new Date(startDate).setDate(first + 6))))