js设置时间组件
var date = new Date(), y = date.getFullYear(), m = date.getMonth(),d = date.getDate(); var monthFirstDay = new Date(y, m-1, d); var timeArr = [monthFirstDay, new Date()]; this.searchData.queryTimeArr = timeArr;
js天数差 日期差
//判断日期差 dateDiff(sDate1, sDate2) { var aDate, oDate1, oDate2, iDays aDate = sDate1.substring(0, 10).split("-") oDate1 = new Date(aDate[0] , aDate[1] ,aDate[2]) aDate = sDate2.substring(0, 10).split("-") oDate2 = new Date(aDate[0] , aDate[1] , aDate[2]) iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 /24) //把相差的毫秒数转换为天数 return iDays }, // ----------下面是调用---------- this.dateDiff(this.searchData.queryStartTime, this.searchData.queryEndTime) > 31