Last active
August 17, 2021 22:17
-
-
Save b4n92uid/d5da2fb4aa86ca15efb638f27c6eec93 to your computer and use it in GitHub Desktop.
[Vue] CurrencyMixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import currency from "currency.js"; | |
function formatCurrency(value, formatWithSymbol = true) { | |
return currency(value, { | |
symbol: "DA", | |
pattern: "# !", | |
formatWithSymbol, | |
separator: " ", | |
decimal: ",", | |
precision: 0, | |
}).format(); | |
} | |
export default { | |
methods: { | |
formatCurrency, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment