Sfoglia il codice sorgente

Calendar: fix first-day-of-week (#21057)

好多大米 4 anni fa
parent
commit
8168d14e67
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      packages/calendar/src/date-table.vue

+ 2 - 1
packages/calendar/src/date-table.vue

@@ -124,7 +124,8 @@ export default {
         let firstDay = getFirstDayOfMonth(date);
         firstDay = firstDay === 0 ? 7 : firstDay;
         const firstDayOfWeek = typeof this.firstDayOfWeek === 'number' ? this.firstDayOfWeek : 1;
-        const prevMonthDays = getPrevMonthLastDays(date, firstDay - firstDayOfWeek).map(day => ({
+        const offset = (7 + firstDay - firstDayOfWeek) % 7;
+        const prevMonthDays = getPrevMonthLastDays(date, offset).map(day => ({
           text: day,
           type: 'prev'
         }));