I am trying to calculate the difference between dates in years and months. I was delighted when I found the functions getFullYear and getFullMonth. However when I use them I get the following error: Object doesn't support this property or method.
var BDate = document.getElementById("txtBirthdate");
var ODate = document.getElementById("txtOnsetDate");
var BOD = Date(BDate.valueOf);
var years = BOD .getFullYear() - BOD .getFullYear();