fix the problem that the day of week in date time / date range picker is wrong

This commit is contained in:
MaysWind
2023-04-22 01:10:22 +08:00
parent e2eb5fabcc
commit f95c4393d2
3 changed files with 21 additions and 2 deletions
@@ -91,7 +91,7 @@ export default {
return this.$store.getters.currentUserFirstDayOfWeek;
},
dayNames() {
return this.$locale.getAllMinWeekdayNames();
return this.$utilities.arrangeArrayWithNewStartIndex(this.$locale.getAllMinWeekdayNames(), this.firstDayOfWeek);
},
is24Hour() {
const datetimeFormat = this.$t('format.datetime.long');
@@ -66,7 +66,7 @@ export default {
return this.$store.getters.currentUserFirstDayOfWeek;
},
dayNames() {
return this.$locale.getAllMinWeekdayNames();
return this.$utilities.arrangeArrayWithNewStartIndex(this.$locale.getAllMinWeekdayNames(), this.firstDayOfWeek);
},
is24Hour() {
const datetimeFormat = this.$t('format.datetime.long');
+19
View File
@@ -462,6 +462,24 @@ function copyArrayTo(fromArray, toArray) {
return toArray;
}
function arrangeArrayWithNewStartIndex(array, startIndex) {
if (startIndex <= 0 || startIndex >= array.length) {
return array;
}
const newArray = [];
for (let i = startIndex; i < array.length; i++) {
newArray.push(array[i]);
}
for (let i = 0; i < startIndex; i++) {
newArray.push(array[i]);
}
return newArray;
}
function appendThousandsSeparator(value) {
if (!settings.isEnableThousandsSeparator() || value.length <= 3) {
return value;
@@ -927,6 +945,7 @@ export default {
isDateRangeMatchFullMonths,
copyObjectTo,
copyArrayTo,
arrangeArrayWithNewStartIndex,
appendThousandsSeparator,
numericCurrencyToString,
stringCurrencyToNumeric,