Skip to content

Commit f628ec6

Browse files
committed
show scheduled time with local TZ
1 parent 5797572 commit f628ec6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

apps/countdown/server.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ server <- function(input, output) {
1313
## as there's no external dependency triggering changes here (e.g. an input change)
1414
## that would automatically update this object to reactive
1515
invalidateLater(250)
16-
as.character(round(as.period(schedule - Sys.time())))
16+
color <- ifelse(schedule > Sys.time(), 'black', 'red')
17+
as.character(span(
18+
round(as.period(abs(schedule - Sys.time()))),
19+
style = paste('color', color, sep = ':')))
20+
})
21+
output$start <- renderText({
22+
paste('at', schedule, Sys.timezone())
1723
})
1824
}

apps/countdown/ui.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ ui <- basicPage(
1111
div(
1212
h1(uiOutput('title')),
1313
h2(uiOutput('subtitle')),
14+
h3('starts in'),
1415
h1(uiOutput('countdown')),
16+
h4(uiOutput('start')),
1517
class = 'center')
1618

1719
)

0 commit comments

Comments
 (0)