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
no warning (or error) with impossible dates #2
Comments
Hi @scottyaz, Thank you for the issue. You've got a good point! This behavior is due to the fact that the first thing Lines 97 to 100 in 51b36c9
I think it makes sense to throw an error here and assume that users will have already converted their dates to yyyy-mm-dd format (if a character). |
Works fine though I guess in someways it is a shame to not be borrowing from |
True, but as.POSIXlt("1910/12/1111")
#> [1] "1910-12-11 GMT" Created on 2019-03-07 by the reprex package (v0.2.1) The way I see it, parsing non-standard dates is a bit out of the scope for |
When passing a character as a date to
date2week
it seems like only the last two numbers (understandably) are read in the presumed day field. Seems like at a minimum a warning should be thrown to indicate that this conversion is assuming that the characters are in Y M D format. If more than two digits are picked up in the month or day position, perhaps an error or warning should also be thrown?`
R> date2week("1910/12/11",week_start="saturday")
[1] "1910-W50-2"
R> date2week("1910/12/111",week_start="saturday")
[1] "1910-W50-2"
R> date2week("1910/12/1111",week_start="saturday")
[1] "1910-W50-2"
`
The text was updated successfully, but these errors were encountered: