原生JS代码封装(判断两个日期相差的天数)

 
function betweenDates(d1, d2){
    var res = Math.abs(d1.getTime() - d2.getTime());
    return res/1000/60/60/24;
}

猜你喜欢

转载自www.cnblogs.com/sunyang-001/p/10812836.html