jquery/globalize — Issue #85: parseFloat accepts dot even if its not part of culture
Author: AndersMalmgren
Created: 2011-12-14 09:46:57+00:00
State: open

Hi.
Consider the text string "5.5", even if dot is not a seperator in the current culture the parseFloat will parse "5.5" into 5.5
I override the parseFloat and did this, maybe you guys can incorporate it into your code

var orgParseFloat = Globalize.parseFloat;
Globalize.parseFloat = function(value) {
var culture = this.findClosestCulture();
var seperatorFound = false;
for(var i in culture.numberFormat) {
if(culture.numberFormat[i] == ".") {
seperatorFound = true;
}
}

if(!seperatorFound) {
value = value.replace(".", "NaN");
}

return $.proxy(orgParseFloat, this)(value);
};