Shiny: dateInput Request. Restrict to specific dates within min and max

Created on 12 Jun 2013  ·  20Comments  ·  Source: rstudio/shiny

I would like to have, say, only the Fridays clickable. So if one of the parameters could be a vector of allowable dates that would be v useful

Most helpful comment

I am also very interested in this feature. I'd like to prepopulate the datepicker with only the dates that have data to plot.

All 20 comments

I never got any replies to this or #173. Is this the right place to raise enhancement requests?

Hi. This is a great spot for that. We're pretty swamped with trying to get Shiny Server Pro out the door right now, so we're a bit slow on processing feature requests in Shiny. This is the right spot to put these kinds of requests, though. We'll begin prioritizing and whittling away at some of these new features over the coming months.

Thanks Jeff. It is no big deal but definitely a feature I would be using in apps currently, if available

Just a 6 month repeat request for this and #173
Cheers

173 should be easy to solve, but #174 does not seem to be possible, since the datepicker library does not support it (it is only possible to disable certain days of a week): https://github.com/eternicode/bootstrap-datepicker You may file a feature request over there.

Thanks for that. Just took a v brief look at the documentation and it seems like they have a setDates method. http://bootstrap-datepicker.readthedocs.org/en/latest/methods.html
My original request (see above) was for only one day per week so the ability to disable all other days would satisfy that. Obviously if setDates gives additional flexibility that would be even better. An example would be only showing days in a year on which a team played a baseball game

Why is this closed?

The bootstrap-datepicker developer had this to say

"As they said, it's possible to disable certain days of the week (with daysOfWeekDisabled), so they could certainly add a feature that lets you disable every day except Friday.

Enabling specific dates is also possible, though in a roundabout way, using beforeShowDay and checking each date against a list of dates to enable. #515 will make the inverse scenario (disabling specific dates) more straightforward, but it will probably need a counterpart."

FYI, this issue hasn't been closed. It's the other one (in which you referenced this issue) that's closed.

OK. Thanks. No wonder I couldn't open it again!

But only slightly ajar? I would find this immensely useful. Kinda surprised if others wouldn't as well

Almost annual update :)

This would be a great feature. Items like quarter/month end options would be very useful as well

Two years on! I have another app where setting allowable dates to a vector of dates would be extremely useful

Pull requests welcome! :)

I needed this for a project, so added a way to pass this option into the bootstrap datepicker. A more thought-out solution would be to allow passing arbitrary bootstrap datepicker options.

Unfortunately the datepicker version used in Shiny appears to be somewhat outdated, and does not support passing in arbitrary datesDisabled (https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#datesdisabled).

Please let me know if this is an acceptable solution and I'll add a pull request. Caveats so far:

  • Not applied to dateRangeInput (should this affect both datepickers? What if I want to disable different days in start/end picker?)

@kadrach I do believe shiny recently upgraded to datepicker 1.6.4, is that good enough to support this feautre? I'm sure that if you submit a PR, someone on the shiny team will take a look.

@jcheng5 or @wch - should @kadrach submit PR for this? (I'm nudging because I also ran into this issue...)

I am also very interested in this feature. I'd like to prepopulate the datepicker with only the dates that have data to plot.

Any update on this issue? I´m interested in using this functionality. Thanks

@daattali @kadrach Either of you feel free to submit a PR. We will need a CLA from @kadrach before we can merge though (once the PR comes in we can send the paperwork). Thanks and sorry for the lack of responsiveness.

Sounds like @kadrach already implemented some extra options. @kadrach could you see if the current shiny datepicker version supports your fix?

In order to add all the arbitrary options that the JS library provides, a design decision needs to be made, ideally from the Shiny team, regarding how the new dateInput() signature should look like:

  1. Have a ... argument, or
  2. Use a options = list() argument (similar to selectizeInput() or DT::datatable()), or
  3. Explicitly list all the supported arguments
Was this page helpful?
0 / 5 - 0 ratings