// https://gist.github.com/remino/1563878
// Converts millseconds to object with days, hours, minutes ans seconds.
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
};
var start_date = '04/15/2014';
var end_date = '04/16/2014';
var diff = convertMS(Date.parse(end_date) - Date.parse(start_date));
if(diff.d > 1) {
console.log('The difference is more than one day!');
}
else {
console.log('The difference is just one day and therefore accepted!');
}
See the js fiddle: http://jsfiddle.net/E7bCF/11/
See the js fiddle with more than a day difference: http://jsfiddle.net/E7bCF/9/