Skip to content

Commit

Permalink
weekStartDay did not influence the order of the weekdays in the header
Browse files Browse the repository at this point in the history
  • Loading branch information
dspangenberg committed Oct 11, 2017
1 parent 9ca05a6 commit af6a7c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/date-picker/base/date-table.vue
Expand Up @@ -3,7 +3,9 @@
:class="classes"
@mousemove="handleMouseMove">
<div :class="[prefixCls + '-header']">
<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>
<span v-for="day in headerDays" :key="day">
{{day}}
</span>
</div>
<span :class="getCellCls(cell)" v-for="(cell, index) in readCells"><em :index="index" @click="handleClick(cell)">{{ cell.text }}</em></span>
</div>
Expand Down Expand Up @@ -87,6 +89,14 @@
`${prefixCls}`
];
},
headerDays () {
const weekStartDay = Number(this.t('i.datepicker.weekStartDay'));
const translatedDays = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'].map(item => {
return this.t('i.datepicker.weeks.' + item);
})
const weekDays = translatedDays.splice(weekStartDay, 7 - weekStartDay).concat(translatedDays.splice(0, weekStartDay));
return weekDays;
},
cells () {
const date = new Date(this.year, this.month, 1);
const weekStartDay = Number(this.t('i.datepicker.weekStartDay'));
Expand Down
Empty file modified yarn.lock 100644 → 100755
Empty file.

0 comments on commit af6a7c4

Please sign in to comment.