-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(VDatePicker): add missing allowed-dates support
fixes #17983
- Loading branch information
1 parent
408aba9
commit 46d68d4
Showing
6 changed files
with
77 additions
and
22 deletions.
There are no files selected for viewing
34 changes: 24 additions & 10 deletions
34
packages/docs/src/examples/v-date-picker/prop-allowed-dates.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,43 @@ | ||
<template> | ||
<v-row justify="center"> | ||
<v-date-picker | ||
v-model="date" | ||
:allowed-dates="allowedDates" | ||
class="mt-4" | ||
min="2016-06-15" | ||
max="2018-03-20" | ||
></v-date-picker> | ||
</v-row> | ||
<v-container> | ||
<v-row justify="space-around"> | ||
<v-date-picker | ||
v-model="date" | ||
:allowed-dates="allowedDates" | ||
min="2016-06-15" | ||
max="2018-03-20" | ||
></v-date-picker> | ||
</v-row> | ||
</v-container> | ||
</template> | ||
|
||
<script setup> | ||
import { useDate } from 'vuetify/labs/date' | ||
import { ref } from 'vue' | ||
const adapter = useDate() | ||
const date = ref('2018-03-02') | ||
function allowedDates (val) { | ||
return parseInt(adapter.toISO(val).split('-')[2], 10) % 2 === 0 | ||
} | ||
</script> | ||
|
||
<script> | ||
import { useDate } from 'vuetify/labs/date' | ||
const adapter = useDate() | ||
export default { | ||
data: () => ({ | ||
date: '2018-03-02', | ||
}), | ||
methods: { | ||
allowedDates: val => parseInt(val.split('-')[2], 10) % 2 === 0, | ||
allowedDates: val => { | ||
return parseInt(adapter.toISO(val).split('-')[2], 10) % 2 === 0 | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters