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

add_duration_to_date ungraceful error when durations first element is NA #483

Closed
ctbrown opened this Issue Oct 19, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@ctbrown
Contributor

ctbrown commented Oct 19, 2016

add_duration_to_date yields and ungraceful error when duration has leading NA. For example:

lubridate:::add_duration_to_date( c(1,NA,2), Sys.Date() ) # OKAY
lubridate:::add_duration_to_date( c(NA,1,2), Sys.Date() ) # ERROR
lubridate:::add_duration_to_date( c(NA,NA), Sys.Date() ) # ERROR

The error given is:

Error in if (hour(ans) == 0 && minute(ans) == 0 && second(ans) == 0) return(as.Date(ans)) :
missing value where TRUE/FALSE needed

ctbrown added a commit to ctbrown/lubridate that referenced this issue Oct 19, 2016

{Fix #483] add_duration_to_date with leading NA
* Fix code that had wrong test for date in ops-addition.r
* Added tests to test-ops-additions.R

ctbrown added a commit to ctbrown/lubridate that referenced this issue Oct 24, 2016

{Fix #483] add_duration_to_date with leading NA
* Fix code that had wrong test for date in ops-addition.r
* Added tests to test-ops-additions.R

ctbrown added a commit to ctbrown/lubridate that referenced this issue Oct 24, 2016

ctbrown added a commit to ctbrown/lubridate that referenced this issue Oct 24, 2016

ctbrown added a commit to ctbrown/lubridate that referenced this issue Oct 24, 2016

[Fix #483] add_duration_to_date with leading NA
* Fix code that had wrong test for date in ops-addition.r
* Added tests to test-ops-additions.R

This was referenced Oct 24, 2016

ctbrown added a commit to ctbrown/lubridate that referenced this issue Nov 1, 2016

[Fix #483] add_duration_to_date with leading NA
* Fix code that had wrong test for date in ops-addition.r
* Added tests to test-ops-additions.R
* Update NEWS.md

@vspinu vspinu closed this in d97d62d Nov 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment