fix(Calendar): fix startDay with range type and allow same day

This commit is contained in:
johnsonwong666 2023-06-26 16:00:43 +08:00
parent 1ad122b9cf
commit 35b199f9f6

View File

@ -211,14 +211,14 @@ VantComponent({
const [startDay, endDay] = defaultDate || []; const [startDay, endDay] = defaultDate || [];
const startDate = getTime(startDay || now);
const start = this.limitDateRange( const start = this.limitDateRange(
startDay || now, startDate,
minDate, minDate,
getPrevDay(new Date(maxDate)).getTime() allowSameDay ? startDate : getPrevDay(new Date(maxDate)).getTime()
); );
const date = getTime(endDay || now); const date = getTime(endDay || now);
const end = this.limitDateRange( const end = this.limitDateRange(
date, date,
allowSameDay ? date : getNextDay(new Date(minDate)).getTime() allowSameDay ? date : getNextDay(new Date(minDate)).getTime()