diff options
Diffstat (limited to 'src/core/utils/formatValue.js')
| -rw-r--r-- | src/core/utils/formatValue.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/utils/formatValue.js b/src/core/utils/formatValue.js index f2c17769..f0f65c69 100644 --- a/src/core/utils/formatValue.js +++ b/src/core/utils/formatValue.js @@ -7,4 +7,13 @@ const sellingProductFormat = (value) => { } } -export { sellingProductFormat } +const formatCurrency = (value) => { + if (value >= 1000) { + const thousands = Math.floor(value / 1000) // Menghitung ribuan + return `Rp${thousands}k` + } else { + return `Rp${value}` + } +} + +export { sellingProductFormat, formatCurrency} |
