【发布时间】:2015-09-05 14:05:04
【问题描述】:
从this question 开始,它使用以下方法计算给定日期范围内的特定工作日数:
function countCertainDays( days, d0, d1 ) {
var ndays = 1 + Math.round((d1-d0)/(24*3600*1000));
var sum = function(a,b) {
return a + Math.floor( ( ndays + (d0.getDay()+6-b) % 7 ) / 7 );
};
return days.reduce(sum,0);
}
我还想知道如果假期在该范围内的工作日,如何排除这些假期,假设我在d0 和d1 之间有一系列假期。
感谢您的帮助!
【问题讨论】:
标签: javascript momentjs