Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stibu81 opened this issue Mar 30, 2024 · 2 comments
Closed

Comments

@stibu81
Copy link

stibu81 commented Mar 30, 2024

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.

@stibu81 stibu81 changed the title updateAirDateInput() does not update seleceted date if options is used updateAirDateInput() does not update seleceted date if options is used Mar 30, 2024
@stibu81 stibu81 changed the title updateAirDateInput() does not update seleceted date if options is used updateAirDateInput() does not update selected date if options is used Mar 31, 2024
@pvictor
Copy link
Member

pvictor commented Apr 1, 2024

Thanks for reporting this, should be fixed if you re-install from GitHub

Victor

@stibu81
Copy link
Author

stibu81 commented Apr 1, 2024

Thanks for the fix. I can confirm that it now works as expected.

@stibu81 stibu81 closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants