ropensci / ruODK

ruODK: An R Client for the ODK Central API
https://docs.ropensci.org/ruODK/
GNU General Public License v3.0
41 stars 12 forks source link

Tests fail on Timezone "Z" #130

Closed florianm closed 2 years ago

florianm commented 2 years ago

Problem

https://readr.tidyverse.org/reference/parse_datetime.html all of a sudden has an issue with parsing e.g. "2018-01-21T00:04:11.153Z" with readr::parse_datetime(.$createdAt, format = "%Y-%m-%dT%H:%M:%OS%Z") in submission_detail

readr::parse_datetime("2018-01-21T00:04:11.153Z", format = "%Y-%m-%dT%H:%M:%OS%Z")

Reproducible example

Tests fail with

── Error (test-submission_detail.R:***:***): submission_detail works ───────────────
Error: Error: 'Z' not found in the time zone database.
Backtrace:
     █
  ***. ├─vcr::use_cassette(...) test-submission_detail.R:***:***
  ***. │ └─cassette$call_block(...)
  ***. ├─ruODK::submission_detail(...) test-submission_detail.R:***:4
  4. │ └─`%>%`(...)
  5. ├─tibble::tibble(...)
  6. │ └─tibble:::tibble_quos(xs, .rows, .name_repair)
  7. │   └─rlang::eval_tidy(xs[[j]], mask)
  8. └─readr::parse_datetime(.$createdAt, format = "%Y-%m-%dT%H:%M:%OS%Z")
  9.   └─readr::parse_vector(...)
 ***0.     ├─readr:::warn_problems(...)
 ***.     │ └─readr:::n_problems(x)
 ***.     │   └─readr::problems(x)
 ***.     │     └─readr:::probs(x)
 ***4.     │       └─base::suppressWarnings(x)
 ***5.     │         └─base::withCallingHandlers(...)
 ***6.     └─readr:::parse_vector_(...)

MVE

R> readr::parse_datetime("2018-01-21T00:04:11.153Z", format = "%Y-%m-%dT%H:%M:%OS%Z")
Error: 'Z' not found in the time zone database.
Backtrace:
    █
 1. └─readr::parse_datetime("2018-01-21T00:04:11.153Z", format = "%Y-%m-%dT%H:%M:%OS%Z")
 2.   └─readr::parse_vector(...)
 3.     ├─[ readr:::warn_problems(...) ] with 5 more calls
 9.     └─readr:::parse_vector_(...)
R> readr::parse_datetime("2018-01-21T00:04:11.153Z", format = "%Y-%m-%dT%H:%M:%OSZ")
[1] "2018-01-21 00:04:11 UTC"

Suggestion: drop the %Z, replace with Z to expect a literal "Z" indicating that ODK Central always returns ISO8601 timestamps in UTC, as indicated by the "Z".