Skip to content

Commit

Permalink
fix(VDateInput): transform model in / out for VConfirmEdit (#20281)
Browse files Browse the repository at this point in the history
fixes #20146

Co-authored-by: John Leider <john@vuetifyjs.com>
  • Loading branch information
SonTT19 and johnleider authored Feb 4, 2025
1 parent 1461d7e commit fac2f99
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/vuetify/src/labs/VDateInput/VDateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ export const VDateInput = genericComponent<VDateInputSlots>()({
const { t } = useLocale()
const adapter = useDate()
const { isFocused, focus, blur } = useFocus(props)
const model = useProxiedModel(props, 'modelValue', props.multiple ? [] : null)
const model = useProxiedModel(
props,
'modelValue',
props.multiple ? [] : null,
val => Array.isArray(val) ? val.map(item => adapter.toJsDate(item)) : val ? adapter.toJsDate(val) : val,
val => Array.isArray(val) ? val.map(item => adapter.date(item)) : val ? adapter.date(val) : val
)

const menu = shallowRef(false)
const vDateInputRef = ref()

Expand Down Expand Up @@ -100,7 +107,7 @@ export const VDateInput = genericComponent<VDateInputSlots>()({

const target = e.target as HTMLInputElement

model.value = adapter.date(target.value)
model.value = target.value
}

function onClick (e: MouseEvent) {
Expand Down

0 comments on commit fac2f99

Please sign in to comment.