From b0d42c9f2b1fe7795ca62bd12d64294bc2cf9518 Mon Sep 17 00:00:00 2001 From: Vincent Auger Date: Tue, 30 Apr 2024 15:46:25 -0300 Subject: [PATCH] fix(VDatePicker): wrong month displayed in header (#19721) closes #19126 --- packages/vuetify/src/components/VDatePicker/VDatePicker.tsx | 4 ++-- packages/vuetify/src/composables/date/adapters/vuetify.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/vuetify/src/components/VDatePicker/VDatePicker.tsx b/packages/vuetify/src/components/VDatePicker/VDatePicker.tsx index 35b8236b2af..e66f3b555bc 100644 --- a/packages/vuetify/src/components/VDatePicker/VDatePicker.tsx +++ b/packages/vuetify/src/components/VDatePicker/VDatePicker.tsx @@ -132,9 +132,9 @@ export const VDatePicker = genericComponent { 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') }) diff --git a/packages/vuetify/src/composables/date/adapters/vuetify.ts b/packages/vuetify/src/composables/date/adapters/vuetify.ts index 58ad04707d7..0066134a5e0 100644 --- a/packages/vuetify/src/composables/date/adapters/vuetify.ts +++ b/packages/vuetify/src/composables/date/adapters/vuetify.ts @@ -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 }