Skip to content

feat(VDatePicker): add disable custom class for disabled dates type #21303

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

khoanguyn1411
Copy link
Contributor

Description

Resolved #21285


Add two additional props to differentiate types of disabled dates:

  • notAllowedDatesClass: applies a class to dates that are not allowed.
  • outOfRangeDatesClass: applies a class to dates that are out of range.

Result:

image

Markup:

<template>
  <v-container>
    <v-row justify="space-around">
      <v-date-picker
        v-model="date"
        :allowed-dates="allowedDates"
        not-allowed-dates-class="not-allowed-dates-class"
        out-of-range-dates-class="out-of-range-dates-class"
        max="2018-03-20"
        min="2016-06-15"
      ></v-date-picker>
    </v-row>
  </v-container>
</template>

<script>
  export default {
    data: () => ({
      date: new Date('2018-03-02'),
    }),

    methods: {
      allowedDates: val => {
        return new Date(val).getDate() % 2 === 0
      },
    },
  }
</script>

<style lang="css">
.not-allowed-dates-class {
  background-color: aquamarine;
}

.out-of-range-dates-class {
  background-color: pink;
}
</style>

Verified

This commit was signed with the committer’s verified signature.
khoanguyn1411 Khoa Nguyen (Jan)
@MajesticPotatoe MajesticPotatoe added T: bug Functionality that does not work as intended/expected C: VDatePicker labels Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDatePicker T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants