迁移 formatMoney 和 formatPercent 到 unify
This commit is contained in:
parent
5ac4164173
commit
6610549a00
8
index.js
8
index.js
@ -93,6 +93,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
formatMoney(value, decimal){
|
||||||
|
return Number(value).toFixed(decimal||2)
|
||||||
|
},
|
||||||
|
|
||||||
|
formatPercent(value, decimal){
|
||||||
|
return `${Number(value*100).toFixed(decimal||2)}%`
|
||||||
|
},
|
||||||
|
|
||||||
formatDate(date, format){
|
formatDate(date, format){
|
||||||
if (!(date instanceof Date)){
|
if (!(date instanceof Date)){
|
||||||
date = new Date(date)
|
date = new Date(date)
|
||||||
|
Loading…
Reference in New Issue
Block a user