I have a package on CRAN called UNF, which creates a hash of a data.frame
(for use in data citation). I have some tests in the package related to the formatting of datetimes (I'm using testthat). They work correctly on the current version of R (3.1.3), but once I submitted to CRAN, one of these tests fail on "r-oldrel-windows" (3.0.3).
I've tracked down the difference to the following code, which yields different results in the two versions of R. Here's the correct output (from 3.1.3):
x = strptime("2014-08-22T16:51:05Z", "%FT%H:%M:%OSZ", tz="UTC")
x
# [1] "2014-08-22 16:51:05 UTC"
strftime(x, "%F")
# [1] "2014-08-22"
And here's the output from 3.0.3:
x = strptime("2014-08-22T16:51:05Z", "%FT%H:%M:%OSZ", tz="UTC")
x
# [1] "2014-08-22 16:51:05 UTC"
strftime(x, "%F")
# [1] ""
As you can see, the output of strftime
is an empty character string rather than an ISO 8601 formatted date. Any idea what the change was between these two versions? And how can I correct this? Or, how can I avoid having the tests fail on CRAN?
%F
was not previously supported as an output format on Windows. Thanks! – Gomel