乐趣区

关于javascript:vue-+-vant-时间范围最大不能超过XX小时

this.startDate = '2021-06-01 12:00'
this.endDate = '2021-06-01 18: 00'
// 查看时间段有没有超过 XX 小时
    checkDate() {const { startDate: st, endDate: et} = this
      if (st && et) {if (st > et) {Toast.fail('开始工夫不能大于完结工夫')
          this.endDate = ''
        } else {const st1 = st.substr(0, 16).split(/-| |:/)
          const et1 = et.substr(0, 16).split(/-| |:/)
          if (st1[0] !== et1[0] || st1[1] !== et1[1] || st1[2] !== et1[2]) {Toast.fail('需抉择同一天')
            this.endDate = ''
          } else if (et1[3] - st1[3] > XX) {Toast.fail('时间段抉择不能超过六小时')
            this.endDate = ''
          }
        }
      }
    },
退出移动版