jquery/globalize — Issue #73: Globalize.parseFloat some doubts !?!
Author: Tuinel
Created: 2011-10-19 21:41:17+00:00
State: open

I made some tests and i think is stm wrong with Globalize.parseFloat. Look code below:

Globalize.culture("pl");

//console.log(Globalize.culture.name)
// test the "n" command
console.log(Globalize.format(1839.560, "n1")); // outputs 1.839,6
console.log(Globalize.format(1839.560, "n0")); // outputs 1.840
console.log(Globalize.format(1839.560, "n6")); // outputs 1.839,560000

// test the "c" command
console.log(Globalize.format(1839.560, "c2")); // outputs 1.839,56 €
console.log(Globalize.format(1839.560, "c3")); // outputs 1.839,560 €
console.log(Globalize.format(1839.560, "c6")); // outputs 1.839,560000 €

// assuming a culture with "/" as the date separator symbol
console.log(Globalize.format(new Date(1955, 10, 5)), "yyyy/MM/dd"); // "1955/11/05"
console.log(Globalize.format(new Date(1955, 10, 5)), "dddd MMMM d, yyyy"); // "Saturday November 5, 1955"

// assuming a culture where "," is the group separator
// and "." is the decimal separator
console.log(Globalize.parseInt(Globalize.format(1839.560, "n3"))); // 1234
// assuming a culture where "." is the group separator
// and "," is the decimal separator
console.log(Globalize.parseInt("1234,56")); // 1234

// assuming a culture where "," is the group separator
// and "," is the decimal separator
console.log(Globalize.parseFloat("1839,560")); // 1234.56
// assuming a culture where "." is the group separator
// and "." is the decimal separator
console.log(Globalize.parseFloat("1234.56")); // 1234.56

and all is fine excepts Parse float which return always the same values with '.' instead of ',' .

here is console log:

Dziennik: 1 839,6
Dziennik: 1 840
Dziennik: 1 839,560000
Dziennik: 1 839,56 zł
Dziennik: 1 839,560 zł
Dziennik: 1 839,560000 zł
Dziennik: 5 listopada 1955 00:00:00yyyy/MM/dd
Dziennik: 5 listopada 1955 00:00:00dddd MMMM d, yyyy
Dziennik: 1839
Dziennik: 1234
Dziennik: 1839.56
Dziennik: 1234.56

Maybe I do sth wrong ?