Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

toLocaleString only uses dots and no commas

I tried to localize the numbers in my clockface, but toLocaleString doesn’t work as expected.

Example:

let test = 1000.132;
console.log("Number " + test.toLocaleString("en-US"));
console.log("Number " + test.toLocaleString("de-DE"));

Output:

[7:59:11 PM]       App: Number 1.000.132
[7:59:11 PM]       App: Number 1.000.132

Expected:

[7:59:11 PM]       App: Number 1,000.132                                                                                                   
[7:59:11 PM]       App: Number 1.000,132

 

Is there a bug in toLocaleString or is it not supported (yet)?

Best Answer
0 Votes
2 REPLIES 2

You might only be able to use it without parameters, then it's detected based upon the language. Just switch the language of the simulator and see how it behaves.

Best Answer
0 Votes

Thanks for the reply.

I tried that, but it gives the same result: 1.000.834

Best Answer
0 Votes