Skip to content

Commit 96d8b3b

Browse files
committed
fix: Clearing text-input value with auto-apply emits empty string (fixes #1187)
1 parent d486766 commit 96d8b3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/VueDatePicker/composables/useExternalInternalMapper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const useExternalInternalMapper = () => {
5656
};
5757
};
5858

59-
const getMonthVal = (date: Date): MonthModel | ModelTypeConverted => {
59+
const getMonthVal = (date: Date): MonthModel | ModelTypeConverted | null => {
6060
if (rootProps.modelType) return toModelType(date);
6161
return { month: getMonth(date), year: getYear(date) };
6262
};
@@ -261,8 +261,8 @@ export const useExternalInternalMapper = () => {
261261
return getDate(value);
262262
};
263263

264-
const toModelType = (val: Date): string | number | Date => {
265-
if (!val) return '';
264+
const toModelType = (val: Date): string | number | Date | null => {
265+
if (!val) return null;
266266
if (rootProps.modelType) {
267267
if (rootProps.modelType === 'timestamp') return +val;
268268
if (rootProps.modelType === 'iso') return val.toISOString();

0 commit comments

Comments
 (0)