Depending on your needs, this function will calculate the difference between the 2 days, and return a result in days decimal.
// This one returns a signed decimal. The sign indicates past or future.this.getDateDiff = function(date1, date2) { return (date1.getTime() - date2.getTime()) / (1000 * 60 * 60 * 24);}// This one always returns a positive decimal. (Suggested by Koen below)this.getDateDiff = function(date1, date2) { return Math.abs((date1.getTime() - date2.getTime()) / (1000 * 60 * 60 * 24));}