Add byjoveCurrency filter

This commit is contained in:
Lance Edgar 2020-03-20 13:52:16 -05:00
parent 0ceabeb53f
commit 985860732d

View file

@ -37,4 +37,17 @@ export function ByjovePlugin(Vue) {
},
}
})
Vue.filter('byjoveCurrency', function (value) {
if (typeof value !== 'number') {
return value
}
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
// TODO: make this configurable?
minimumFractionDigits: 2,
})
return formatter.format(value)
})
}