Skip to content

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

Description

@kerry-ja

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'

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions