0
我正在使用dangrossman daterangepicker。我找到了一種方法來禁用在選擇器這樣的週六和週日:在沒有周末的情況下在daterangepicker中計算天
isInvalidDate: function(date){
return (date.day() == 0 || date.day() == 6);}
然後我計算天數是這樣的:
function(start, end, label)
{
console.log(label);
var hd = end.diff(start, 'days');
$('#totalDays').val(hd);
});
但它仍包括週六和週日在計算。有沒有辦法排除它?謝謝!
可能ü可以在這裏找到你的解決方案:http://stackoverflow.com/a/3464346/2651863 –
看起來像daterangepicker使用了moment.js。你可以適應這一點:http://stackoverflow.com/questions/20788411/how-to-exclude-weekends-between-two-dates-using-moment-js –