SOURCE

// 判断是否为工作日
function isWorkingDay(date) {
  // 获取星期几(0表示星期日,1表示星期一,以此类推)
  const dayOfWeek = date.getDay();
console.log(dayOfWeek,9)
  // 判断是否为周末(星期六或星期日)
  if (dayOfWeek === 0 || dayOfWeek === 6) {
    return false;
  }

  return true;
}

// 获取延后几天后的日期
function getDelayedDate(date, days) {
  const delayedDate = new Date(date.getTime());
  console.log(date,delayedDate)
  delayedDate.setDate(date.getDate() + days);
  return delayedDate;
}

// 示例用法
const currentDate = new Date(); // 当前日期
const delayedDate = getDelayedDate(currentDate, 5); // 延后3天后的日期

console.log("当前日期:", currentDate.toLocaleDateString());
console.log("延后3天后的日期:", delayedDate.toLocaleDateString());
console.log("延后3天后是否为工作日:", isWorkingDay(delayedDate));
console 命令行工具 X clear

                    
>
console