Learn R Programming

⚠️There's a newer version (0.2.0) of this package.Take me there.

daterangepicker

Custom Shiny input binding for a Date Range Picker.

Installation

# install.packages("remotes")
remotes::install_github("trafficones/daterangepicker")

Example

A basic example of a Date Range Picker:

library(shiny)
library(daterangepicker)

## UI ##########################
ui <- fluidPage(
  daterangepicker(
    inputId = "daterange",
    label = "Pick a Date",
    start = Sys.Date() - 30, end = Sys.Date(),
    style = "width:100%; border-radius:4px",
    icon = icon("calendar")
  ),
  verbatimTextOutput("print"),
  actionButton("act", "Update Daterangepicker"),
)

## SERVER ##########################
server <- function(input, output, session) {
  output$print <- renderPrint({
    req(input$daterange)
    input$daterange
  })
  observeEvent(input$act, {
    updateDaterangepicker(session, "daterange",
                          start = Sys.Date(), 
                          end = Sys.Date() - 100)
  })
}

shinyApp(ui, server)

Further examples are in /inst/examples/

Further Information

Check out the Configuration Generator for a Live-Demo of the different options.

Copy Link

Version

Install

install.packages('daterangepicker')

Monthly Downloads

381

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Sebastian Gatscha

Last Published

March 20th, 2020

Functions in daterangepicker (0.1.0)

daterangepicker

daterangepicker
checkMaxSpan

checkMaxSpan Check the maxSpan element, for Time objects
daterangepickerOptions

daterangepickerOptions
checkRanges

checkRanges Check the ranges element, for Date objects
filterEMPTY

filterEMPTY Filter empty elements of a list
makeLabel

makeLabel Make the label
updateDaterangepicker

updateDaterangepicker
makeInput

makeInput Make the input div-tag