From e37145cd43b6081605c7f0ad6e711bb0892d75c8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 3 Jun 2021 18:12:40 +0200 Subject: [PATCH] Add setting for the first day of the week --- src/components/input/datepicker.vue | 22 ++++++++++++------- src/components/list/partials/filters.vue | 22 ++++++++++++------- src/components/tasks/edit-task.vue | 8 ------- src/components/tasks/partials/defer-task.vue | 23 ++++++++++++-------- src/models/userSettings.js | 1 + src/store/modules/auth.js | 11 ++++++++-- src/views/list/views/Gantt.vue | 18 ++++++++++----- src/views/tasks/ShowTasks.vue | 18 ++++++++------- src/views/user/Settings.vue | 13 +++++++++++ 9 files changed, 87 insertions(+), 49 deletions(-) diff --git a/src/components/input/datepicker.vue b/src/components/input/datepicker.vue index ec395cd3..2260d67d 100644 --- a/src/components/input/datepicker.vue +++ b/src/components/input/datepicker.vue @@ -118,6 +118,7 @@ import {calculateDayInterval} from '@/helpers/time/calculateDayInterval' import {calculateNearestHours} from '@/helpers/time/calculateNearestHours' import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside' import {createDateFromString} from '@/helpers/time/createDateFromString' +import {mapState} from 'vuex' export default { name: 'datepicker', @@ -127,14 +128,6 @@ export default { show: false, changed: false, - flatPickerConfig: { - altFormat: 'j M Y H:i', - altInput: true, - dateFormat: 'Y-m-d H:i', - enableTime: true, - time_24hr: true, - inline: true, - }, // Since flatpickr dates are strings, we need to convert them to native date objects. // To make that work, we need a separate variable since flatpickr does not have a change event. flatPickrDate: null, @@ -172,6 +165,19 @@ export default { this.updateData() }, }, + computed: mapState({ + flatPickerConfig: state => ({ + altFormat: 'j M Y H:i', + altInput: true, + dateFormat: 'Y-m-d H:i', + enableTime: true, + time_24hr: true, + inline: true, + locale: { + firstDayOfWeek: state.auth.settings.weekStart, + }, + }) + }), methods: { setDateValue(newVal) { if(newVal === null) { diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue index a58638ce..478c4f0b 100644 --- a/src/components/list/partials/filters.vue +++ b/src/components/list/partials/filters.vue @@ -205,6 +205,7 @@ import UserService from '@/services/user' import LabelService from '@/services/label' import ListService from '@/services/list' import NamespaceService from '@/services/namespace' +import {mapState} from 'vuex' export default { name: 'filters', @@ -243,14 +244,6 @@ export default { list_id: '', namespace: '', }, - flatPickerConfig: { - altFormat: 'j M Y H:i', - altInput: true, - dateFormat: 'Y-m-d H:i', - enableTime: true, - time_24hr: true, - mode: 'range', - }, usersService: UserService, foundusers: [], @@ -291,6 +284,19 @@ export default { this.prepareFilters() }, }, + computed: mapState({ + flatPickerConfig: state => ({ + altFormat: 'j M Y H:i', + altInput: true, + dateFormat: 'Y-m-d H:i', + enableTime: true, + time_24hr: true, + mode: 'range', + locale: { + firstDayOfWeek: state.auth.settings.weekStart, + }, + }) + }), methods: { change() { this.$emit('input', this.params) diff --git a/src/components/tasks/edit-task.vue b/src/components/tasks/edit-task.vue index 92240135..0e4f6393 100644 --- a/src/components/tasks/edit-task.vue +++ b/src/components/tasks/edit-task.vue @@ -94,14 +94,6 @@ export default { newTask: TaskModel, isTaskEdit: false, taskEditTask: TaskModel, - flatPickerConfig: { - altFormat: 'j M Y H:i', - altInput: true, - dateFormat: 'Y-m-d H:i', - enableTime: true, - onOpen: this.updateLastReminderDate, - onClose: this.addReminderDate, - }, } }, components: { diff --git a/src/components/tasks/partials/defer-task.vue b/src/components/tasks/partials/defer-task.vue index d1ed8788..0f6c0c47 100644 --- a/src/components/tasks/partials/defer-task.vue +++ b/src/components/tasks/partials/defer-task.vue @@ -40,6 +40,7 @@