Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

327
Visualizações
R shiny: one day difference between date selected on widget and returned date

The date returned by shinyMobile's f7DatePicker widget is one day before the actual date selected by the user.

I am based in France and everything works fine locally. The issue arises when deploying my app to shinyapps.io. Screenshots and a MRE below. Deployed MRE here.

server.R

library(shinyMobile)
# tried adding Sys.setenv(TZ='UTC'), to no avail

function(input, output, session) {
  output$date_output = renderUI(HTML(paste(input$date_input)))
}

ui.R

library(shinyMobile)

f7Page(
  f7DatePicker(
    'date_input',
    'Date entered by user:',
    value = NULL,
    maxDate = Sys.Date(), # tried setting to NULL, to no avail
    dateFormat = 'yyyy-mm-dd' # tried changing to 'mm-dd-yyyy' per https://stackoverflow.com/questions/7556591/is-the-javascript-date-object-always-one-day-off/31732581#31732581, to no avail
  ),
  div(style='padding-left:20px;',
    h5('Date recorded by the system:'),
    uiOutput('date_output')
  )
)

= = = = Local (no problem): = = = =

image

= = = = Remote (one day discrepancy!): = = = =

image

PS. I tried with Shiny's default dateInput and shinyWidgets' airDatePicker. None of them suffer from the issue, but unfortunately, they do not seem to be compatible with shinyMobile in terms of UI.

PPS. I think the solution might lie in this SO answer. Seems to be an issue related to different standards that javascript uses in different situations, and conversion to UTC (or not). If this is indeed the cause of the issue, that would require editing the js part of the R Shiny widget I guess, but I am not literate in javascript...

I would be grateful for any help or tip. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

A fix to this issue was provided by the author of the shinyMobile package, David Granjon, via this commit. Many thanks to him!

And here is the link to the GitHub thread: https://github.com/RinteRface/shinyMobile/issues/204#issuecomment-1079532866

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda