I have recently built an app and loaded it to shinyapps io. There I can see my app with all its tabs, tables and functions. In my app I have a table in each tab.
With each table the user can select a range for the dates of what is to be shown in the table however when the app is first loaded it should automatically show the range of the most recent date in the table - 7 days. Locally on my computer it does exactly that but when I loaded it to shiny apps io the most recent date shown in dateRangeInput is 2020-10-05. It seems somehow to be stuck on that date and I have no Idea why.
I can't seem to find a solution for this. Here is my code:
#ui.r
tabItem(tabName = "overview",
fluidRow(
dateRangeInput("date1",
label = 'Date range input',
start = range(tib1$Day)[2] - 7, end = range(tib1$Day)[2],
min = range(tib1$Day)[1],max = range(tib1$Day)[2]
)
),
box( title = "Overview Table", status = "warning", height = 700, width = "12", solidHeader = TRUE,
column( width = 12,
DT::dataTableOutput("overviewtable"),style = "height:600px; overflow-y: scroll;overflow-x: scroll;"
)
)
),
#server.r
overviewdata<- reactive({
filter(tib1, between(Day, input$date1[1], input$date1[2]))
})
#Table for overview
output$overviewtable<- DT::renderDataTable({
DT::datatable(data =overviewdata(),
extensions = 'Buttons',
options = list(
lengthMenu = list(c(10, 25, 50,100,-1), c("10", "25", "50","100","All")),
dom = "Blfrtip",
buttons =
list("copy", list(
extend = "collection",
buttons = c("csv","excel","pdf"),
text ="Download"
))#End of button customization
))
})
The variable Day from the data frame tib1 is of the class "Date" "oldClass".
I have a feeling the server is having troubles with function range()
.