Skip to content

Feature Request: When all values are NA, don't warn that parse_date_time didn't parse #530

@billdenney

Description

@billdenney

The reporting of formats failing to parse is a bit inconsistent. When all values passed to parse_date_time are NA, the warning of "all formats failed to parse" is given. When some (but not all) are NA, no warning is given for the NA values even though technically it's the same type of issue.

Feature request: If all values are NA, do not warn that all formats failed to parse. (I know I could use the quiet argument to silence the warning, but I want the warning in the case of actual parsing errors.)

> parse_date_time(NA,
+                 orders=c("%Y-%m-%d %H:%M", "%d%b%Y:%H:%M:%S", "%d%b%y:%H:%M"))
Warning: All formats failed to parse. No formats found.
[1] NA
> parse_date_time(c(NA, "2017-01-01 01:01"),
+                 orders=c("%Y-%m-%d %H:%M", "%d%b%Y:%H:%M:%S", "%d%b%y:%H:%M"))
[1] NA                        "2017-01-01 01:01:00 UTC"
> parse_date_time(c("foo", NA, "2017-01-01 01:01"),
+                 orders=c("%Y-%m-%d %H:%M", "%d%b%Y:%H:%M:%S", "%d%b%y:%H:%M"))
Warning:  1 failed to parse.
[1] NA                        NA                        "2017-01-01 01:01:00 UTC"

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