merlinoa/shinyFeedback

The “shinyFeedback” not works for “dateRangeInput” component

Closed this issue · 5 comments

I try to test "shinyFeedback" package for processing dates and can't run this test code.

The details is here
https://stackoverflow.com/questions/64513796/the-shinyfeedback-not-works-for-daterangeinput-component

Thanks!

I tested your example app and shinyFeedback seems to be working as designed. The warning feedback is displayed whenever the date range input is not NA.

Here is a slightly modified version of your app where the warning feedback is only displayed if the second date in the date range is in the future:

library(shiny)
library(shinyFeedback)

ui <- fluidPage(
  shinyFeedback::useShinyFeedback(),
  uiOutput("uo_numeric"),
  uiOutput("uo_date_range")
)

server <- function(input, output, session) {

  # Numeric
  output$uo_numeric <-  renderUI({
    numericInput("n", "Label", value = 10)
  })

  # Date range
  output$uo_date_range <- renderUI({
    dateRangeInput(
      "si_date_range", "Date range",
      start = as.Date(lubridate::now()),
      end = as.Date(lubridate::now()))
  })

  observeEvent(
    input$si_date_range, {
      print(!is.na(input$si_date_range))



      shinyFeedback::feedbackWarning(
        "si_date_range", input$si_date_range[2] > Sys.Date(),
        "No future dates allowed")
    }
  )

  observeEvent(
    input$n, shinyFeedback::feedbackWarning(
      "n", input$n %% 2 != 0, "Please select an even number")
  )

} # server

# Run the application
shinyApp(ui, server)

Thanks, @merlinoa !
It still not works on my Mac.
Even if I replaced "input$si_date_range[2] > Sys.Date()" on TRUE or FALSE - nothing happens on UI.
Maybe there are some hidden issues here
Thanks
Andrii

I used shiny 1.5.0 and shinyFeedback 0.1.0

Well that is the issue. You need to install the current CRAN:

install.packages("shinyFeedback")

or GitHub version:

remotes::install_github("merlinoa/shinyFeedback")

of shinyFeedback. The date range input is not supported in version 0.1.0.

I'm going to go ahead and close out this issue. Feel free to reopen if that does not solve the problem.

The package re-installing by using "remotes::install_github("merlinoa/shinyFeedback")" fixed problem.
Thanks a lot!