NEZ-3141 fix:explore 时间选择器校验错误

This commit is contained in:
zhangyu
2023-08-25 09:59:47 +08:00
parent 9d4e01e667
commit 3ac0765aa6

View File

@@ -381,10 +381,14 @@ export default {
this.oldSearchTime[1] = bus.timeFormate(this.oldSearchTime[1]) this.oldSearchTime[1] = bus.timeFormate(this.oldSearchTime[1])
} }
} }
if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid() && !moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1])) { let isBefore = true
if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid()) {
isBefore = this.momentStrToTimestamp(this.oldSearchTime[0]) < this.momentStrToTimestamp(this.oldSearchTime[1])
}
if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid() && !isBefore) {
this.oldSearchTimeError[0] = true this.oldSearchTimeError[0] = true
this.inputError = this.$t('date.fromGreaterTo') this.inputError = this.$t('date.fromGreaterTo')
} else if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid() && moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1])) { } else if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid() && isBefore) {
this.oldSearchTimeError[0] = false this.oldSearchTimeError[0] = false
} }
}, },