The question is not well defined for the case that the dates straddle the end of Feb and one year is a leap year and one is not but ignoring this we can replace the year in each date with a leap year if either is a leap year (year 2000) and a non-leap year (year 1999) otherwise and then subtract:
library(lubridate)
d1 <- "2008-12-15"
d2 <- "2018-12-16"
yr <- 1999 + (leap_year(as.Date(d1)) || leap_year(as.Date(d2)))
as.Date(sub("....", yr, d1)) - as.Date(sub("....", yr, d2))
## Time difference of -1 days
ADDED
In a comment the poster indicated that we can ignore the problems introduced by leap years. In that case we can just pick a leap year as the date to substitute in so that it always returns an answer. We do that below. We no longer need lubridate to check whether the dates are leap years or not.
as.Date(sub("....", 2000, d1)) - as.Date(sub("....", 2000, d2))
## Time difference of -1 days
(Alternately we could pick a year that is not a leap year and since most years are not leap years that would more likely not be one day off for straddled dates; however, it would be at the cost of failing if one of the dates is Feb 29th.)