Error message encountered in Chrome due to an incorrect time zone specified such as US/Alaska, US/Arizona, and US/Mountain, while the issue does not occur in Mozilla

While attempting to convert a timestamp into various time zones, I discovered that some TimeZones are not supported in Chrome (v76.0.38) but work well in Mozilla (v68.0.2).

  let d = new Date(1567083463);
  let n = d.toLocaleString('en-GB', { timeZone: "US/Arizona" });  

An error occurs with message - Uncaught RangeError: Invalid time zone specified: US/Arizona

This error is observed in various other timezones as well:

US/Alaska US/Mountain US/Central US/East-Indiana

Answer №1

The information provided on that specific page pertains to the time zones supported by a different google product, not Chrome.

For more details, you can refer to MDN's documentation regarding the toLocaleString function:

timeZone
This parameter specifies the time zone to be utilized. The only recognized value is "UTC", with implementations defaulting to the runtime's default time zone. Some implementations may also acknowledge the time zone names from the IANA time zone database such as "Asia/Shanghai", "Asia/Kolkata", and "America/New_York".

You can discover valid time zones at the specified IANA link, or alternatively, peruse through the list of tz database time zones available on Wikipedia for reference. Notably, all time zones starting with "US/*" are considered deprecated. It is recommended to utilize Canonical entries directly from the Wikipedia page, including but not limited to:

  • America/New_York
  • America/Denver
  • America/Chicago

And so forth.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Express middleware for handling errors with Node.js router

My application structure is laid out as follows: - app.js - routes ---- index.js The ExpressJS app sets up error handlers for both development and production environments. Here's a snippet from the app.js file: app.use('/', routes); // ro ...

Aggregate the properties of objects in an array into a single object using Lodash

I've been struggling to figure this out on my own, so I decided to seek advice from those with more experience. I have an array of objects called items, and I need to sum up specific properties across different objects in the array. The user can selec ...

The use of an import statement outside a module in the /node_modules directory is prohibited

As I embark on migrating some node packages, I find myself facing a significant challenge. Here is the current state of my package.json file: { //These are the updated dependencies and Jest configurations "dependencies": { "@google-cloud/logging-w ...

I'm having trouble setting up Stripe Elements in PHP. It seems like there's a communication issue between my PHP code and my JS

New to setting up Stripe Elements, I've followed the documentation closely. Installed the necessary JS modules, included the Stripe API, and connected it to the Stripe JS. In my index.php file, PHP script is at the top with HTML and JavaScript below i ...

Troubleshooting Problem with Custom Class Buttons in Angular Material

Recently, I've been working on creating a custom class for angular material buttons. However, I encountered an issue where the button fades out or turns white when I click on it and then navigate away from the browser window (minimize it or activate a ...

Enhance the appearance and format of white space in JavaScript code

I'm in search of a solution to automatically beautify whitespace in my JavaScript code. I have come across tools like JSLint and JSHint that can check for indentation and trailing spaces, but they might not cover all types of whitespace issues. My ch ...

The personalized directive does not respond to modifications in attributes

I am in the process of creating a modal directive that will be used to display data tables. The directive has an attribute called modal-visible, which is initially set to false by default. If this value is true, the modal will be visible when loaded. Howev ...

Tick the checkboxes that are not disabled, and leave the disabled ones unchecked

Currently, I am employing Jquery for the purpose of checking and unchecking checkboxes. However, some of these boxes are disabled, thus there is no need for them to be checked. Is there a method by which I can instruct the script to disregard disabled che ...

Generate pre-set components using fundamental building blocks

Can I predefine some props for components? In my Vuetify example, let's say I want to customize the v-btn component with specific props. This custom implementation would act as a child component while still providing all the functionalities of the par ...

Fetching specific information from MySQL using EJS

Check out the Github project here Currently, I am in the process of developing a Quiz creation application using EJS as the templating engine along with jQuery, Bootstrap, and MySql. I have encountered a challenge where I am trying to display the corresp ...

Issues with navigating routes in AngularJS

I'm currently learning Angular and having trouble with my routing setup in my application. I have a complex structure of nested modules, which makes me believe the issue lies within the injections. If anyone could provide some guidance, it would great ...

Angular = encountering an incorrect array size limitation

I am encountering an issue with the function in my controller... $scope.pagerPages = function (n) { var i = Math.ceil(n); return new Array(i); } The n value is derived from an expression on the view and can sometimes be a fraction. This is why I ...

Is it possible to return true to asp.net OnClientClick following an Ajax request? Alternatively, is there another method that can be used?

I am currently implementing an Ajax call to verify if a user is logged in. If the user is not logged in, I want to display a login dialog; otherwise, I need OnClientClick to return true so that the form can be submitted. I am considering using a global var ...

What is the most effective method for live-updating a field every 5 seconds in Laravel?

I want to monitor the database to see if a new row is created for each user and display a popup message to notify them. I'm debating between using pusher/socket or making an Ajax call every 5 seconds to achieve this live update without page refresh. I ...

Exploring NextJS with Typescript

Struggling to incorporate Typescript with NextJS has been a challenge, especially when it comes to destructured parameters in getInitialProps and defining the type of page functions. Take for example my _app.tsx: import { ThemeProvider } from 'styled ...

Embedded tweets may occasionally lose their borders when viewed on various web browsers

My goal is to showcase a collection of responsive embedded tweets in rows of 2. Here are the key elements of the code that have enabled me to achieve this: HTML <div id="tweets"></div> <script src="https://platform.twitter.com/widgets.js" ...

The method of getJSON URL fails to function properly when invoked from an external JavaScript source

I'm grappling with a complicated issue and trying to determine if it's more closely tied to JSONP (JSON + padding) or something else entirely. Let's consider a file named example.php: <script src="jquery.js"</script> <script sr ...

What is the best way to insert an anchor tag into text using React?

I am working with a variable const linkElement = `Hey this is a link ${<a href="www.google.com">Click me!</a>} that can be clicked}` Currently, it displays as Hey this is a link [Object object] that can be clicked. Is there a way to ...

Remove character when the button is clicked as long as the input value is not equal to 0

I am currently using the code below to remove a character from an input field: function deleteChar(input) { input.value = input.value.substring(0, input.value.length - 1) } However, if there is only one character in the input field and the function is ...

What steps should I take to fix the following error: TypeError: undefined is not an object when trying to evaluate '_bip.default.generateMnemonic'?

I'm in the process of developing a mobile application and I find myself in need of utilizing bip39 for passphrase generation. However, after installing the necessary package, I encountered errors related to missing packages like stream buffer events. ...