this really sounds like a simple question but I had no luck searching. what does the +d in
+d
function addMonths(d, n, keepTime) { if (+d) {
The + operator returns the numeric representation of the object. So in your particular case, it would appear to be predicating the if on whether or not d is a non-zero number.
+
d
Reference here. And, as pointed out in comments, here.