You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and about adding months to some date, this is correctly working and explained in Arithmetic with date times.
# 31 of April does not exists, thus NA
ymd('2012-03-31') + months(1)
#> [1] NA#use %m+% to have the last day of the new month
ymd('2012-03-31') %m+% months(1)
#> [1] "2012-04-30"
ymd('2012-02-29') %m+% months(1)
#> [1] "2012-03-29"# same with years
ymd('2012-03-31') + years(1)
#> [1] "2013-03-31"
ymd('2012-02-29') %m+% years(1)
#> [1] "2013-02-28"
Activity
vspinu commentedon Dec 12, 2014
What version is this? I cannot reproduce with the Dev version.
On Dec 12, 2014 2:48 AM, "Joseph" notifications@github.com wrote:
larmarange commentedon Dec 12, 2014
I have update R to version 3.1.2 and reinstalled the dev version with
install_githubfromdevtools. I'm on Windows 8.1, 64 bits, French version.I still obtain:
The bug occurs only if the first date is a 29 Feb and if
unit="year"larmarange commentedon Dec 12, 2014
Ok, the problem is due to the fact that in this specific case, on line 30 of
ops-division.r(functionadjust), we are doing this sort of computation:whose result is equal to
NA.larmarange commentedon Dec 12, 2014
In the same way, we have:
I have changed the title of the issue accordingly
[-]Strange bug with as period[/-][+]Problem to add a year when date is a 29 Feb[/+]larmarange commentedon Dec 12, 2014
The issue is the same when adding months if the targeted month doesn't have the "same day" available. Example:
vspinu commentedon Dec 12, 2014
Ok. I see. This is why I haven't spotted it the first time. Will investigate.
motabe commentedon Apr 26, 2018
Guys, this is still happening nowadays, is there a way to cirvumvent this problem?
cderv commentedon Apr 27, 2018
What are you trying to do exactly ?
initial problem is ok
and about adding months to some date, this is correctly working and explained in Arithmetic with date times.
Created on 2018-04-27 by the reprex package (v0.2.0).