Skip to content

Commit

Permalink
Fix helper for converting date to gts format.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed Mar 15, 2024
1 parent ba5ca3c commit cf0d8bf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
date_to_gts <- function(date) {
date_format <- as.Date(date)
posixt_format <- as.POSIXct(date)

if (stringr::str_length(date) == 10 && !is.null(date_format)) {
if (date_format == posixt_format) {
paste0(date, "T00:00:00Z")
} else if (stringr::str_length(date) == 19 && !is.null(posixt_format)) {
} else {
stringr::str_replace(
date,
"^(.{10})(.*)$",
Expand Down

0 comments on commit cf0d8bf

Please sign in to comment.