From 3ac0765aa669b1f1cc5b04b4f61dde351923aa43 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 25 Aug 2023 09:59:47 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-3141=20fix=EF=BC=9Aexplore=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=80=89=E6=8B=A9=E5=99=A8=E6=A0=A1=E9=AA=8C=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/timePicker.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/common/timePicker.vue b/nezha-fronted/src/components/common/timePicker.vue index 4b83253d0..cde2088cf 100644 --- a/nezha-fronted/src/components/common/timePicker.vue +++ b/nezha-fronted/src/components/common/timePicker.vue @@ -381,10 +381,14 @@ export default { 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.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 } },