计算月初和月末的js
function getLast(cur){ //cur 当前时间 var firstDay = new Date(cur.getFullYear() + '/' + (cur.getMonth()+1) + '/' + cur.getDate() + ' 00:00:00'); firstDay.setDate(1); //月末 var lastDay = new Date(+firstDay); lastDay.setMonth(lastDay.getMonth() + 1); lastDay.setDate(0); return [firstDay,lastDay]; }