Commit 964582b3996bb2e86517196a297714d25e91ff2e
1 parent
a18d2b3a
update TimePicker
update TimePicker
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
src/components/date-picker/panel/time-range.vue
... | ... | @@ -144,7 +144,17 @@ |
144 | 144 | this.dateEnd.setSeconds(dateEnd.seconds); |
145 | 145 | this.secondsEnd = this.dateEnd.getSeconds(); |
146 | 146 | } |
147 | - if (emit) this.$emit('on-pick', [this.date, this.dateEnd], true); | |
147 | + // judge endTime > startTime? | |
148 | + if (this.dateEnd < this.date) { | |
149 | + this.$nextTick(() => { | |
150 | + this.dateEnd = new Date(this.date); | |
151 | + this.hoursEnd = this.dateEnd.getHours(); | |
152 | + this.minutesEnd = this.dateEnd.getMinutes(); | |
153 | + this.secondsEnd = this.dateEnd.getSeconds(); | |
154 | + }); | |
155 | + } else { | |
156 | + if (emit) this.$emit('on-pick', [this.date, this.dateEnd], true); | |
157 | + } | |
148 | 158 | }, |
149 | 159 | handleStartChange (date) { |
150 | 160 | this.handleChange(date, {}); | ... | ... |