Bug 138244 - toLocaleString() doesn't work as it does in Firefox and Chrome
Summary: toLocaleString() doesn't work as it does in Firefox and Chrome
Status: RESOLVED DUPLICATE of bug 77018
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-31 02:16 PDT by Philipp Metzler
Modified: 2014-11-02 21:54 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Metzler 2014-10-31 02:16:32 PDT
parseInt( '1000' ).toLocaleString()
Result in Safari: 1.000
Result in Firefox und Chrome: 1.111

parseFloat( '1000.33' ).toLocaleString()
Result in Safari: 1000.33
Result in FF und Chrome: 1.000,33
Comment 1 Alexey Proskuryakov 2014-11-02 01:00:43 PST
Which locale were you testing under, and how did you set it? From these results, it looks like entirely different locales were used by different browsers.

> Result in Safari: 1.000
> Result in Firefox und Chrome: 1.111

It seems unlikely that values are actually different like this.
Comment 2 Philipp Metzler 2014-11-02 11:24:13 PST
Sorry - there were some typos. It's like this:

As I'm in Austria the browsers should use the de_AT locale.

parseInt( '1000' ).toLocaleString()
Result in Safari: 1000 (the thousands separator is missing)
Result in Firefox und Chrome: 1.000 (correct with thousands separator)

parseFloat( '1000.33' ).toLocaleString()
Result in Safari: 1000.33 (the thousands separator is missing)
Result in FF und Chrome: 1.000,33 (correct with thousands separator and comma as decimal mark)
Comment 3 Philipp Metzler 2014-11-02 11:25:47 PST
Result in Safari: 1000.33 (the thousands separator is missing AND the wrong decimal mark is being used. It's a point instead of a comma.)
Comment 4 Philipp Metzler 2014-11-02 13:23:24 PST
I did not set the locale.
Comment 5 Philipp Metzler 2014-11-02 13:30:11 PST
I'm using OS X with these settings:

language: German
region: Austria

Zahlentrennzeichen:
Gruppierung: .
Dezimal: ,

Safari and Webkit seem to ignore these settings.
Comment 6 Alexey Proskuryakov 2014-11-02 21:54:59 PST
Ugh, I somehow didn't realize that Number.toLocaleString does not take locale into consideration at all in WebKit :(

*** This bug has been marked as a duplicate of bug 77018 ***