Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Commit 494361b

Browse files
committed
fix: Issue with partial range in month-picker mode
1 parent 15bed7d commit 494361b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Vue3DatePicker/components/composition/external-internal-mapper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export const useExternalInternalMapper = (
6161
if (isMonthArray(value) && 'month' in value[0] && 'year' in value[0]) {
6262
mappedDate = [
6363
setDateMonthOrYear(null, +value[0].month, +value[0].year),
64-
setDateMonthOrYear(null, +value[1].month, +value[1].year),
64+
value[1]
65+
? setDateMonthOrYear(null, +value[1].month, +value[1].year)
66+
: (null as unknown as Date),
6567
];
6668
} else if (isMonth(value) && 'month' in value && 'year' in value) {
6769
mappedDate = setDateMonthOrYear(null, +value.month, +value.year);

src/Vue3DatePicker/utils/date-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const getMonthVal = (date: Date): IMonthValue => ({ month: getMonth(date)
135135

136136
export const getMonthValForExternal = (date: Date | Date[]): IMonthValue | IMonthValue[] => {
137137
if (Array.isArray(date)) {
138-
return [getMonthVal(date[0]), getMonthVal(date[1])];
138+
return [getMonthVal(date[0]), date[1] ? getMonthVal(date[1]) : (null as unknown as IMonthValue)];
139139
}
140140
return getMonthVal(date);
141141
};

0 commit comments

Comments
 (0)