ecmascript-intl

Invalid time zone specified: US/Alaska, US/Arizona, US/Mountain, US/Central etc error in Chrome but working in Mozilla

房东的猫 提交于 2020-06-09 07:09:27
问题 I am trying to convert timestamp in to various time zone's local time and found certain TimeZone are not supporting in Chrome (v76.0.38) but working fine in Mozilla (v68.0.2). let d = new Date(1567083463); let n = d.toLocaleString('en-GB', { timeZone: "US/Arizona" }); Uncaught RangeError: Invalid time zone specified: US/Arizona at Date.toLocaleString () Several other timezones are also throwing the same error US/Alaska US/Mountain US/Central US/East-Indiana These timezones are officially

How to see what locales a given Node.js version supports and how to enable missing locales?

倾然丶 夕夏残阳落幕 提交于 2020-01-25 03:25:28
问题 My Node.js version on Windows 8.1 is: $ node -v v5.3.0 But it seems it doesn't support locale identification and negotiation. I mean the support of ECMAScript Internationalization API. Only en locale is supported. Here is an example in a browser and in Node.js. In a browser a locale is identified just fine: // en > Intl.NumberFormat('en', {currency: 'USD', style:"currency"}).format(300) > "$300.00" // ru > Intl.NumberFormat('ru', {currency: 'USD', style:"currency"}).format(300) > "300,00 $"

Intl is not defined firefox

醉酒当歌 提交于 2020-01-04 03:43:14
问题 I have following java scripts code which runing well in chrome but fail in firefox and IE. the error message of FF is 'ReferenceError: Intl is not defined' the error message of IE is 'SCRIPT5009: 'Intl' is undefined ' <script> var co = new Intl.Collator('pinyin'); console.log(co); var co = new Intl.Collator('zh-Hans'); console.log(co); var co = new Intl.Collator('zh-Hans-CN'); console.log(co); </script> I just wonder why the standard object Intl can't be refer in FF or IE? did I miss

Intl is not defined firefox

时间秒杀一切 提交于 2020-01-04 03:41:10
问题 I have following java scripts code which runing well in chrome but fail in firefox and IE. the error message of FF is 'ReferenceError: Intl is not defined' the error message of IE is 'SCRIPT5009: 'Intl' is undefined ' <script> var co = new Intl.Collator('pinyin'); console.log(co); var co = new Intl.Collator('zh-Hans'); console.log(co); var co = new Intl.Collator('zh-Hans-CN'); console.log(co); </script> I just wonder why the standard object Intl can't be refer in FF or IE? did I miss

“Intl not available” in Edge 15

♀尐吖头ヾ 提交于 2019-12-22 03:53:14
问题 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.

ECMAScript Internationalization API with node

僤鯓⒐⒋嵵緔 提交于 2019-12-20 03:39:13
问题 Is there a way to use the ECMAScript Internationalization API with nodejs? For now, i only need the timezone support: new Date().toLocaleString("en-US", {timeZone: "America/New_York"}) which works very well with chrome, but not with node. Are there any options like --harmony to activate it? 回答1: Internationalization is turned off in v8 when built for node.js. The reason is that the library that provides it significantly increases the size of the node binary for a small perceived gain. You can

Chrome timeZone option to Date.toLocaleString()

◇◆丶佛笑我妖孽 提交于 2019-12-18 10:20:43
问题 I have recently discovered that there is a new extension to JavaScript. This adds several features to the Date object in the toLocaleString , toLocaleDateString and toLocaleTimeString functions. Reference here. I am particularly interested in the timeZone option, that supports IANA/Olson time zones, such as America/New_York or Europe/London . This is currently only supported in Google Chrome . Previous advice was that to work in JavaScript with any other time zone than UTC or your own local

Understanding Intl.DateTimeFormat as a JavaScript object

此生再无相见时 提交于 2019-12-12 18:08:52
问题 I do not understand the behavior of Intl.DateTimeFormat . It does not expose the behavior I would expect from a JavaScript object. I would like to understand why? The following snippet demonstrates that the format method on DateTimeFormat can't be overridden. How is this possible? const itDateTimeFormat1 = new window.Intl.DateTimeFormat('it-CH'); const originalFormat = itDateTimeFormat1.format; itDateTimeFormat1.format = function(date){ return 'Overriden! ' + originalFormat(date)}; console

What is the relation between Number.prototype.toLocaleString() and Intl.NumberFormat.prototype.format?

那年仲夏 提交于 2019-12-11 00:32:29
问题 We are trying to use localization support in our application and looking at the toLocaleString() . We also had a look at Intl.NumberFormat and its format method. Do they have any relation? Which one is better to use? 回答1: From MDN docs for Number.prototype.toLocaleString(): When formatting large numbers of numbers, it is better to create a NumberFormat object and use the function provided by its NumberFormat.format property. In most cases you can use Number.prototype.toLocaleString() . It's

Javascript Internationalization API is not supported by PhantomJS

◇◆丶佛笑我妖孽 提交于 2019-12-08 15:48:52
问题 I have series of Jasmine tests running against an AngularJs service that uses ECMAScript Internationalization API. They all run successfully when I run them through Chrome. However, when I use PhantomJS to run them through maven, they all fail as it seems PhantomJs does not support Internationalization API yet. The error message I get for the tests using Intl object is : 1: ReferenceError: Can't find variable: Intl in localizationService.js And the rest of the tests just fail. The tests are