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

Replace numeral with numbro (or another alternative) #3551

Open
kravets-levko opened this issue Mar 7, 2019 · 6 comments
Open

Replace numeral with numbro (or another alternative) #3551

kravets-levko opened this issue Mar 7, 2019 · 6 comments

Comments

@kravets-levko
Copy link
Collaborator

We use numeral package to format numbers in visualizations (and probably in some other places), but it wasn't updated for a quite long time, and seems it's owner don't plan to improve it. But sometimes we need features not supported by numeral - say, using escape sequences in format string.

There are other libraries similar to numeral which are more actively maintained, like numbro - which supports similar format syntax and can use escape sequences. numbro is my suggestion, however, some another library could be used as well (if it supports the same format syntax and escape sequences - in fact we don't use all that number manipulation stuff, only formatting).

@kravets-levko
Copy link
Collaborator Author

Added "Feature request" label because technically we need to replace the library in order to use new features (escape sequences in format string)

@morsedl
Copy link

morsedl commented May 10, 2019

+1

@rcoup
Copy link

rcoup commented May 28, 2019

https://discuss.redash.io/t/other-currency-types-in-tables/3356/4 links here to point out '£' doesn't work as a currency symbol.

Numbro's approach for currency formatting seems weird to me: if you call .formatCurrency() and your language is set to Japanese, it'll show ¥, but that makes the enormous assumption people only ever want to use their "local" currency in queries? Simpler: allow locale-based number formatting, but let the user put the appropriate currency symbol in the correct place? (eg. '£ 0.00')

@kravets-levko
Copy link
Collaborator Author

@rcoup The idea is not to use currency formatting abilities provided by numeral/numbro at all, instead letting user to just add arbitrary characters in format string(e.g. 0[.00] {USD}). This will allow to use different currency signs at any position, which is more flexible.

@vvohra87
Copy link

Any update on when this will be sorted out?

@zhongjiajie
Copy link
Collaborator

I'm not familiar with our codebase, but I find numeral key word in repo, https://github.com/getredash/redash/search?q=numeral&type=Code and only 5 match. So the point is numbro not 100% compatible with numeral?

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

5 participants