Skip to content

Commit

Permalink
fix(VDatePicker): wrong month displayed in header (#19721)
Browse files Browse the repository at this point in the history
closes #19126
  • Loading branch information
vincentauger committed Apr 30, 2024
1 parent d461f19 commit b0d42c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/src/components/VDatePicker/VDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ export const VDatePicker = genericComponent<new <
const text = computed(() => {
let date = adapter.date()

date = adapter.setYear(date, year.value)
date = adapter.setMonth(date, month.value)
date = adapter.setDate(date, 1)
date = adapter.setMonth(date, month.value)
date = adapter.setYear(date, year.value)

return adapter.format(date, 'monthAndYear')
})
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/composables/date/adapters/vuetify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ function addWeeks (date: Date, amount: number) {

function addMonths (date: Date, amount: number) {
const d = new Date(date)
d.setDate(1)
d.setMonth(d.getMonth() + amount)
return d
}
Expand Down

0 comments on commit b0d42c9

Please sign in to comment.