New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with as_date reading a character with date and time #598

Closed
kerry-ja opened this Issue Oct 31, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@kerry-ja

kerry-ja commented Oct 31, 2017

With version 1.7.0 the as_date function does not convert a character with a date and time to a date, instead it returns NA with a warning. The expected value to be returned was a date with the time portion dropped. In version 1.6.0, the function converted the character to a date.

# See if as_date works with current version of lubridate to convert a character string with time
install.packages("lubridate")
#> (as 'lib' is unspecified)
#> package 'lubridate' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>  C:\Users\kerry.jackson\AppData\Local\Temp\RtmpEL6DC7\downloaded_packages
lubridate::as_date("2017-10-31 06:00:00")
#> Warning: All formats failed to parse. No formats found.
#> [1] NA
packageVersion("lubridate")
#> [1] '1.7.0'
# See if as_date works with version 1.6 of lubridate to convert a character string with time
library(devtools)
install_version("lubridate", version = "1.6.0", repos = "http://cran.us.r-project.org")
#> 
lubridate::as_date("2017-10-31 06:00:00")
#> [1] "2017-10-31"
packageVersion("lubridate")
#> [1] '1.6.0'
@vspinu

This comment has been minimized.

Member

vspinu commented Oct 31, 2017

Hm, sorry about that. That was a consequence of #536 and #527 and it didn't strike me as breaking change. You usage is rather unusual, but for the sake of the backward compatibility I will fix it asap.

@vspinu vspinu closed this in d44d919 Oct 31, 2017

@kerry-ja

This comment has been minimized.

kerry-ja commented Oct 31, 2017

I appreciate the very quick fix, however I still have the same issue. I thought that perhaps even though I did install the update, which was available perhaps I needed to install from github, however when I tried I got an error.
devtools::install_github("tidyverse/lubridate")
Error: package or namespace load failed for 'lubridate': .onAttach failed in attachNamespace() for 'lubridate', details: call: Sys.setenv("TZDIR", tzdir) error: all arguments must be named Error: loading failed Execution halted *** arch - x64 Error: package or namespace load failed for 'lubridate': .onAttach failed in attachNamespace() for 'lubridate', details: call: Sys.setenv("TZDIR", tzdir) error: all arguments must be named Error: loading failed Execution halted ERROR: loading failed for 'i386', 'x64'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment