Using dates with ion.RangeSlider sliderInput in Shiny
How can we use dates from sliderInput
in Shiny?
I know it was tricky with Bootstrap 2.0, but now that Shiny uses the ionic slider, there is hope:
According to the documentation ,
Slider supports date and time
At the moment something like
sliderInput("date",label="date",
min=as.Date("1934-06-29"), max=as.Date("1940-03-04"))
- still a dream.
I found some Javascript that seems appropriate, but I'm not sure if to implement this in the UI. Anyone who knows Javascript hasn't included it in any Shiny apps yet?
$("#range_39").ionRangeSlider({
min: +moment().subtract(1, "years").format("X"),
max: +moment().format("X"),
from: +moment().subtract(6, "months").format("X"),
prettify: function (num) {
return moment(num, "X").format("LL");
}
});
Thanks for reading this.
source to share
It looks like Winston just recently added support for dates to the range, but it hasn't been included in glitter yet.
https://github.com/rstudio/shiny/pull/885
Most likely it will be completed soon
source to share