-
Notifications
You must be signed in to change notification settings - Fork 5
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
Should undefined date parsing error? #258
Comments
Oh, it actually does work like strptime in this way. That warning is actually about truly trying to parse the time components when the result is only day precision. Here are a few related tests for the undocumented behavior clock/tests/testthat/test-date.R Lines 302 to 321 in f3b79db
In your example it would be like doing this to try and parse the hour, which is then automatically rounded in some undefined (to us) way: clock::date_parse(c("2019-01-01 11", "2019-01-01 12"), format = "%Y-%m-%d %H") I can probably try and clarify this with an example in the docs |
Cool - that makes sense. Yep - clarification in docs for this case would be great but agree you are right to leave the exact behaviour in presence of time components undefined. |
I've been using date_parse to parse character inputs, from a user, in to dates with something akin to
However I have just noticed the warning in the "Details" of the documentation:
I had wrongly been assuming this would work similar to strptime where trailing characters were ignored
This leads to the following question. If passing a sub-standard daily string into a Date is undefined in clock would it be better for the following to error?
Hope this makes sense. This potentially links to #255
The text was updated successfully, but these errors were encountered: