Commit af6a7c488e7250ec5afe03e0e9ff4c53787496f8

Authored by Danny Spangenberg
1 parent 9ca05a64

weekStartDay did not influence the order of the weekdays in the header

Showing 2 changed files with 11 additions and 1 deletions   Show diff stats
src/components/date-picker/base/date-table.vue
... ... @@ -3,7 +3,9 @@
3 3 :class="classes"
4 4 @mousemove="handleMouseMove">
5 5 <div :class="[prefixCls + '-header']">
6   - <span>{{ t('i.datepicker.weeks.sun') }}</span><span>{{ t('i.datepicker.weeks.mon') }}</span><span>{{ t('i.datepicker.weeks.tue') }}</span><span>{{ t('i.datepicker.weeks.wed') }}</span><span>{{ t('i.datepicker.weeks.thu') }}</span><span>{{ t('i.datepicker.weeks.fri') }}</span><span>{{ t('i.datepicker.weeks.sat') }}</span>
  6 + <span v-for="day in headerDays" :key="day">
  7 + {{day}}
  8 + </span>
7 9 </div>
8 10 <span :class="getCellCls(cell)" v-for="(cell, index) in readCells"><em :index="index" @click="handleClick(cell)">{{ cell.text }}</em></span>
9 11 </div>
... ... @@ -87,6 +89,14 @@
87 89 `${prefixCls}`
88 90 ];
89 91 },
  92 + headerDays () {
  93 + const weekStartDay = Number(this.t('i.datepicker.weekStartDay'));
  94 + const translatedDays = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'].map(item => {
  95 + return this.t('i.datepicker.weeks.' + item);
  96 + })
  97 + const weekDays = translatedDays.splice(weekStartDay, 7 - weekStartDay).concat(translatedDays.splice(0, weekStartDay));
  98 + return weekDays;
  99 + },
90 100 cells () {
91 101 const date = new Date(this.year, this.month, 1);
92 102 const weekStartDay = Number(this.t('i.datepicker.weekStartDay'));
... ...
yarn.lock 100644 → 100755