Skip to content

Instantly share code, notes, and snippets.

@nbenn
Created February 11, 2023 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbenn/1ced85472ad65de055ed1206e71b8df9 to your computer and use it in GitHub Desktop.
Save nbenn/1ced85472ad65de055ed1206e71b8df9 to your computer and use it in GitHub Desktop.
Minimal shiny app for investigating TZ issues
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(lubridate)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Convert to Timezone"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
selectInput("timezone",
"Timezone:",
choices = OlsonNames(),
selected = "Europe/Zurich")
),
# Show a plot of the generated distribution
mainPanel(
textOutput("datetime")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$datetime <- renderText({
format(dmy_hm("9 Feb 2023 9:00pm", tz = input$timezone), usetz = TRUE)
})
}
# Run the application
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment