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

Date parsers are failing with dates which are in 24:00 format #418

Closed
skgrange opened this Issue May 25, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@skgrange

skgrange commented May 25, 2016

Hello lubridate team,
After the last update (version 1.5.6), the parse_date_time and ymd_h* functions fail to parse dates when the hour format includes the somewhat special case of 24 hours. The help file of the function still states that hours can take the form 0--24 and strftime performs as expected. An example:

library(lubridate)

# An example
date_string <- "2016-05-24 24:00:00"

# Both cases fail
ymd_hms(date_string, tz = "UTC")
parse_date_time(date_string, orders = "ymd hms", tz = "UTC")

# Works correctly, first instant of next day
strftime(date_string, tz = "UTC")

Is this a deliberate regression? Many thanks.

@jstaf

This comment has been minimized.

jstaf commented Jun 14, 2016

Can confirm this bug. I feel like lubridate should be able to handle this:

> ymd_hm("2016-05-27 24:00")
[1] NA
Warning message:
All formats failed to parse. No formats found. 

Meanwhile, strptime/strftime works just fine:

> strptime("2016-05-27 24:00", format = "%Y-%m-%d %H:%M")
[1] "2016-05-28 EDT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment