rdockershinydatepicker

R Shiny in Docker - airDatePicker selecting dates works incorrectly


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

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.

Does anyone have an idea why this happens only when dockerizing the app?


Solution

  • The issue was due to behavior of the specific version of Airdatepicker.
    The maintainers have since updated the package with a new version, so this issue shouldn't arise anymore when using shinyWidgets >= v0.8.7 .