Commit db9985a94e8ab93db94be2d7c3c792474032e127
1 parent
964582b3
update TimePicker
update TimePicker
Showing
1 changed file
with
8 additions
and
1 deletions
Show diff stats
src/components/date-picker/panel/time-range.vue
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | |
42 | 42 | import Mixin from './mixin'; |
43 | 43 | |
44 | - import { initTimeDate, toDate } from '../util'; | |
44 | + import { initTimeDate, toDate, formatDate } from '../util'; | |
45 | 45 | |
46 | 46 | const prefixCls = 'ivu-picker-panel'; |
47 | 47 | const timePrefixCls = 'ivu-time-picker'; |
... | ... | @@ -120,6 +120,8 @@ |
120 | 120 | this.secondsEnd = ''; |
121 | 121 | }, |
122 | 122 | handleChange (date, dateEnd, emit = true) { |
123 | + const oldDateEnd = new Date(this.dateEnd); | |
124 | + | |
123 | 125 | if (date.hours !== undefined) { |
124 | 126 | this.date.setHours(date.hours); |
125 | 127 | this.hours = this.date.getHours(); |
... | ... | @@ -151,6 +153,11 @@ |
151 | 153 | this.hoursEnd = this.dateEnd.getHours(); |
152 | 154 | this.minutesEnd = this.dateEnd.getMinutes(); |
153 | 155 | this.secondsEnd = this.dateEnd.getSeconds(); |
156 | + | |
157 | + const format = 'yyyy-MM-dd HH:mm:ss'; | |
158 | + if (formatDate(oldDateEnd, format) !== formatDate(this.dateEnd, format)) { | |
159 | + if (emit) this.$emit('on-pick', [this.date, this.dateEnd], true); | |
160 | + } | |
154 | 161 | }); |
155 | 162 | } else { |
156 | 163 | if (emit) this.$emit('on-pick', [this.date, this.dateEnd], true); | ... | ... |