summaryrefslogtreecommitdiff
path: root/storefront/lib/format.js
blob: 9e92a8b66f605b88cb77c3a72d4fb0bf419c52e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
export const formatAmount = (amount, currencyCode = "EUR") => {
  if (typeof amount !== "number") {
    return ""
  }

  const normalizedCurrency = currencyCode.toUpperCase()
  return new Intl.NumberFormat("fr-FR", {
    style: "currency",
    currency: normalizedCurrency,
  }).format(amount / 100)
}