- 用于构造一个等于要添加的工作日
Array.from()
的数组。lengthcount
- 用于
Array.prototype.reduce()
遍历数组,从开始startDate
并递增,使用Date.prototype.getDate()
andDate.prototype.setDate()
。 - 如果当前
date
是周末,则通过添加一天或两天使其成为工作日再次更新。 - 注意:不考虑法定节假日。
const addWeekDays = (startDate, count) =>
Array.from({ length: count }).reduce(dat