Using a 'fr' instance of Langauge, if you run parseFormattedNumber('12,') the output you get is 12. (see example)
What is going on is that Language see the comma character, assumes it is a decimal character (French uses comma, English uses period aka the decimal "point") and therefore, consumes it and replaces it with a decimal point.
This should only happen if there is a digit after the comma. "12,3" should be interpretted as "12.3" but "12," should remain untouched.