function timeFormat (date) {
if (!date || typeof (date) === 'string') {
throw Error('参数异常,请检查...')
}
var y = date.getFullYear() //年
var m = date.getMonth() + 1 //月
var d = date.getDate() //日
return y + '-' + m + '-' + d
}
function getMonthFirstDay () {
var date = new Date()
date.setDate(1)
return timeFormat(date)
}
function getMonthLastDay () {
var curDate = new Date()
var curMonth = curDate.getMonth()
curDate.setMonth(curMonth + 1)
curDate.setDate(0)
return timeFormat(curDate)
}