Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcharacter method for as_date forces `tz` arg when `format` present, doesn't use it #674
Comments
|
Indeed, should be fixed.
|
|
per discussion on #675 should |
|
Minimal reprex: library(lubridate, warn.conflicts = FALSE)
x <- "05172018"
as_date(x)
#> Warning: All formats failed to parse. No formats found.
#> [1] NA
as_date(x, format = "%m%d%Y")
#> Error in strptime(x, format, tz): invalid 'tz' value
as_date(x, tz = "America/New_York", format = "%m%d%Y")
#> [1] "2018-05-17"Created on 2019-11-19 by the reprex package (v0.3.0) |
* Ignore tz argument in as_date() Fixes #674
If you try to convert a string using
lubridate::as_datewhile specifying theformat, you must also settz, but it isn't used.Current Github version, 1.7.4.
On the one hand, this is unexpected, surprising behavior, but on the other hand, do timezones ever matter for
Date's?In the very least, seems like you shouldn't need the
tzarg here; the second option should work.