ElemeFE / ElemeFE/element

[Bug Report] date-table inside date-picker display error with set firstDayOfWeek and disabledDate in pickerOptions

Open
#21,061 0 comments 0 reactions 0 assignees View on GitHub
component: date-picker type: bug
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Element UI version
2.15.2

### OS/Browsers version
Chrome

### Vue version
2.6.14

### Reproduction Link
https://codepen.io/leonli0915/pen/GRWXmyM

### Steps to reproduce
The date-picker selector is configured with picker-options. The content includes firstDayOfWeek (set to the value of getDay() 1 on the first day of the month), disabledDate is set to be greater than today’s disabled, and then click on the date-picker selector to see To the selector display exception。

**Repair operation**
File address:`packages\date-picker\src\basic\date-table.vue`
Modify content:
```
offsetDay() {
const week = this.firstDayOfWeek;
const date = new Date(this.year, this.month, 1);
let day = getFirstDayOfMonth(date);
return week > day ? 7 - week : -week
}
```

### What is Expected?
Expect that the date after the current day is not selectable (disabled)

### What is actually happening?
Dates before this are also disabled, such as today 2021-06-10, but the selected day in the date-table is 2021-06-03, and dates after 03 are disabled

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.