summaryrefslogtreecommitdiff
path: root/src/core/utils/currencyFormat.js
blob: d0eba4c43a9bc0ecb3c7eebd649ede2af07282b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
 * Formats a numeric value as a currency string in Indonesian Rupiah (IDR) format.
 *
 * @param {number} value - The numeric value to be formatted as currency.
 * @returns {string} - The currency string in IDR format.
 */
const currencyFormat = (value) => {
  const currency = new Intl.NumberFormat('id-ID', {
    style: 'currency',
    currency: 'IDR',
    maximumFractionDigits: 0
  })
  return currency.format(value)
}

export default currencyFormat