📜  获取当前第 2 周 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:24.139000             🧑  作者: Mango

代码示例1
function getCurrentWeek() {
  var currentDate = moment();

  var weekStart = currentDate.clone().startOf('isoWeek');
  var weekEnd = currentDate.clone().endOf('isoWeek');

  var days = [];

  for (var i = 0; i <= 6; i++) {
    days.push(moment(weekStart).add(i, 'days').format("MMMM Do,dddd"));
  }
  console.log(days);
}

getCurrentWeek();