Title: | Some Datetime Pickers for 'Shiny' |
---|---|
Description: | Provides three types of datetime pickers for usage in a 'Shiny' UI. A datetime picker is an input field for selecting both a date and a time. |
Authors: | Stéphane Laurent [aut, cre], Wojciech Maj [cph] ('react-datetime-picker' library (https://github.com/wojtekmaj/react-datetime-picker)), Porinn [cph] ('react-datetime-slider-picker' library (https://github.com/Porinn/react-datetime-slider-picker)), Dmitriy Kovalenko [cph] ('material-ui-pickers' library (https://github.com/mui-org/material-ui-pickers)) |
Maintainer: | Stéphane Laurent <[email protected]> |
License: | GPL-3 |
Version: | 1.2.0 |
Built: | 2024-11-02 03:43:07 UTC |
Source: | https://github.com/stla/shinydatetimepickers |
A datetime picker for a Shiny UI.
datetimeMaterialPickerInput( inputId, label = NULL, value = NULL, disablePast = FALSE, disableFuture = FALSE, style = NULL )
datetimeMaterialPickerInput( inputId, label = NULL, value = NULL, disablePast = FALSE, disableFuture = FALSE, style = NULL )
inputId |
the input slot that will be used to access the value |
label |
a label, a character string (HTML is not allowed), or
|
value |
initial value, either a |
disablePast |
logical, whether to disable past dates |
disableFuture |
logical, whether to disable future dates |
style |
inline CSS for the container |
A shiny.tag
object that can be included in a Shiny UI.
if(interactive()){ library(shinyDatetimePickers) library(shiny) ui <- fluidPage( br(), sidebarLayout( sidebarPanel( datetimeMaterialPickerInput( "dtmpicker", label = "Appointment", disablePast = TRUE ) ), mainPanel( verbatimTextOutput("dtmpicker") ) ) ) server <- function(input, output){ output[["dtmpicker"]] <- renderPrint({ input[["dtmpicker"]] }) } shinyApp(ui, server) }
if(interactive()){ library(shinyDatetimePickers) library(shiny) ui <- fluidPage( br(), sidebarLayout( sidebarPanel( datetimeMaterialPickerInput( "dtmpicker", label = "Appointment", disablePast = TRUE ) ), mainPanel( verbatimTextOutput("dtmpicker") ) ) ) server <- function(input, output){ output[["dtmpicker"]] <- renderPrint({ input[["dtmpicker"]] }) } shinyApp(ui, server) }
A datetime picker for a Shiny UI.
datetimePickerInput(inputId, value = NULL, style = NULL)
datetimePickerInput(inputId, value = NULL, style = NULL)
inputId |
the input slot that will be used to access the value |
value |
initial value, either a |
style |
inline CSS for the container |
A shiny.tag
object that can be included in a Shiny UI.
if(interactive()){ library(shinyDatetimePickers) library(shiny) ui <- fluidPage( br(), sidebarLayout( sidebarPanel( tags$fieldset( tags$legend("Click to change time"), datetimePickerInput( "dtpicker", style = "font-family: Montserrat, 'Segoe UI', Tahoma, sans-serif;" ) ) ), mainPanel( verbatimTextOutput("dtpicker") ) ) ) server <- function(input, output){ output[["dtpicker"]] <- renderPrint({ input[["dtpicker"]] }) } shinyApp(ui, server) }
if(interactive()){ library(shinyDatetimePickers) library(shiny) ui <- fluidPage( br(), sidebarLayout( sidebarPanel( tags$fieldset( tags$legend("Click to change time"), datetimePickerInput( "dtpicker", style = "font-family: Montserrat, 'Segoe UI', Tahoma, sans-serif;" ) ) ), mainPanel( verbatimTextOutput("dtpicker") ) ) ) server <- function(input, output){ output[["dtpicker"]] <- renderPrint({ input[["dtpicker"]] }) } shinyApp(ui, server) }
A datetime picker for a Shiny UI.
datetimeSliderPickerInput(inputId, value = NULL, second = FALSE, save = FALSE)
datetimeSliderPickerInput(inputId, value = NULL, second = FALSE, save = FALSE)
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 |
A shiny.tag
object that can be included in a Shiny UI.
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) }
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) }
Change the value of a datetime material picker input.
updateDatetimeMaterialPickerInput(session, inputId, value)
updateDatetimeMaterialPickerInput(session, inputId, value)
session |
the Shiny |
inputId |
the id of the datetime material picker widget to be updated |
value |
new value for the datetime material picker widget |
No returned value, this just updates the widget.
Change the value of a datetime picker input.
updateDatetimePickerInput(session, inputId, value)
updateDatetimePickerInput(session, inputId, value)
session |
the Shiny |
inputId |
the id of the datetime picker widget to be updated |
value |
new value for the datetime picker widget |
No returned value, this just updates the widget.
Change the value of a datetime slider picker input.
updateDatetimeSliderPickerInput(session, inputId, value)
updateDatetimeSliderPickerInput(session, inputId, value)
session |
the Shiny |
inputId |
the id of the datetime slider picker widget to be updated |
value |
new value for the datetime slider picker widget |
No returned value, this just updates the widget.