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

Lubridate jumps over a month #336

Closed
adeldaoud opened this Issue Jul 28, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@adeldaoud

adeldaoud commented Jul 28, 2015

Lubridate jumps over the 3ed month here:

as.period(interval(ymd("1985-12-31"),ymd("1986-01-01")))%/%months(1)
as.period(interval(ymd("1985-12-31"),ymd("1986-02-01")))%/%months(1)
as.period(interval(ymd("1985-12-31"),ymd("1986-03-01")))%/%months(1)
as.period(interval(ymd("1985-12-31"),ymd("1986-04-01")))%/%months(1)
as.period(interval(ymd("1985-12-31"),ymd("1986-05-01")))%/%months(1)

This seems to be a bug, or at least an unexpected calculation.

@vspinu

This comment has been minimized.

Member

vspinu commented Jul 28, 2015

The problem is with the

> as.period(interval(ymd("1985-12-31"),ymd("1986-03-01")))
[1] "2m -2d 0H 0M 0S"

There should be no negative days in as.period conversion.

@vspinu vspinu added the bug label Jul 28, 2015

AlunHewinson added a commit to AlunHewinson/lubridate that referenced this issue Sep 29, 2015

bugfix (issue 336) on coercion from interval to period
If the sign of the month and day of the new period are opposite to each other, set @day to zero.

tidyverse#336

@vspinu vspinu closed this in 0bbe8c1 Sep 30, 2015

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