var sDate='2016-10-31';
var eDate='2016-10-10'
var sArr = sDate.split("-");
var eArr = eDate.split("-");
var sRDate = new Date(sArr[0], sArr[1], sArr[2]);
var eRDate = new Date(eArr[0], eArr[1], eArr[2]);
var result = (sRDate-eRDate)/(24*60*60*1000);
alert(
result
);