Skip to content

Instantly share code, notes, and snippets.

@hrafnkelle
Created February 8, 2015 20:23
Show Gist options
  • Save hrafnkelle/d5915f1415ca2663068f to your computer and use it in GitHub Desktop.
Save hrafnkelle/d5915f1415ca2663068f to your computer and use it in GitHub Desktop.
Demonstate how lubridate fails to parse a date that depends on locale on shinyapps.io which only has the C locale
library(shiny)
library(lubridate)
dateStr1="2015/02/08"
dateStr2="2015 Feb 8"
# Uncomment to make it work on windows if not on english locale
# Perhaps each shinyapps.io app should have a locale configuration?
# Sys.setlocale("LC_TIME","English")
ui<-shinyUI(fluidPage(
titlePanel("Lubridate parse"),
flowLayout(
p("The first date string parses while the second doesn't. It depends on locale and I cant set the locale to english (e.g. en_US) on shinyapps.io"),
p(paste(dateStr1,ymd(dateStr1))),
p(paste(dateStr2,ymd(dateStr2)))
)
))
server<-shinyServer(function(input, output) {
})
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment