Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Intl not available" in Edge 15

I'm seeing an Intl not available error in the JS console when my script runs the following code in Edge 15:

new Date().toLocaleDateString()

I'm a bit stumped by this. It is working just fine in Edge 14, and I can't find any reference to the internationalization API suddenly disappearing from Edge 15.

I'm not sure if this is the proper way to test it, but running window.hasOwnProperty("Intl") in the console actually returns true. To me this seems to indicate that Intl actually is there.

Anyone with more JS skills able to tell what is really going on here?

like image 993
rogerkk Avatar asked Jun 01 '17 09:06

rogerkk


2 Answers

Make sure your JS code doesn't redefine standard Map class.

We had almost the same problem, but with Intl.Collator object instead. We couldn't use String.prototype.localeCompare("...", "locale") because of this.

You can look at this codepen in Edge 15 and in other browsers for explanation: https://codepen.io/kgorob/pen/pweaWV.

P.S. I'm not sure your problem is because of Map class specifically, maybe it's some other standard JS class you are re-defining.

like image 184
Kirill Gorobets Avatar answered Nov 19 '22 17:11

Kirill Gorobets


The problem is because of these lines in Chakracore code. Intl.js is javascript file that is used internally to perform various internationalization specific operations. Since Mapis used, over-writing it before Intl.js code executes (it is executed lazily), causes problem. This should be addressed soon.

like image 1
ksp Avatar answered Nov 19 '22 18:11

ksp