question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple currencies are not supported

See original GitHub issue

Numeral-js currently has locality and currency coupled together.

It assumes that if I speak a particular language, that I want all of my Numeral objects to be my native currency in my language’s format.

In reality, I want to have many Numeral objects of varying currencies displayed to me in my language’s format:

> numeral.language();
"en"
> numeral(1000.23).format('$0,0.00 C'); // defaults to 'USD' because of locality
"$1,000.23 USD"
> numeral(1000.23, 'CAD').format('$0,0.00');
"$1,000.23"
> numeral(1000.23, 'EUR').format('$0,0.00');
"€1,000.23"
> numeral(1000.23, 'EUR').format('0,0.00 C');
"1,000.23 EUR"

> numeral.language('fr');
> numeral(1000.23).format('$0,0.00'); // defaults to 'EUR' because of locality
"€1 000,23"
> numeral(1000.23, 'USD').format('$0,0.00');
"$1 000,23"
> numeral(1000.23, 'USD').format('$0,0.00 C');
"$1 000,23 USD" 
> numeral(1000.23, 'CAD').format('$0,0.00');
"$1 000,23"
> numeral(1000.23, 'EUR').format('$0,0.00');
"€1 000,23"
> numeral(1000.23, 'EUR').format('0,0.00 C');
"1 000,23 EUR"

Essentially my language setting should dictate format, and currency should dictate the symbol.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:8
  • Comments:14

github_iconTop GitHub Comments

3reactions
AlexSwensencommented, Dec 8, 2017

Formatting for users locale didn’t meet our requirement (needed to show different formatting simultaneously.)

We ended up rolling our own currency formatting solution. It’s pretty simple really.

2reactions
cythrawllcommented, Jan 31, 2018

We are in the same boat, using locale to switch currency symbol is such an odd behavior. We have a need to show multiple currencies on the same page. It absolutely should not be switched by user’s locale. We had to use another formatting solution which is unfortunate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling your store to sell in multiple currencies
Shopify supports two currency values (store and customer) instead of one, to sell in multiple currencies. On this page. Steps to enable selling...
Read more >
Considerations for Enabling Multiple Currencies
If multiple currencies is enabled, field-to-field filters in reports don't support currency fields, like amount. Upon enablement, existing records are ...
Read more >
Why should you implement Multi-Currency Support for your ...
3 Reasons to Implement Multi-Currency Pricing · #1. Multiple Currency Support Allows You To Take Advantage Of Psychological Pricing · #2.
Read more >
Which Currencies Does Authorize.net Support?
Answer ; United States, Canada, USD, CAD, https://www.authorize.net/ ; United Kingdom, Europe, CHF, DKK, EUR, GBP, NOK, PLN, SEK, USD, Please ...
Read more >
Offer apps, in-app products, and subscriptions in multiple ...
If you make an app available in a location that supports a local currency, Google Play ... your subscription will not be made...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found