watch:{
'form.startTime'(val) {
console.log('startTime', val)
if (val) {
var month = new Date(val).getMonth() + 1
var year = new Date(val).getFullYear()
// console.log(month, '月')
// console.log(year, '年')
if (month == 2) {
if (year % 4 == 0 && year % 100 > 0) {
// console.log('闰年')
this.form.endTime = parseTime(new Date(val).getTime() + (60 * 60 * 1000 * 24 * 29))
return
}
if (year % 4 != 0) {
// console.log(2022 % 100)
// console.log('平年')
this.form.endTime = parseTime(new Date(val).getTime() + (60 * 60 * 1000 * 24 * 28))
}
return
}
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
// console.log('1 3 5 7 8 10 12')
this.form.endTime = parseTime(new Date(val).getTime() + ((60 * 60 * 1000 * 24 * 30) + (60 * 60 * 1000 * 24)))
return
}
if (month == 4 || month == 6 || month == 9 || month == 11) {
// console.log('4 6 9 11')
this.form.endTime = parseTime(new Date(val).getTime() + (60 * 60 * 1000 * 24 * 30))
return
}
console.log('endTime', this.form.endTime)
}
},
}