fix: 修复dateRange组件minDuration和maxDuration失效的问题 (#4820)

Co-authored-by: jinye <jinye@baidu.com>
This commit is contained in:
lmaomaoz 2022-07-08 11:17:50 +08:00 committed by GitHub
parent c61787bc7a
commit ad41eb807c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -920,14 +920,14 @@ export class DateRangePicker extends React.Component<
if (
startDate &&
minDuration &&
newValue.isAfter(startDate.clone().add(minDuration))
newValue.isBefore(startDate.clone().add(minDuration))
) {
newValue = startDate.clone().add(minDuration);
}
if (
startDate &&
maxDuration &&
newValue.isBefore(startDate.clone().add(maxDuration))
newValue.isAfter(startDate.clone().add(maxDuration))
) {
newValue = startDate.clone().add(maxDuration);
}