mithril-datepicker icon indicating copy to clipboard operation
mithril-datepicker copied to clipboard

API for disabling past dates and intervals user can select

Open cmnstmntmn opened this issue 8 years ago • 2 comments

there would be nice to restrict the user input by

  • restricting past dates
  • allowing time intervals
m(DatePicker, {
       data: ...,
       allowPastDates: true, // defaults to now
       interval: {
          start: "08/07/17", // defaults to now
          end:  "12/12/17"
       }
       onchange: ...
})

cmnstmntmn avatar Aug 07 '17 08:08 cmnstmntmn

@cmnstmntmn Thanks! What if I just exposed a "range" prop, with optional start/end? That way, disabling the past would be :

m(DatePicker, {
  range: {
    start: "now"
  }
})

Using now for either start or end would disable either the past or the future. Otherwise, passing a date object to either one would disable the appropriate side of the timeline.

Thoughts?

CreaturesInUnitards avatar Aug 08 '17 16:08 CreaturesInUnitards

indeed, it's way easier this way

cmnstmntmn avatar Aug 08 '17 18:08 cmnstmntmn