Saltar al contenido principal

Function: useFormatCurrency()

useFormatCurrency(options): string

Defined in: src/core/services/formatter.service.ts:108

Pure: formats an amount as currency.

taxes accepts either a percentage (21 → 21%) or a decimal fraction (0.21 → 21%). Values > 1 are treated as percentages; values in (0, 1] as fractions. Prefer an explicit fraction when you need a rate ≤ 1%.

Parameters

options

CurrencyFormatOptions

Currency formatting options.

Returns

string

The formatted currency string.

Example

import { useFormatCurrency } from "katanakit-js";

useFormatCurrency({ amount: 100, currency: "USD" }); // "$100.00"
useFormatCurrency({ amount: 100, taxes: 21 }); // "$121.00"
useFormatCurrency({ amount: 100, taxes: 0.21, locale: "es" }); // "121,00 €"