Skip to content

Incorrect parsing of Mon-Year (bY) format #559

@IdoBar

Description

@IdoBar

Hi,

I'm trying to parse a very simple date format, which appears as either %d-%b-%Y, %b-%Y or %Y.
parse_date_time() works great for the 1st and 3rd formats, but is unable to parse the second one (though guess_date() successfully guesses the right format).
Examples:

> parse_date_time("May-2010", orders="bY")
[1] NA
Warning message:
All formats failed to parse. No formats found. 
> guess_formats("May-2010", orders="bY")
     bY 
"%b-%Y" 
> parse_date_time("May-2010", orders="%b-%Y")
[1] NA
Warning message:
All formats failed to parse. No formats found. 
> parse_date_time("May-2010", orders="Y")
[1] "2010-01-01 UTC"
> parse_date_time("01-May-2010", orders="dbY")
[1] "2010-05-01 UTC"

I'm using R 3.3.1, with lubridate 1.6.0, on a Windows machine with "English_Australia.1252" locale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions