/获取一个月的天数和月份 /
function getCountDays() {
let curDate = new Date()
/ 获取当前月份 /
let curMonth = curDate.getMonth()
/ 设置下一个月月份 /
curDate.setMonth(curMonth + 1)
/ 0为上一个月的最后一天/
curDate.setDate(0)
/* 返回当月的天数和月份 */
return { day: curDate.getDate(), month: curMonth + 1 }
}
getCountDays();
网友评论