function date_duration(){
var chk_in = document.getElementById('chk_in').values;
var chk_out = document.getElementById('chk_in').values;
var diff = Math.abs( m1.diff(m2) );
document.getElementById("duration").innerHTML = diff;
}
var date1 = new Date("09/18/2018");
var date2 = new Date("09/20/2018");
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
console.log(diffDays);
เขียนเองก็ยาวหน่อยนืง
moment.js ก็สั้นกว่านิดหน่อย
http://momentjs.com/
var a = moment('09/18/2018','M/D/YYYY');
var b = moment('09/20/2018','M/D/YYYY');
var diffDays = b.diff(a, 'days');