Skip to content
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

Fatal error when parsing date with % #1229

Closed
peterdesmet opened this issue Jul 14, 2021 · 1 comment
Closed

Fatal error when parsing date with % #1229

peterdesmet opened this issue Jul 14, 2021 · 1 comment

Comments

@peterdesmet
Copy link
Contributor

R strptime() documents that % in date/time/datetime can be escaped as %%:

Any character in the format string not part of a conversion specification is interpreted literally (and %% gives %).

This works indeed:

strptime("2011-01-03%", format = "%Y-%m-%d%%")

The Python implementation suggests the same (last element of table at https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior).

But trying this in readr::parse_date() gives a fatal error:

library(readr)
parse_date("2011-01-03%", format = "%Y-%m-%d%%")

Granted, readr doesn't claim to support this escape, but given that it seems to be a standard elsewhere, it would probably be good to handle it. 😄

@jimhester
Copy link
Collaborator

This is a duplicate of #1151 and #1182, it is already fixed in the development version of readr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants