I made a daterange
in the code below, however as you will notice the start and end dates are already preset. Therefore, I would like to leave for both, "No selected date", as no dates has yet been defined.
library(shiny)
library(shinythemes)
Test <- structure(
list(dat= c("2021-01-01","2021-01-02","2021-01-03"),
X= c(5,4,0)),
class = "data.frame", row.names = c(NA, -3L))
ui <- fluidPage(
shiny::navbarPage(theme = shinytheme("flatly"), collapsible = TRUE,
br(),
tabPanel("",
sidebarLayout(
sidebarPanel(
uiOutput("daterange"),
br()
),
mainPanel(
),
))
))
server <- function(input, output,session) {
data <- reactive(Test)
output$daterange <- renderUI({
dateRangeInput("daterange1", "Period:",
start = min(data()$dat),
end = max(data()$dat),
min = min(data()$dat),
max = max(data()$dat),
format = "dd-mm-yyyy")
})
}
shinyApp(ui = ui, server = server)