-
Notifications
You must be signed in to change notification settings - Fork 238
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
Lost zeros using SIWithDigits with 0 decimals 200.0 becomes "2" #106
Comments
Thanks for reporting this. Was kind of egregious. |
Thanks for fixing - I just debugged our issue down to this bug too. |
@dustin Don't you need to add a new tag for us to get this fix? I see there is only v1.0.0 from 2018. |
I just pushed a new tag v1.0.1. Let me know if that works for you. |
Yes, that did the trick |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have noticed that the function humanize.SIWithDigits doesn't handle when the value to be rounded doesn't have any decimals.
Example:
fmt.Printf("20 -> %s\n", humanize.SIWithDigits(20.0, 0, "Unit"))
fmt.Printf("200 -> %s\n", humanize.SIWithDigits(200.0, 0, "Unit"))
Output:
20 -> 2 Unit
200 -> 2 Unit
I think the function stripTrailingZeros needs to check if "." is in the string at all
Workaround for now it to not use 0 decimals
The text was updated successfully, but these errors were encountered: