Skip to content

updateAirDateInput() does not update selected date if options is used #684

@stibu81

Description

@stibu81

This shiny app contains an airDatepickerInput and a button. If the button is clicked, the date should switch to today's date, but with shinyWidgets 0.8.3, the date does not change.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(

    titlePanel("airDatepickerInput Test"),

    sidebarLayout(
        sidebarPanel(
            airDatepickerInput("date",
                        value = as.Date("2024-01-01")),
            actionButton("today", "Today")
        ),
        mainPanel()
    )
)

server <- function(input, output, session) {
  observeEvent(
    input$today,
    updateAirDateInput(
      session,
      "date",
      value = Sys.Date(),
      options = list(maxDate = as.Date("2024-03-31"))
    )
  )
}

# Run the application
shinyApp(ui = ui, server = server)

Interestingly, the option is applied correctly: the maxDate is set as expected after the button has been clicked.

With shinyWidgets 0.8.2, this works as expected. Also, when the argument options is removed, the date is updated as expected even with version 0.8.3.

Im running this on Ubuntu 22.04.4 with R 4.3.3 and shiny 1.8.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions