当前位置: 首页 > Web前端 > vue.js

vue+vant最大时间范围不能超过XX小时

时间:2023-04-01 01:30:57 vue.js

this.startDate='2021-06-0112:00'this.endDate='2021-06-0118:00'//检查是否是时间段超过XX小时checkDate(){const{startDate:st,endDate:et}=thisif(st&&et){if(st>et){Toast.fail('开始时间不能大于结束时间')this.endDate=''}else{constst1=st.substr(0,16).split(/-||:/)constet1=et.substr(0,16).split(/-||:/)if(st1[0]!==et1[0]||st1[1]!==et1[1]||st1[2]!==et1[2]){Toast.fail('必须选择sameday')this.endDate=''}elseif(et1[3]-st1[3]>XX){Toast.fail('时间段选择不能超过六小时')this.endDate=''}}}},