Intl.NumberFormat()

Hello Guys,

Any idea why this object “Intl.NumberFormat()” is not being recognized by the editor?

THIS IS WHAT I’M DOING:
var Formatter = new Intl.NumberFormat(“en-US”, {style: “currency”, currency: “USD”, minimumFractionDigits: 2, maximumFractionDigits: 2});
Formatter.format(MyNumber);

This object is part of the Internationalization API of Javascript.
Are we limited to use just certain Javascript resources with WixCode?

Any Idea?
-Luigi

By the way, when I run this code in the JavaScript Playground, it works just fine. But it won’t let me do it in the Editor.

This is weird!.. Even though there is a BIG red dot at the beginning of the line saying that “INTL” is not recognized… The function works perfectly. GO FIGURE!

Hi Luigino, it looks like we’re missing code completion in the code editor for the Internationalization API.
I’ll open a bug on it, thanks for letting us know :slight_smile:

Hi,

I want to use the formatter for decimal numbers. works great exept the digits

var Temperatur = new Intl.NumberFormat(“de-DE”, {style: “decimal”, minimumFractionDigits: 1, maximumFractionDigits: 1}).format(wetterStatusMain.temp);

it doesn’t change the digits

same with this line:
var Temperatur = new Intl.NumberFormat(“de-DE”, {style: “decimal”, minimumFractionDigits: “1”, maximumFractionDigits: “1”}).format(wetterStatusMain.temp);

can you help me a bit?

Yours
Thomas