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

Convertion from Lire to Euro with custom format #11

Closed
GoogleCodeExporter opened this issue Jan 29, 2016 · 2 comments
Closed

Convertion from Lire to Euro with custom format #11

GoogleCodeExporter opened this issue Jan 29, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Fill a "lire" input with the value of a "euro" input (two textbox).
2. txtEuro is $("#txtEuro") and txtLire is $("#txtLire")
3. I use this:    

    function calculateLire(txtEuro, txtLire) {
        var euro = $(txtEuro).parse({ locale: "it" });

        if (euro == 0) {
            $(txtLire).val(0);
        }
        else {
            $(txtLire).val((euro * 1936.27));
// at this point txtLire contain a correct value ("us" formatted)
            $(txtLire).format({ format: "#.000", locale: "it" });
        }  
    }


Locale "it" have dec="," , group="." like "de"

What is the expected output? What do you see instead?
with "1" in txtEuro I have 193627,000.
Correct string is 1936,270 .
I also try this trick:
            $(txtLire).format({ format: "#.000", locale: "us" });
            $(txtLire).format({ format: "#.000", locale: "de" });
but not does what I want...

How can I use this plugin for obtain the right result?

What version of the product are you using? On what operating system?
version 1.1.2  (on  Windows XP, Firefox and Maxthon)

Please provide any additional information below.
I think the problem is on format function:
                // now we need to convert it into a number
                while (text.indexOf(group) > -1)
                    text = text.replace(group, '');

the number 1936.27 become 193627 here...

bye
Alessandro

Original issue reported on code.google.com by alessandro.piccione.75 on 23 Jun 2009 at 11:05

@GoogleCodeExporter
Copy link
Author

I make this change in format function, and it works for me:

                /// CHANGE (Alessandro): this code treat string like a formatted 
one, but I WANT to format an unformatted one
                // now we need to convert it into a number
                //                while (text.indexOf(group) > -1)
                //                    text = text.replace(group, '');
                //                var number = new Number(text.replace
(dec, ".").replace(neg, "-"));

                //while (text.indexOf(group) > -1)
                //    text = text.replace(group, '');
                //var number = new Number(text.replace(dec, ".").replace(neg, "-"));

                var number = new Number(text);

Alessandro

Original comment by alessandro.piccione.75 on 23 Jun 2009 at 11:24

@GoogleCodeExporter
Copy link
Author

Issue seems to have been resolved with next release (1.2 - due soon).

Original comment by apar...@gmail.com on 5 Feb 2010 at 7:01

  • Changed state: Fixed

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

1 participant