When using updateAirDateInput to update disabledDates for multiple times, new updates do not fully overwrite old updates. Instead, if a date has been disabled by an old call to updateAirDateInput, it will stay disabled even if it is not included in the disabledDates in a new call to updateAirDateInput.
Repex:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
airDatepickerInput("date_input", "Pick a date"),
actionButton("disable_date", "Disable date")
)
# Define server logic required to draw a histogram
server <- function(input, output, session) {
click_count <- reactiveVal(0)
observeEvent(input$disable_date, {
updateAirDateInput(inputId = "date_input", options = list(
disabledDates = (Sys.Date() + click_count()) # After each time clicking "disable_date", only one date should be disabled. The previously disabled date should be enabled again. But this is not the case. Previously disabled dates remain enabled.
))
click_count(click_count() + 1)
})
}
# Run the application
shinyApp(ui = ui, server = server)
When using
updateAirDateInput
to updatedisabledDates
for multiple times, new updates do not fully overwrite old updates. Instead, if a date has been disabled by an old call toupdateAirDateInput
, it will stay disabled even if it is not included in thedisabledDates
in a new call toupdateAirDateInput
.Repex: