Open greenjune-ship-it opened 2 years ago
The format_iso8601
function is parsing incoming times that look like 2022-09-21T12:39:45Z
.
For example, here is the most recent record from one of our development Connect servers:
client <- connectwidgets::connect()
raw <- client$content()
head(raw$created_time, 1)
#=> [1] "2022-09-21T12:39:45Z"
head(strptime(raw$created_time, "%Y-%m-%dT%H:%M:%SZ", tz = "UTC"), 1)
#=> [1] "2022-09-21 12:39:45 UTC"
head(as.POSIXct(strptime(raw$created_time, "%Y-%m-%dT%H:%M:%SZ", tz = "UTC")), 1)
#=> [1] "2022-09-21 12:39:45 UTC"
Could you include the output from sessionInfo()
as well as telling us if you see different data from your server?
Hi @aronatkins
Sure, this is my sessionInfo()
:
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /usr/prog/FlexiBLAS/3.0.4-GCC-11.2.0/lib64/libflexiblas.so.3.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] connectwidgets_0.1.1
loaded via a namespace (and not attached):
[1] digest_0.6.29 R6_2.5.1 jsonlite_1.8.0 magrittr_2.0.3 evaluate_0.15 httr_1.4.3 rlang_1.0.2
[8] cli_3.3.0 curl_4.3.2 rmarkdown_2.16 tools_4.2.0 xfun_0.31 yaml_2.3.5 fastmap_1.1.0
[15] compiler_4.2.0 htmltools_0.5.2 knitr_1.39
For your example I retrieved NA instead of date:
> client <- connectwidgets::connect()
> raw <- client$content()
> head(raw$created_time, 1)
[1] "2022-02-08T17:03:07-05:00"
> head(strptime(raw$created_time, "%Y-%m-%dT%H:%M:%SZ", tz = "UTC"), 1)
[1] NA
> head(as.POSIXct(strptime(raw$created_time, "%Y-%m-%dT%H:%M:%SZ", tz = "UTC")), 1)
[1] NA
> raw <- client$content()
> head(raw$created_time, 1)
[1] "2022-02-08T17:03:07-05:00"
> head(strptime(raw$created_time, "%Y-%m-%dT%H:%M:%SZ", tz = "UTC"), 1)
[1] NA
> head(as.POSIXct(strptime(raw$created_time, "%Y-%m-%dT%H:%M:%SZ", tz = "UTC")), 1)
[1] NA
So my time format definitely differs from yours...
2022-09-21T12:39:45Z
vs 2022-02-08T17:03:07-05:00
That's a really interesting (unexpected) difference, and causing your NAs. It appears as if the Connect API is returning times in local time, rather than UTC. This is something we'll want to adjust in Connect.
We probably need to also cope with this time format in connectwidgets
, since this problem is likely present in a number of Connect versions.
Would you mind creating a support ticket (https://support.rstudio.com/) and reference this issue?
In the meantime, would it be possible to run your Connect server in UTC rather than local time? That might avoid this problem.
Any updates on this issue? We're having the same problem on Posit Connect (2023.10.0)
also here in the netherlands :)
No updates currently, but this is on our list to investigate for the next release.
No updates currently, but this is on our list to investigate for the next release.
Thanks @Lytol 🙂
Dear Team,
I found that content() function returns NAs for
created_time
andupdated_time
with RStudio Connect v2022.09.0. This is because theformat_iso8601
function is not needed anymore, since dates are already in ISO8601 format.https://github.com/rstudio/connectwidgets/blob/3b5c1fbe9f72a511b485d9fc0b43c16464cd8b85/R/content.R#L56-L57
May I kindly ask you to check, please?
Best regards, Yulia