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

fix: datepicker endDate min max #2096

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shineout",
"version": "2.0.14",
"version": "2.0.15-beta.1",
"description": "Shein 前端组件库",
"main": "./lib/index.js",
"module": "./es/index.js",
Expand Down
4 changes: 4 additions & 0 deletions site/pages/documentation/changelog/2.x.x.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

### 2.0.15-beta.1

- 修复 DatePicker 选择结束时间 min max 无效的问题

### 2.0.14

- 修复 FormRef.clearValidate 无法清除校验错误的问题(< 2.0.14)
Expand Down
9 changes: 5 additions & 4 deletions src/DatePicker/Day.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,26 @@ class Day extends PureComponent<UnionPannelProps, DayState> {
} else if ((minD && utils.compareAsc(date, minD) < 0) || (maxD && utils.compareAsc(date, maxD) > 0))
isDisabled = true
}
if (!isDisabled && index === 1 && rangeTemp) {
if (!isDisabled && index === 1) {
if (type === 'week') {
if (
(typeof range === 'number' &&
rangeTemp &&
utils.compareWeek(date, utils.addSeconds(rangeTemp, range, this.getOptions()), 0, this.getOptions()) > 0) ||
utils.compareWeek(date, utils.clearHMS(rangeTemp, this.getOptions()), 0, this.getOptions()) < 0
(rangeTemp && utils.compareWeek(date, utils.clearHMS(rangeTemp, this.getOptions()), 0, this.getOptions()) < 0)
) {
isDisabled = true
}
} else if (
(typeof range === 'number' &&
rangeTemp &&
utils.compareAsc(date, utils.addSeconds(rangeTemp, range, this.getOptions())) > 0) ||
utils.compareAsc(date, utils.clearHMS(rangeTemp, this.getOptions())) < 0 ||
(rangeTemp && utils.compareAsc(date, utils.clearHMS(rangeTemp, this.getOptions())) < 0) ||
(min && utils.compareAsc(date, utils.clearHMS(min, this.getOptions())) < 0) ||
utils.compareAsc(date, max) > 0
) {
isDisabled = true
}
// if (utils.compareAsc(date, min) < 0) isDisabled = true
}

if (!isDisabled && index === 0) {
Expand Down
Loading