Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar : Fix weekdays i18n issue #16772

Merged
merged 3 commits into from
Aug 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/calendar/src/date-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import fecha from 'element-ui/src/utils/date';
import { range as rangeArr, getFirstDayOfMonth, getPrevMonthLastDays, getMonthDays, getI18nSettings, validateRangeInOneMonth } from 'element-ui/src/utils/date-util';

const WEEK_DAYS = getI18nSettings().dayNames;
export default {
props: {
selectedDay: String, // formated date yyyy-MM-dd
Expand All @@ -21,6 +20,12 @@ export default {

inject: ['elCalendar'],

data() {
return {
WEEK_DAYS: getI18nSettings().dayNames
};
},

methods: {
toNestedArr(days) {
return rangeArr(days.length / 7).map((_, index) => {
Expand Down Expand Up @@ -142,6 +147,8 @@ export default {

weekDays() {
const start = this.firstDayOfWeek;
ziyoung marked this conversation as resolved.
Show resolved Hide resolved
const { WEEK_DAYS } = this;

if (typeof start !== 'number' || start === 0) {
return WEEK_DAYS.slice();
} else {
Expand Down