globalizejs / globalizejs/globalize

Error E_MISSING_CLDR with Globalize.currencyFormatter

Open
#948 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.8k
Forks
585
PR merge metrics
No merged PRs in 30d

Description

### Issue: Error E_MISSING_CLDR with Globalize.currencyFormatter

#### Description
The `Globalize.currencyFormatter` function is throwing an `E_MISSING_CLDR` error when using `Globalize.formatCurrencyToParts` with certain currencies like BGN (Bulgarian Lev). This issue arises because the new CLDR version does not include symbols for currencies that traditionally do not have symbols.

#### Error Details
When calling `Globalize.formatCurrencyToParts(23.50, 'BGN');`, the error message is:
```
Error: E_MISSING_CLDR: Missing required CLDR content `main/en-US/numbers/currencies/BGN/symbol`.
```

#### Background
Previous versions of CLDR provided a default symbol for every currency, regardless of whether it had a symbol in practice. For example, BGN previously had 'BGN' as its symbol in the CLDR, but this is no longer the case in the newer versions.

#### Questions
- **Are you facing this issue as well?**
- **Is there any known workaround?**
- **Can we pass a default symbol when calling the function to mitigate this issue?**

#### Proposed Solution
Actually I am using this function in a function that is in used at 1000s of places so do not want to add the fix that can have bigger impact and can open testing

Globalize.js - Version 1.7.0
CLDR JavaScript Library v0.5.3 2020-08-05T21:43Z @rxaviers

Your insights and suggestions on this matter would be greatly appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.