Add byjoveCurrency
filter
This commit is contained in:
parent
0ceabeb53f
commit
985860732d
|
@ -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)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue