Move NaN/empty string check to formatDollars
This commit is contained in:
parent
bf68ba6621
commit
1cc3328729
@ -85,9 +85,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onBlur: function(e) {
|
onBlur: function(e) {
|
||||||
if (this.validation === 'dollars' && this.value === '$NaN') {
|
|
||||||
this.value = this.initialValue
|
|
||||||
}
|
|
||||||
this._checkIfValid({ value: e.target.value, invalidate: true })
|
this._checkIfValid({ value: e.target.value, invalidate: true })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ export const formatDollars = (value, cents = true) => {
|
|||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
})
|
})
|
||||||
} else if (typeof value === 'string') {
|
} else if (typeof value === 'string') {
|
||||||
|
if (value === '') {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
return parseFloat(value).toLocaleString('us-US', {
|
return parseFloat(value).toLocaleString('us-US', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user