In Shiny, when I try to update any airDatePickerInput
using the updateAirDateInput
function, the date updates incorrectly.
If I tell updateAirDateInput
to set the date as "2020-02-01"
, it will set the date to "2020-01-01"
, 1 day less than I want. Why??
Is this a bug? Do I have to increment the day I want + 1?
Here is an example which shows what I am talking about, press the button to set the date to "1999-01-01"
and the app will incorrectly set the date to the last day of 1998
library(shiny)
library(shinyWidgets)
shinyApp(
ui = fluidPage(
fluidRow(
column(
width = 12,
htmlOutput("someDate", inline = TRUE)
)
),
fluidRow(
column(
width = 12,
actionButton("b1", "Update Date")
)
)
),
server = function(input, output, session) {
#data$date <- format(as.Date(data$date, origin="1970-01-01"), "%m/%d/%Y")
output$someDate <- renderUI({
airDatepickerInput(
"someDate",
label = "Date",
value = NULL,
multiple = FALSE,
range = FALSE,
timepicker = FALSE,
separator = " - ",
placeholder = NULL,
dateFormat = "yyyy-mm-dd",
minDate = NULL,
maxDate = NULL,
disabledDates = NULL,
view = c("days", "months", "years"),
minView = c("days", "months", "years"),
monthsField = c("monthsShort", "months"),
clearButton = FALSE,
todayButton = FALSE,
autoClose = FALSE,
timepickerOpts = timepickerOptions(),
position = NULL,
update_on = c("change", "close"),
addon = c("right", "left", "none"),
language = "en",
inline = FALSE,
width = NULL
)
})
observeEvent(input$b1, {
updateAirDateInput(session, "someDate", value = as.character("1999-01-01"))
})
}
)