You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For dates with mixed 2- and 4-digit year, the date-parsing behavior of parse_date_time() is inconsistent when orders = "mdy". But, it works fine when, for example, order = "ymd".
I tried to find where it could come from but it is not obvious.
Training of lubridate found two formats %b.%d.%Y and %b.%d.%y. lubridate:::.select_formats prioritizes the first one. Then lubridate::.striptime pass parsing through base::strptime that do not gives back NA on "apr.12.50" when used with format %b.%d.%Y. So %b.%d.%y is never used and %b.%d.%Y is used on both.
It is not the case with orders = "ymd". Difference is it uses c_parser with %y.%Om.%d and %Y.%Om.%d formats. with orders = "mdy", guess_format does not replace m with Om because of grepl("[^O][mbB]", orders)
Hope this little investigation could help fix the bug.
Thanks @cderv for spotting this. This was a corner case bug due to the scoring in .select_formats indeed. When y occurred at the end of the format, it wasn't detected by that regexp. Now fixed!
Hi all,
For dates with mixed 2- and 4-digit year, the date-parsing behavior of
parse_date_time()
is inconsistent whenorders = "mdy"
. But, it works fine when, for example,order = "ymd"
.Examples
R version: 3.4.0
lubridate: lubridate_1.6.0.9009
Thanks in advance.
Best,
Malwina
The text was updated successfully, but these errors were encountered: