dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
831 stars 153 forks source link

airDatePicker selecting dates works incorrectly in Docker container #697

Closed Mkranj closed 1 month ago

Mkranj commented 4 months ago

So, this is a weird issue I noticed. Here is a small app.R example:

library(shiny)
library(shinyWidgets)

print("shinyWidgets version:")
print(packageVersion("shinyWidgets"))

ui <- fluidPage(
  h1("TESTING - airdatepicker"),
  airDatepickerInput("date_menu",
                     label = "Choose date range",
                     value = c(as.Date("2024-06-03"), Sys.Date()),
                     dateFormat = "dd. MM. yyyy.",
                     addon = "none",
                     minDate = "2023-07-08",
                     maxDate = Sys.Date(),
                     range = T,
                     language = "hr"
    ),
  textOutput("results")
  )

server <- function(input, output, session) {
  output$results <- renderText({
    paste0("The range spans from ",
           input$date_menu[1],
           " to ",
           input$date_menu[2])
  })
}

shinyApp(ui, server)

I can run this app on my computer, and I want to change the first day in timespan to be 01.03.2024. instead of 03.06.2024. I just click on 03.06, click left to March and click on the 1st day. It all works as expected.

However, when I run my app in a Docker container, this doesn't work! The selection stays the same, even if I clicked all the way through to March. This is very unintuitive to use, and I can't seem to find what the issue is, any help would be greatly appreciated.

Sample Dockerfile:

FROM rocker/r-ver:4.3.3

RUN apt-get update && apt-get install -y dialog apt-utils
RUN apt-get upgrade -y

RUN R -q -e "install.packages(c('shiny', 'shinyWidgets'))"
COPY app.R app.R

EXPOSE 3838

ENTRYPOINT ["R", "-q", "-e", "shiny::runApp(appDir = './', port = 3838, host = '0.0.0.0')"]

Building the image with docker build -t mkranj/airdatepicker --no-cache ..
Running the container with docker run -p 1234:3838 -it mkranj/airdatepicker:latest and going to http://localhost:1234/ in my browser.

ZIBOWANGKANGYU commented 3 months ago

I am experiencing similar problems on Docker only. On local machine it's fine.

pvictor commented 2 months ago

Hi, It appears to be a bug in the JavaScript library "air-datepicker", affecting at least the last 2 versions of the package on CRAN. Try installing from GitHub, it should fix the issue, I will make a new release on CRAN by the end of the month.

Victor

Mkranj commented 1 month ago

This is fixed with the v0.8.7 version of the package :) Thank you!