fix(Calendar): range type defaultDate when set allowSameDay (#10971)

This commit is contained in:
chenyunjie 2022-08-27 11:15:46 +08:00 committed by GitHub
parent da3400435f
commit 35f81fb208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,7 +134,7 @@ export default defineComponent({
};
const getInitialDate = (defaultDate = props.defaultDate) => {
const { type, minDate, maxDate } = props;
const { type, minDate, maxDate, allowSameDay } = props;
if (defaultDate === null) {
return defaultDate;
@ -151,7 +151,10 @@ export default defineComponent({
minDate,
getPrevDay(maxDate)
);
const end = limitDateRange(defaultDate[1] || now, getNextDay(minDate));
const end = limitDateRange(
defaultDate[1] || now,
allowSameDay ? minDate : getNextDay(minDate)
);
return [start, end];
}