计算起始时间和结束时间相差的天数##
export function dataDifference(endDate,startDate){
let dataSpan
let tempDate
let iDays
endDate = Date.parse(endDate)
startDate = Date.parse(startDate)
dataSpan = startDate - endDate
dataSpan = Math.abs(dataSpan)
iDays = Math.floor(dataSpan/(24*3600*1000))
return iDays
}
页面调用
import { dataDifference } from '@/utils/index.js'
let days = dataDifference(this.endData,this.startDate)