Handle NaN in obligated amount input properly

- there is some hackiness to the text input portion
This commit is contained in:
montana 2019-06-18 14:57:38 -04:00
parent c0da5d482f
commit d80d8210f9
2 changed files with 10 additions and 3 deletions

View File

@ -103,7 +103,8 @@ export default {
this.value = e.target.value.trim()
if (this.validation === 'dollars') {
this.value = formatDollars(this._rawValue(e.target.value))
let value = Number.isNaN(e.target.value) ? '0' : e.target.value
this.value = formatDollars(this._rawValue(value))
}
},

View File

@ -11,10 +11,16 @@ export default {
computed: {
formattedObligated: function() {
return formatDollars(this.obligated)
return formatDollars(this._filterNaN(this.obligated))
},
formattedContractAmount: function() {
return formatDollars(this.contractAmount)
return formatDollars(this._filterNaN(this.contractAmount))
},
},
methods: {
_filterNaN: function(value) {
return Number.isNaN(value) ? 0 : value
},
},
}