Skip to content

Commit 28e7245

Browse files
authored
fix(b-form-spinbutton): respect step value for initial decrement when wrap enabled (closes #4884) (#4885)
* fix(b-form-spinbutton): respect step value when decrementing (closes #4884) * Update form-spinbutton.js Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
1 parent 6e6d17e commit 28e7245

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/form-spinbutton/form-spinbutton.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
168168
return defaultNumber(this.min, DEFAULT_MIN)
169169
},
170170
computedMax() {
171-
return defaultNumber(this.max, DEFAULT_MAX)
171+
// We round down to the nearest maximum step value
172+
const max = defaultNumber(this.max, DEFAULT_MAX)
173+
const step = this.computedStep
174+
const min = this.computedMin
175+
return Math.floor((max - min) / step) * step + min
172176
},
173177
computedDelay() {
174178
return defaultInteger(this.repeatDelay, DEFAULT_REPEAT_DELAY) || DEFAULT_REPEAT_DELAY

0 commit comments

Comments
 (0)