dreamRs / toastui

R htmlwidgets for ToastUI libraries: grid, calendar and chart
https://dreamrs.github.io/toastui
Other
82 stars 8 forks source link

Calendar - incorrect date range displayed when using navigation #20

Closed masanni closed 2 years ago

masanni commented 2 years ago

Hello, when trying to use navigation options with buttons in the following example where it is possible to switch between different calendar views, the date range displayed in the daily and weekly view is completely messed up. I cannot figure out why it happens and would appreciate any help.


ui <- fluidPage(
  tags$h2("Change calendar view"),
  radioButtons(
    inputId = "view",
    label = "Change view:",
    choices = c("day", "week", "month"),
    inline = TRUE
  ),
  calendarOutput(outputId = "my_calendar")
)

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

  output$my_calendar <- renderCalendar({
    calendar(view = "day", scheduleView = "allday", navigation = TRUE) %>%
      cal_schedules(
        title = "Today planning",
        start = Sys.Date(),
        end = Sys.Date(),
        category = "allday"
      )
  })

  observeEvent(
    input$view,
    cal_proxy_view("my_calendar", input$view),
    ignoreInit = TRUE
  )

}

if (interactive())
  shinyApp(ui, server)

week_view

pvictor commented 2 years ago

Thanks for reporting. That's fixed if you re-install from GitHub.

Victor

masanni commented 2 years ago

Perfect! Thank you Victor for fixing it so quickly.