|
166 | 166 |
|
167 | 167 | const handleHours = (type: string): void => { |
168 | 168 | if (type === 'increment') { |
| 169 | + const hoursValue = addDateHours(hours.value, +props.hoursIncrement); |
169 | 170 | if (props.maxTime.hours) { |
170 | | - if (hours.value + +props.hoursIncrement > +props.maxTime.hours) { |
| 171 | + if (hoursValue > +props.maxTime.hours) { |
171 | 172 | return; |
172 | 173 | } |
173 | 174 | } |
174 | 175 | if (props.minTime.hours) { |
175 | | - if (hours.value + +props.hoursIncrement < +props.minTime.hours) { |
| 176 | + if (hoursValue < +props.minTime.hours) { |
176 | 177 | return; |
177 | 178 | } |
178 | 179 | } |
179 | | - emit('update:hours', addDateHours(hours.value, +props.hoursIncrement)); |
| 180 | + emit('update:hours', hoursValue); |
180 | 181 | } else { |
| 182 | + const hoursValue = subDateHours(hours.value, +props.hoursIncrement); |
181 | 183 | if (props.minTime.hours) { |
182 | | - if (hours.value - +props.hoursIncrement < +props.minTime.hours) { |
| 184 | + if (hoursValue < +props.minTime.hours) { |
183 | 185 | return; |
184 | 186 | } |
185 | 187 | } |
186 | 188 | if (props.maxTime.hours) { |
187 | | - if (hours.value - +props.hoursIncrement > +props.maxTime.hours) { |
| 189 | + if (hoursValue > +props.maxTime.hours) { |
188 | 190 | return; |
189 | 191 | } |
190 | 192 | } |
191 | | - emit('update:hours', subDateHours(hours.value, +props.hoursIncrement)); |
| 193 | + emit('update:hours', hoursValue); |
192 | 194 | } |
193 | 195 | }; |
194 | 196 |
|
195 | 197 | const handleMinutes = (type: string): void => { |
196 | 198 | if (type === 'increment') { |
| 199 | + const minutesValue = addDateMinutes(minutes.value, +props.minutesIncrement); |
197 | 200 | if (props.maxTime.minutes) { |
198 | | - if (minutes.value + +props.minutesIncrement > +props.maxTime.minutes) { |
| 201 | + if (minutesValue > +props.maxTime.minutes || minutesValue === 0) { |
199 | 202 | return; |
200 | 203 | } |
201 | 204 | } |
202 | 205 | if (props.minTime.minutes) { |
203 | | - if (minutes.value + +props.minutesIncrement < +props.minTime.minutes) { |
| 206 | + if (minutesValue < +props.minTime.minutes || minutesValue === 0) { |
204 | 207 | return; |
205 | 208 | } |
206 | 209 | } |
207 | | - emit('update:minutes', addDateMinutes(minutes.value, +props.minutesIncrement)); |
| 210 | + emit('update:minutes', minutesValue); |
208 | 211 | } else { |
| 212 | + const minutesValue = subDateMinutes(minutes.value, +props.minutesIncrement); |
209 | 213 | if (props.minTime.minutes) { |
210 | | - if (minutes.value - +props.minutesIncrement < +props.minTime.minutes) { |
| 214 | + if (minutesValue < +props.minTime.minutes || minutesValue === 0) { |
211 | 215 | return; |
212 | 216 | } |
213 | 217 | } |
214 | 218 | if (props.maxTime.minutes) { |
215 | | - if (minutes.value + +props.minutesIncrement > +props.maxTime.minutes) { |
| 219 | + if (minutesValue > +props.maxTime.minutes) { |
216 | 220 | return; |
217 | 221 | } |
218 | 222 | } |
219 | | - emit('update:minutes', subDateMinutes(minutes.value, +props.minutesIncrement)); |
| 223 | + emit('update:minutes', minutesValue); |
220 | 224 | } |
221 | 225 | }; |
222 | 226 |
|
|
0 commit comments