updateTimeInput: Change a time input on the client

Description Usage Arguments See Also Examples

View source: R/input-time.R

Description

Change the label and/or value of a time input

Usage

1
updateTimeInput(session, inputId, label = NULL, value = NULL)

Arguments

session

The session object passed to function given to shinyServer.

inputId

The id of the input object.

label

The label to set for the input object.

value

The desired time value. Must be a instance of DateTimeClasses.

See Also

Other shinyTime functions: shinyTimeExample, timeInput

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
  timeInput("time", "Time:"),
  actionButton("to_current_time", "Current time")
)

server <- function(input, output, session) {
  observeEvent(input$to_current_time, {
    updateTimeInput(session, "time", value = Sys.time())
  })
}

shinyApp(ui, server)
}

shinyTime documentation built on Aug. 6, 2019, 5:08 p.m.