atst/js/components/totals_box.js
montana d80d8210f9 Handle NaN in obligated amount input properly
- there is some hackiness to the text input portion
2019-06-19 10:42:17 -04:00

27 lines
517 B
JavaScript

import { formatDollars } from '../lib/dollars'
export default {
name: 'totalsbox',
props: {
name: String,
obligated: Number,
contractAmount: Number,
},
computed: {
formattedObligated: function() {
return formatDollars(this._filterNaN(this.obligated))
},
formattedContractAmount: function() {
return formatDollars(this._filterNaN(this.contractAmount))
},
},
methods: {
_filterNaN: function(value) {
return Number.isNaN(value) ? 0 : value
},
},
}