datetimeSliderPickerInput {shinyDatetimePickers} | R Documentation |
Datetime picker with sliders
Description
A datetime picker for a Shiny UI.
Usage
datetimeSliderPickerInput(inputId, value = NULL, second = FALSE, save = FALSE)
Arguments
inputId |
the input slot that will be used to access the value |
value |
initial value, either a |
second |
logical, whether to enable the second picker |
save |
logical, whether to enable the 'save' button |
Value
A shiny.tag
object that can be included in a Shiny UI.
Examples
if(interactive()){
library(shinyDatetimePickers)
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("setdt", label = as.character(Sys.time()),
class = "btn-info")
),
mainPanel()
)
)
server <- function(input, output, session){
datetime <- reactiveVal(Sys.time())
observeEvent(input[["setdt"]], {
showModal(modalDialog(
datetimeSliderPickerInput("dtspicker", save = TRUE, value = datetime())
))
})
observeEvent(input[["dtspicker_save"]], {
datetime(input[["dtspicker"]])
removeModal()
updateActionButton(session, "setdt",
label = as.character(input[["dtspicker"]]))
})
}
shinyApp(ui, server)
}
[Package shinyDatetimePickers version 1.2.0 Index]