I have come across some unusual behavior calculating dates in R.
I am trying to estimate date of conception by back calculating 9 months from date of birth, where date of birth is in the format as_date("1946-03-31"
.
So, the calculation would look like
as_date("1946-03-31")- months(9)
However, instead of getting a date, I get NA
.
Strangely, if I change the month number, I get a perfect result:
as_date("1946-03-31")- months(8)
or
as_date("1946-03-31")- months(10)
Both work.
I also get a perfect date if I use days
as_date("1946-03-31")- days(273)
Is there a totally obvious reason for this that I'm missing? If not, is this replicable across other setups?