计算一个月有多少天

const monthHaveManyDays = (year, month) => {
  const map = [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  const days = map[month - 1];
  return days || (year % 4 == 0 && year % 100 != 0) || year % 400 == 0
    ? 29
    : 28;
};

  

posted @ 2020-05-26 13:44  671_MrSix  阅读(285)  评论(0编辑  收藏  举报