Skip to content

fix(VDatePicker): resolve firstDayOfWeek from locale #21260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Apr 14, 2025

Description

Follow-up to recently merged #21199 that introduced regression - locale changes should affect firstDayOfWeek, but since 0 is now recognized as valid prop value, all locales are locked at Sunday (possible to reproduce on "nightly" v3.8.1-master.2025-04-14)

Markup:

<template>
  <v-app style="background-color: rgba(var(--v-theme-on-surface), 0.2)">
    <v-container max-width="650">
      <div class="d-flex justify-center align-center ga-3">
        <span class="opacity-70">locale:</span>
        <v-chip-group v-model="currentLocale">
          <v-chip filter label text="en" value="en"></v-chip>
          <v-chip filter label text="pl" value="pl"></v-chip>
          <v-chip filter label text="fr" value="fr"></v-chip>
          <v-chip filter label text="pt" value="pt"></v-chip>
        </v-chip-group>
      </div>
      <div class="d-flex justify-center align-center ga-3">
        <span class="opacity-70">startOfWeek:</span>
        <v-chip-group v-model="startOfWeek">
          <v-chip
            v-for="o in startOfWeekOptions"
            v-bind="o"
            :key="o.value"
            filter
            label
          ></v-chip>
        </v-chip-group>
      </div>
      <v-alert v-if="startOfWeek === undefined" class="my-3" type="warning" text="First day of week is expected to respond to locale changes" />
      <v-alert v-else class="my-3" type="info" text="First day of week is expected to be locked with selection above" />
      <div class="d-flex justify-center">
        <v-locale-provider :locale="currentLocale">
          <v-date-picker :first-day-of-week="startOfWeek" hide-header />
        </v-locale-provider>
      </div>
    </v-container>
  </v-app>
</template>

<script setup>
  import { ref } from 'vue'

  const currentLocale = ref('en')
  const startOfWeek = ref(undefined)
  const startOfWeekOptions = 'Sun|Mon|Tue|Wed|Thu|Fri|Sat'
    .split('|')
    .map((x, i) => ({ text: x, value: i }))
</script>

@J-Sek J-Sek added T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke C: VDatePicker labels Apr 14, 2025
@J-Sek J-Sek self-assigned this Apr 14, 2025
@J-Sek J-Sek added the i18n Internationalization issue label Apr 14, 2025
@J-Sek J-Sek requested a review from johnleider April 14, 2025 17:34
@johnleider johnleider added this to the v3.8.x milestone Apr 14, 2025
@johnleider johnleider merged commit 1c1d6b0 into vuetifyjs:master Apr 14, 2025
10 checks passed
@J-Sek J-Sek deleted the fix/vdatepicker-week-i18n branch April 14, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDatePicker i18n Internationalization issue T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants