Skip to content
This repository was archived by the owner on Apr 2, 2019. It is now read-only.

Decimals and combinations of zeroes seem to break comma formatting #56

Closed
youanden opened this issue Jun 7, 2014 · 6 comments
Closed

Comments

@youanden
Copy link

youanden commented Jun 7, 2014

When working with numbers over 1,000. I honestly can't spot a very discrete pattern. Example 3 shows that you can have three consecutive non-trailing zeroes and still break formatting.

Example 5 shows you can have three consecutive non-trailing zeroes and follow formatting.

If someone hasn't already run into this issue I'm going to try to patch it.

window.odometerOptions = {
    format: '(,ddd).dd'
};

When it doesn't work:

Example $50,520.00:
example 1

Example $9,400.00:
example 2

Example $50,001.00
example 3

When it works:

Example $9,400.01:
example 4

Example $50,000.01:
example 5

Thanks!

@youanden youanden changed the title Decimals and three or more trailing zeroes seems to break comma format Decimals and combinations of zeroes seem to break comma formatting Jun 7, 2014
@zackbloom
Copy link
Contributor

@TrevorBurnham Any chance this is a side-effect of your change?

@TrevorBurnham
Copy link
Contributor

I don't see how it could be, if formatFunction isn't specified. I'll look into it, though.

@TrevorBurnham
Copy link
Contributor

@youanden I'm unable to replicate. Can you provide a simple code example? If, for instance, I edit demo.html to use the format you provided and set the element's HTML to 50001.00, I get

screen shot 2014-06-10 at 4 59 03 pm

So the trailing 0s are cut off (see #45) but the comma pattern is as expected.

@youanden
Copy link
Author

@TrevorBurnham I honestly don't even understand what the source of the problem is... I cannot reproduce the same errors on the project I am working on, and there are no native modifications to the odometer code...

I am not using the latest version, however... I am using @sidonath 's version with the decimal places and formatting...

I've tried the new versions and they end up breaking decimals...

Here is a jsfiddle of the version and assets I am using: http://jsfiddle.net/8x8rQ/

This is what happens when using the latest version: http://jsfiddle.net/8x8rQ/1/

Again, this seems to be somewhat related to the decimal patch, as that is the one where I experienced the problem.

@TrevorBurnham
Copy link
Contributor

And are you seeing this bug in either of those fiddles? In what browser?

@youanden
Copy link
Author

I am seeing neither. I cannot replicate the conditions of the issue I started on either of the fiddles, nor can I replicate the issue on my server anymore as either the issue has fixed itself, or the conditions that brought about the issue cannot be replicated since the numbers and state of the page where the issue originated are transient.

Seeing as that is the case, I guess we can close this issue until or if it arises again.

Thank you @TrevorBurnham and @zackbloom for the prompt assistance.

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

No branches or pull requests

3 participants