# Fix currency format showing the wrong symbol with Intl.NumberFormat

## TL;DR

The currency code or the display option is off, so set both explicitly. Intl.NumberFormat picks the symbol from the currency code plus the locale, and currencyDisplay controls symbol vs code vs name. Pass the ISO code you mean and the display style you want, then the symbol follows.

## The error

```text
Intl.NumberFormat('de-DE', {style:'currency', currency:'USD'}) shows "$" where "US$" expected
or the wrong currency entirely when the code is mistyped
```

## Fix it

### Step 1: Print what the formatter resolves

```bash
node -e "console.log(new Intl.NumberFormat('de-DE',{style:'currency',currency:'USD'}).format(9.99))"
```

Expected: You see exactly what symbol the current options produce.

### Step 2: Fix the currency code

```bash
node -e "console.log('codes are ISO 4217 uppercase: USD, EUR, JPY -- a typo like USDD silently misbehaves')"
```

Expected: The code is a real ISO code.

### Step 3: Choose the display style deliberately

```bash
node -e "for(const d of ['symbol','narrowSymbol','code','name']) console.log(d, new Intl.NumberFormat('de-DE',{style:'currency',currency:'USD',currencyDisplay:d}).format(9.99))"
```

Expected: You see symbol vs code vs name and pick the right one.

### Step 4: Confirm in the target locale

```bash
node -e "console.log(new Intl.NumberFormat('en-US',{style:'currency',currency:'EUR',currencyDisplay:'code'}).format(9.99))"
```

Expected: The output matches the design spec.

## When to use this

- Currency shows the wrong symbol or code
- The symbol is ambiguous like $ for the wrong dollar

## When NOT to use this

- The amount is wrong, that is a data issue not formatting
- You need crypto or custom tokens, Intl only knows ISO 4217

## Tool and version compatibility

- Intl.NumberFormat with style currency
- ISO 4217 currency codes, BCP47 locales

## Variant phrasings

### narrowSymbol still ambiguous

narrowSymbol drops disambiguation by design. Use symbol or code when several currencies share a sign.

### JPY shows decimals

Some locales add fraction digits wrongly for zero-decimal currencies. Set minimumFractionDigits: 0 explicitly.

## Why it happens

The symbol comes from CLDR data keyed by currency code and locale, and the display option picks which form. A wrong code, or symbol when you needed code, produces a technically valid but wrong-looking result.

## Edge cases

- Currency codes are case sensitive in practice, always uppercase
- Accounting formats use currencySign: 'accounting' for parentheses negatives
- Test with the locales you ship, symbol choice is per locale

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_uH1FWS9kSdlLbTp6qDMbLg
