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) {
|
||||
if (this.validation === 'dollars' && this.value === '$NaN') {
|
||||
this.value = this.initialValue
|
||||
}
|
||||
this._checkIfValid({ value: e.target.value, invalidate: true })
|
||||
},
|
||||
|
||||
|
@ -5,6 +5,10 @@ export const formatDollars = (value, cents = true) => {
|
||||
currency: 'USD',
|
||||
})
|
||||
} else if (typeof value === 'string') {
|
||||
if (value === '') {
|
||||
return value
|
||||
}
|
||||
|
||||
return parseFloat(value).toLocaleString('us-US', {
|
||||
style: 'currency',
|
||||
currency: 'USD',
|
||||
|
Loading…
x
Reference in New Issue
Block a user