Skip to content

Commit

Permalink
fix(VDatePicker): change calendar when date is changed (#19570)
Browse files Browse the repository at this point in the history
fixes #19421

Co-authored-by: John Leider <john@vuetifyjs.com>
  • Loading branch information
SonTT19 and johnleider committed Apr 22, 2024
1 parent 5918658 commit a1b47bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/vuetify/src/components/VDatePicker/VDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ export const VDatePicker = genericComponent<new <
watch(model, (val, oldVal) => {
const before = adapter.date(wrapInArray(val)[0])
const after = adapter.date(wrapInArray(oldVal)[0])
const newMonth = adapter.getMonth(before)
const newYear = adapter.getYear(before)

if (newMonth !== month.value) {
month.value = newMonth
onUpdateMonth(month.value)
}

if (newYear !== year.value) {
year.value = newYear
onUpdateYear(year.value)
}

isReversing.value = adapter.isBefore(before, after)
})
Expand Down

0 comments on commit a1b47bb

Please sign in to comment.