Skip to content

Commit 6430a10

Browse files
committed
fix: Event internal-model-change not emitting on model change with model-auto enabled (fixes #1077)
1 parent 2fba8c3 commit 6430a10

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/VueDatePicker/composables/external-internal-mapper.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,14 @@ export const useExternalInternalMapper = (emit: VueEmit, props: AllPropsType, is
226226
};
227227

228228
// Get value for model-auto, single or array, internally it is always handled as an array
229-
const getModelAutoForExternal = () =>
230-
(internalModelValue.value as Date[])[1]
231-
? getRangeEmitValue()
232-
: toModelType(convertType(internalModelValue.value[0]));
229+
const getModelAutoForExternal = () => {
230+
if (Array.isArray(internalModelValue.value)) {
231+
return internalModelValue.value[1]
232+
? getRangeEmitValue()
233+
: toModelType(convertType(internalModelValue.value[0]));
234+
}
235+
return [];
236+
};
233237

234238
// Map internal value for external
235239
const getMultiDatesForExternal = () =>

0 commit comments

Comments
 (0)