In Shiny for R, why does Sys.Date() return yesterday's date inside a dateInput? -
i have dateinput
in ui.r
follows:
dateinput("asofdatetime", label = "as of", value = sys.date(), max = sys.date())
for 2015-05-15
, gives dateinput
default value of 2015-05-14
.
however, when run sys.date()
in console on 2015-05-15
, correct value: 2015-05-15
.
why shiny give yesterday's date inside app?
that sound weird. starting on shiny not know sure.
could be
timezone?? maybe
sys.timezone()
different on servers?have tried formatting date timezone?
caching problem??
could value cached old instance? take running within shinyserver{ ... code} not above. try rebuild in dashboard?
but here solution
set value
null
(see helpfile)
value starting date. either date object, or string in yyyy-mm-dd format. if null (the default), use current date in client's time zone.
it default date in timezone.
dateinput("asofdatetime", label = "as of", value = null, max = sys.date())
gave me today's date
Comments
Post a Comment