mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
fix(DatetimePicker): fix value error when minDate set @rex-zsd (#2137)
This commit is contained in:
@@ -190,12 +190,8 @@ export default create({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// date type
|
// date type
|
||||||
const { maxYear, maxDate, maxMonth, maxHour, maxMinute } = this.getBoundary('max', value);
|
value = Math.max(value, this.minDate.getTime());
|
||||||
const { minYear, minDate, minMonth, minHour, minMinute } = this.getBoundary('min', value);
|
value = Math.min(value, this.maxDate.getTime());
|
||||||
const minDay = new Date(minYear, minMonth - 1, minDate, minHour, minMinute);
|
|
||||||
const maxDay = new Date(maxYear, maxMonth - 1, maxDate, maxHour, maxMinute);
|
|
||||||
value = Math.max(value, minDay);
|
|
||||||
value = Math.min(value, maxDay);
|
|
||||||
|
|
||||||
return new Date(value);
|
return new Date(value);
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user