widgetti / widgetti/ipyvuetify

ipyvuetify DatePicker and allowedDates

Open
#218 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
355
Forks
61
PR merge metrics
No merged PRs in 30d

Description

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 ?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DatesPicker example in the issue, including the allowedDatesArray traitlet, the VuetifyTemplate _template, and the allowedDates method. Check how values synchronized from Python can be accessed by the template method. Done means the date picker accepts the Python date list and permits only those dates.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.