-
Notifications
You must be signed in to change notification settings - Fork 925
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
Max/Min length padding #43
Comments
Is this what you're trying to do? Appending more 0's will pad a number. numeral(12).format("$00.00")
-> "$12.00"
numeral(12).format("00.00%")
-> "1200.00%" |
No, that is not what I'm trying to do at least if I can recall properly, considering the issue is 10 months old. What I may have been trying to do this: numeral(.1).format('0.0%')
-> '10.0%'
numeral(.01).format('0.0%')
-> '1.0%' What I want is the character count between those two to be exactly the same, ie 10.0% and 1.00%. It helps make displaying them in a list look much cleaner and consistent. If you add an extra 0 it'll differ the two results. Obviously |
I don't think I've ever seen this used - are there other UIs have you seen that pad numbers in this way? |
Yes, I have seen UIs do this that don't want a zig zag look on their tables. http://josscrowcroft.github.io/accounting.js/ supports something like this via formatColumn, but chooses to implement it in a different fashion. |
Done |
Currently there isn't anyway to easily pad a number. For instance if I want my percentages to be at least 3 numbers, so that they are all roughly the same length, there isn't a way to do that easily.
'0.0%'
will result in xx.x% and x.x%.The text was updated successfully, but these errors were encountered: