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

parse_date_time: orders mdy/Y don't play well with dby/Y #572

Henrik-P opened this Issue Sep 1, 2017 · 1 comment


None yet
2 participants

Henrik-P commented Sep 1, 2017

When using orders mdy or mdY together with dby or dbY in parse_date_time, the mdy and mdY formats are incorrectly parsed as dmy or dmY. For some reason mdy and dbY works though.

In all examples below, the mdy or mdY dates should be parsed as "2017-09-01" (Ymd).

Does not work:

# mdy & dby
parse_date_time(c("09-01-17", "02-Sep-17"), orders = c("mdy", "dby"), locale = "eng")
# [1] "2017-01-09 UTC" "2017-09-02 UTC"

# mdY & dby/Y
parse_date_time(c("09-01-2017", "02-Sep-17"), orders = c("mdY", "dby"), locale = "eng")
parse_date_time(c("09-01-2017", "02-Sep-2017"), orders = c("mdY", "dbY"), locale = "eng")
# [1] "2017-01-09 UTC" "2017-09-02 UTC"

# mdy/Y & dby/Y, with no mdy/Y in x 
parse_date_time("09-01-17", orders = c("mdy", "dby", "dbY"), locale = "eng")
parse_date_time("09-01-2017", orders = c("mdY", "dby", "dbY"), locale = "eng")
# [1] "2017-01-09 UTC"


# mdy vs dbY
parse_date_time(c("09-01-17", "02-Sep-2017"), orders = c("mdy", "dbY"), locale = "eng")

# ymd/Ymd vs dbY
parse_date_time(c("17-09-01", "02-Sep-2017"), orders = c("ymd", "dbY"), locale = "eng")
parse_date_time(c("2017-09-01", "02-Sep-2017"), orders = c("Ymd", "dbY"), locale = "eng")

# dmy/dmY vs dbY 
parse_date_time(c("01-09-17", "02-Sep-2017"), orders = c("dmy", "dbY"), locale = "eng")
parse_date_time(c("01-09-2017", "02-Sep-2017"), orders = c("dmY", "dbY"), locale = "eng")

@Henrik-P Henrik-P changed the title from parse_date_time: orders mdy/Y doesn't play well with dby/Y to parse_date_time: orders mdy/Y don't play well with dby/Y Sep 1, 2017


This comment has been minimized.


vspinu commented Oct 1, 2017

This happens because "b" format matches numeric months. This is not intended.

@vspinu vspinu added the bug label Oct 1, 2017

@vspinu vspinu closed this in 8811663 Oct 2, 2017

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