Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Custom Currency Symbol #28

Open
marcocavanna opened this issue Jun 8, 2017 · 1 comment
Open

Fix for Custom Currency Symbol #28

marcocavanna opened this issue Jun 8, 2017 · 1 comment

Comments

@marcocavanna
Copy link

marcocavanna commented Jun 8, 2017

Hi,

This is not an Issue but a possible fix for a possible issue 😄

In my Angular App i've got a customizable currency symbol and i use a real time database (Firebase).

In your function 'toFloat' from 'formatAsCurrencyUtilities' you provide a solutions only for Dollar Symbol with the RegEx on line 53.

To Avoid error from this i replaced that line with:

    var matchString = 0;
    if (currencyString) matchString = currencyString.match(/(\d|\.)/g).join('');
    return parseFloat(matchString, 10);

With this you can user any filter, with any currency.

@bcherny
Copy link
Owner

bcherny commented Jun 10, 2017

Hi @marcocavanna! I agree this is a bug, but the solution is a bit more nuanced. Eg. some currency formats use , as the thousands separator and . as the decimals separator, and some are the opposite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants