@@ -67,10 +67,6 @@ export default {
6767 }
6868 } ,
6969 computed : {
70- computedDebounce ( ) {
71- // Ensure we have a positive number equal to or greater than 0
72- return Math . max ( toInteger ( this . debounce ) || 0 , 0 )
73- } ,
7470 computedClass ( ) {
7571 return [
7672 {
@@ -98,6 +94,13 @@ export default {
9894 }
9995 // Most likely a string value (which could be the string 'true')
10096 return this . ariaInvalid
97+ } ,
98+ computedDebounce ( ) {
99+ // Ensure we have a positive number equal to or greater than 0
100+ return Math . max ( toInteger ( this . debounce ) || 0 , 0 )
101+ } ,
102+ hasFormatter ( ) {
103+ return isFunction ( this . formatter )
101104 }
102105 } ,
103106 watch : {
@@ -132,7 +135,7 @@ export default {
132135 } ,
133136 formatValue ( value , evt , force = false ) {
134137 value = toString ( value )
135- if ( ( ! this . lazyFormatter || force ) && isFunction ( this . formatter ) ) {
138+ if ( this . hasFormatter && ( ! this . lazyFormatter || force ) ) {
136139 value = this . formatter ( value , evt )
137140 }
138141 return value
@@ -151,7 +154,6 @@ export default {
151154 } ,
152155 updateValue ( value , force = false ) {
153156 const lazy = this . lazy
154- const ms = this . computedDebounce
155157 if ( lazy && ! force ) {
156158 return
157159 }
@@ -162,13 +164,28 @@ export default {
162164 this . vModelValue = value
163165 this . $emit ( 'update' , value )
164166 }
165- if ( ms > 0 && ! lazy && ! force ) {
166- // Change/Blur/Force will not be debounced
167- this . $_inputDebounceTimer = setTimeout ( doUpdate , ms )
167+ const debounce = this . computedDebounce
168+ // Only debounce the value update when a value greater than `0`
169+ // is set and we are not in lazy mode or this is a forced update
170+ if ( debounce > 0 && ! lazy && ! force ) {
171+ this . $_inputDebounceTimer = setTimeout ( doUpdate , debounce )
168172 } else {
169173 // Immediately update the v-model
170174 doUpdate ( )
171175 }
176+ } else if ( this . hasFormatter ) {
177+ // When the `vModelValue` hasn't changed but the actual input value
178+ // is out of sync, make sure to change it to the given one
179+ // Usually caused by browser autocomplete and how it triggers the
180+ // change or input event, or depending on the formatter function
181+ // https://github.com/bootstrap-vue/bootstrap-vue/issues/2657
182+ // https://github.com/bootstrap-vue/bootstrap-vue/issues/3498
183+ /* istanbul ignore next: hard to test */
184+ const $input = this . $refs . input
185+ /* istanbul ignore if: hard to test outof sync value */
186+ if ( $input && value !== $input . value ) {
187+ $input . value = value
188+ }
172189 }
173190 } ,
174191 onInput ( evt ) {
0 commit comments