Skip to content

Commit

Permalink
fix(VDatePicker): don't update month/year if new model is empty
Browse files Browse the repository at this point in the history
fixes #20015
  • Loading branch information
johnleider committed Jun 17, 2024
1 parent 35e2ea2 commit 154e751
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/vuetify/src/components/VDatePicker/VDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,13 @@ export const VDatePicker = genericComponent<new <
}

watch(model, (val, oldVal) => {
const before = adapter.date(wrapInArray(oldVal)[oldVal.length - 1])
const after = adapter.date(wrapInArray(val)[val.length - 1])
const arrBefore = wrapInArray(oldVal)
const arrAfter = wrapInArray(val)

if (!arrAfter.length) return

const before = adapter.date(arrBefore[arrBefore.length - 1])
const after = adapter.date(arrAfter[arrAfter.length - 1])
const newMonth = adapter.getMonth(after)
const newYear = adapter.getYear(after)

Expand Down

0 comments on commit 154e751

Please sign in to comment.