Skip to content

Commit

Permalink
fix(VCalendar): always assign default first day of week (#20378)
Browse files Browse the repository at this point in the history
fixes #19999
  • Loading branch information
wyhsunflower authored Jan 24, 2025
1 parent d1ed47c commit 9d881b2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/vuetify/src/composables/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ export function useCalendar (props: CalendarProps) {
v => adapter.getMonth(v)
)

const defaultFirstDayOfWeek = computed(() => {
return props.firstDayOfWeek ?? props.weekdays[0]
})

const weekDays = computed(() => {
const firstDayOfWeek = Number(props.firstDayOfWeek ?? 0)

return props.weekdays.map(day => (day + firstDayOfWeek) % 7)
})

const weeksInMonth = computed(() => {
const weeks = adapter.getWeekArray(month.value, props.firstDayOfWeek)
const weeks = adapter.getWeekArray(month.value, defaultFirstDayOfWeek.value)

const days = weeks.flat()

Expand Down

0 comments on commit 9d881b2

Please sign in to comment.