ipyvuetify icon indicating copy to clipboard operation
ipyvuetify copied to clipboard

ipyvuetify DatePicker and allowedDates

Open tjayer opened this issue 3 years ago • 1 comments

I m struggling with the datePicker widget, I have a list of dates in python and I would like to display the widget with only theses dates, but how I m supposed to provide that array with ipyvuetify ?

This work fine, but it only hides odd days.

class DatesPicker(v.VuetifyTemplate):

date = traitlets.Unicode(default_value= '2020-01-01').tag(sync=True)
#allowedDatesArray = traitlets.List(default_value= ["2020-01-01","2020-01-02", "2020-01-05","2020-01-06"]).tag(sync=True)

traitlets.default('template')
def _template(self):
    '''<template>
<v-row justify="center">
<v-date-picker
  v-model="date"
  :allowed-dates="allowedDates"
  class="mt-4"
  min="2016-06-15"
  max="2020-01-15"
></v-date-picker>
</v-row>
</template>

<script >
export default {
data: () => ({
}),

methods: {
  allowedDates: val => parseInt(val.split('-')[2], 10) % 2 === 0,
},
}
</script>

''' So how can I pass "allowedDatesArray" to methods, or is there an other way to deal with allowedDates based on an array ? (With trailets only ?)

tjayer avatar Apr 24 '22 18:04 tjayer

UP! How can I link python's list of allowed-dates ?

tjayer avatar May 01 '22 19:05 tjayer