mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 11:07:52 +08:00
fix: 修复季度范围选择器禁用bug
This commit is contained in:
parent
b35a4f967d
commit
287d2ba4f0
@ -531,8 +531,8 @@ export class DateRangePicker extends React.Component<
|
|||||||
|
|
||||||
checkStartIsValidDate(currentDate: moment.Moment) {
|
checkStartIsValidDate(currentDate: moment.Moment) {
|
||||||
let {endDate, startDate} = this.state;
|
let {endDate, startDate} = this.state;
|
||||||
|
let {minDate, maxDate, minDuration, maxDuration, viewMode} = this.props;
|
||||||
let {minDate, maxDate, minDuration, maxDuration} = this.props;
|
const precision = viewMode === 'quarters' ? 'quarter' : 'day';
|
||||||
|
|
||||||
maxDate =
|
maxDate =
|
||||||
maxDate && endDate
|
maxDate && endDate
|
||||||
@ -541,9 +541,9 @@ export class DateRangePicker extends React.Component<
|
|||||||
: endDate
|
: endDate
|
||||||
: maxDate || endDate;
|
: maxDate || endDate;
|
||||||
|
|
||||||
if (minDate && currentDate.isBefore(minDate, 'day')) {
|
if (minDate && currentDate.isBefore(minDate, precision)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (maxDate && currentDate.isAfter(maxDate, 'day')) {
|
} else if (maxDate && currentDate.isAfter(maxDate, precision)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (
|
} else if (
|
||||||
// 如果配置了 minDuration 那么 EndDate - minDuration 之后的天数也不能选
|
// 如果配置了 minDuration 那么 EndDate - minDuration 之后的天数也不能选
|
||||||
@ -565,8 +565,8 @@ export class DateRangePicker extends React.Component<
|
|||||||
|
|
||||||
checkEndIsValidDate(currentDate: moment.Moment) {
|
checkEndIsValidDate(currentDate: moment.Moment) {
|
||||||
let {startDate} = this.state;
|
let {startDate} = this.state;
|
||||||
|
let {minDate, maxDate, minDuration, maxDuration, viewMode} = this.props;
|
||||||
let {minDate, maxDate, minDuration, maxDuration} = this.props;
|
const precision = viewMode === 'quarters' ? 'quarter' : 'day';
|
||||||
|
|
||||||
minDate =
|
minDate =
|
||||||
minDate && startDate
|
minDate && startDate
|
||||||
@ -575,9 +575,9 @@ export class DateRangePicker extends React.Component<
|
|||||||
: startDate
|
: startDate
|
||||||
: minDate || startDate;
|
: minDate || startDate;
|
||||||
|
|
||||||
if (minDate && currentDate.isBefore(minDate, 'day')) {
|
if (minDate && currentDate.isBefore(minDate, precision)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (maxDate && currentDate.isAfter(maxDate, 'day')) {
|
} else if (maxDate && currentDate.isAfter(maxDate, precision)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (
|
} else if (
|
||||||
startDate &&
|
startDate &&
|
||||||
|
Loading…
Reference in New Issue
Block a user