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

Setting decimals to zero still shows a decimal point and digit #34

Open
ModernHooman opened this issue Apr 26, 2022 · 7 comments
Open

Comments

@ModernHooman
Copy link

An strange behavior here is when you set currency symbol which I prefer to use a + sign and setting 0 for decimals, still you see a decimal point and a digit after it. Even in the documentation it's clearly obvious that it prints the result like $9.0k.

What I'm wondering is that, is it zero decimals mean a digit after decimal point?

@rzlnhd
Copy link
Contributor

rzlnhd commented May 1, 2022

@hooman-limouee Ah yes, maybe the problem is on this line.

limit = config.decimals || 1, // Set the decimal limit (default is 1)

setting the decimals to 0 will not possible because of this line. I'll find another way to fix this issue... thanks for your report.

@srexi
Copy link
Owner

srexi commented May 1, 2022

An strange behavior here is when you set currency symbol which I prefer to use a + sign and setting 0 for decimals, still you see a decimal point and a digit after it. Even in the documentation it's clearly obvious that it prints the result like $9.0k.

What I'm wondering is that, is it zero decimals mean a digit after decimal point?

Can you please show me how you're setting the decimal to 0?

@rzlnhd
Copy link
Contributor

rzlnhd commented May 1, 2022

@srexi the decimals will never possible to set to 0 on filesizing or currency for now, but it will be normal other than that.

edit: jsfiddle test

@rasselmrh
Copy link

I'm looking for setting up floating point number a counter value, such as 0.84 . , 10.34 without any currency or file size . Is there any option ? I couldn't find anything.

@rzlnhd
Copy link
Contributor

rzlnhd commented Jun 26, 2022

@rasselmrh You can just intialize specific new PureCouter() with specific classId, and just add start and end value for your counter. Then set decimals to 2 (because you want 2 number behind the comma). Here!

Or, you can set the value on data-purecounter-start, data-purecounter-end attribute of your element, and set data-purecounter-decimals to 2. Here!

For decimals or float value, use period/dots . instead of comma ,.

@enetc
Copy link

enetc commented Sep 12, 2022

using purecounter_vanilla.js. I have a weird issue when using value 999.9999 below it will output 999999 missing the point but when using a thousand(8200.2055.) value with decimal works fine but output will be 8200.2055

@Chungmire
Copy link

Custom initialization doesn't help. For example, I'm using the number "90.5" but it just displays as "905" with 1 decimal and as "91" with 0.

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

No branches or pull requests

6 participants