mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
fix: input-datetime 日期时间区间时分秒范围问题修复 (#2533)
This commit is contained in:
parent
5da772d387
commit
2ecc37ef45
@ -417,7 +417,7 @@ export class DateRangePicker extends React.Component<
|
||||
}
|
||||
|
||||
handleStartChange(newValue: moment.Moment) {
|
||||
const {embed, timeFormat, minDuration, maxDuration} = this.props;
|
||||
const {embed, timeFormat, minDuration, maxDuration, minDate} = this.props;
|
||||
const {startDate, endDate} = this.state;
|
||||
|
||||
if (
|
||||
@ -437,9 +437,13 @@ export class DateRangePicker extends React.Component<
|
||||
);
|
||||
}
|
||||
|
||||
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
||||
newValue = minDate
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
startDate: this.filterDate(newValue, startDate, timeFormat, 'start')
|
||||
startDate: this.filterDate(newValue, startDate || minDate, timeFormat, 'start')
|
||||
},
|
||||
() => {
|
||||
embed && this.confirm();
|
||||
@ -448,7 +452,7 @@ export class DateRangePicker extends React.Component<
|
||||
}
|
||||
|
||||
handleEndChange(newValue: moment.Moment) {
|
||||
const {embed, timeFormat, minDuration, maxDuration} = this.props;
|
||||
const {embed, timeFormat, minDuration, maxDuration, maxDate} = this.props;
|
||||
const {startDate, endDate} = this.state;
|
||||
|
||||
if (
|
||||
@ -469,9 +473,13 @@ export class DateRangePicker extends React.Component<
|
||||
);
|
||||
}
|
||||
|
||||
if (maxDate && newValue && newValue.isAfter(maxDate, 'second')) {
|
||||
newValue = maxDate;
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
endDate: this.filterDate(newValue, endDate, timeFormat, 'end')
|
||||
endDate: this.filterDate(newValue, endDate || maxDate, timeFormat, 'end')
|
||||
},
|
||||
() => {
|
||||
embed && this.confirm();
|
||||
|
Loading…
Reference in New Issue
Block a user