The Javascript Date constructor struggles to interpret date strings in certain timezones that are not enclosed in brackets

Take a look at the examples below:

new Date("Wed, 28 May 2014 09:50:06 EEST"); // Invalid Date
new Date("Thu, 26 Jun 2014 09:09:27 EDT"); // OK, is parsed
new Date("Wed, 28 May 2014 09:50:06 (EEST)"); // OK, is parsed
new Date("Thu, 26 Jun 2014 09:09:27 (EDT)"); // OK, is parsed

What's the reason the "EEST" example without brackets isn't parsed while the second example is parsed successfully?

Answer №1

EEST is not recognized as a valid time zone in this scenario. Any parenthesized versions are simply being disregarded, regardless of what they contain.

For instance (I reside in the Pacific time zone):

// Pacific, by default
new Date("Thu, 26 Jun 2014 09:09:27");
Thu Jun 26 2014 09:09:27 GMT-0700 (Pacific Daylight Time)

// Pacific, explicitly
new Date("Thu, 26 Jun 2014 09:09:27 PDT");
Thu Jun 26 2014 09:09:27 GMT-0700 (Pacific Daylight Time)

// Mountain, explicitly
new Date("Thu, 26 Jun 2014 09:09:27 MDT");
Thu Jun 26 2014 10:09:27 GMT-0700 (Pacific Daylight Time)

// Disregarded, defaults to Pacific
new Date("Thu, 26 Jun 2014 09:09:27 (MDT)");
Thu Jun 26 2014 09:09:27 GMT-0700 (Pacific Daylight Time)

new Date("Thu, 26 Jun 2014 09:09:27 (EEST)");
Thu Jun 26 2014 09:09:27 GMT-0700 (Pacific Daylight Time)

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

Text input fields within a grid do not adjust to different screen sizes when placed within a tab

I noticed that my component under a tab is causing the Textfield to become unresponsive on small screens. To demonstrate this, I checked how the Textfield appears on an iPhone 5/SE screen size. https://i.stack.imgur.com/d8Bql.png Is there a way to make t ...

Can VueJS support multiple v-slots in a component?

I recently set up vee-validate v3.0 for validation in my project and everything was going smoothly until I tried to style my elements. Despite following the documentation on styling and making changes to the vee-validate config, I encountered a new issue - ...

After a period of time, NodeJS abruptly crashes while processing a CSV file

Recently, I've been working on a project that involves converting CSV data into XML. To accomplish this, I have been using the fs.createReadStream() method to read the CSV file. However, I encountered an issue where the terminal crashes unexpectedly a ...

Approach for calculating the total of values during an iteration

I am working with the array $scope.otherDetailsData [0] object amount: 29.9 code: "012" currency: "BRL" payedDate: "2016-11-10" roDate: "2016-08-01" type:"OTHER" [1] object amount: 39.9 code: "013" currency: "BRL" payedDate: "2016-11-11" roDate: "2016- ...

NodeJS/express: server became unresponsive after running for some time

Initially, my service using express and webpack ran smoothly. However, I started encountering an issue where the server would hang with no message code being received, as shown in the server message screenshot (server message screenshot). This problem kept ...

Is there a way to verify the presence of a value within a column of a cache query in Django?

I am currently working on a Django application that involves creating a model object and then bulk inserting data at the end. Check out my code below: date_list = [list of dates] data = [] for date in date_list: my_row = Model1.objects.get(date=date) ...

What advantages come from destructuring in conjunction with require statements?

When utilizing require, is there a performance advantage or disadvantage to importing the entire module versus only importing selected functions? It's my understanding that when using require to import modules (as opposed to using import), compilers ...

Prevent a submit button from submitting a form using jQuery

I am working on developing a password manager similar to a chrome extension. The goal is to detect the username and password fields when a user tries to log in to a website, such as Facebook, and then prompt the user if they would like to save these creden ...

Troubleshooting PHP code for inserting date into a hidden input form is not yielding successful results

I am encountering an issue with inserting a hidden date value into my submission form in an HTML form. Despite trying various methods, the date always ends up displaying as "0000-00-00" in the database. Below is the snippet of my HTML code for the hidden ...

Typescript error: Cannot access property "status" on type "never".ts(2339)

Currently, I have a method that utilizes nextjs/auth to sign in with credentials from a form. However, I am encountering a type checking error Object is possibly 'undefined'.ts(2532) const doStuff = async (values: any) => { const result: S ...

UPDATE: Choosing several classes and then toggling the classes independently for each one

I have managed to make this work, but I am considering if there is a more efficient solution. My objective is to modify the divs using classes exclusively. I aim to toggle 4 classes with just one click. First, I obtain the class for the button and then a ...

Using jQuery to emphasize search text in a user-friendly manner

After successfully implementing a search function for a table, I faced the challenge of highlighting the search keyword within a cell. Despite searching for a solution online, I couldn't find anything useful! Here is my HTML code: <table class="s ...

I am having trouble getting the hoverOffset feature to work with doughnut charts in vue-charts.js

It appears that no matter what I try, the hoverOffset property is not working on my doughnut charts. Here's the component code: <script> import { Doughnut } from 'vue-chartjs' export default { extends: Doughnut, props: { ch ...

Losing $scope reference when incorporating a directive within the controller scope

I have a scenario in my code where I am using two directives. One directive is within the controller scope, while the other directive is not located in the html section. <div ng-show="isStore==true"> <packgroup-directive> ...

Iterating through a JSON object to verify the presence of a specific value

I have a JSON Object and I am looking for a way in Angular 6 to search for the value "Tennis" in the key "name". Can you provide guidance on how to achieve this? { "id":2, "name":"Sports", "url":"/sports" "children":[ { "id":1, ...

Upon refreshing the page, next.js 13's useSession() function fails to fetch session information

Currently, I am working on replicating an ecommerce site using nextjs 13. On the order page, I am utilizing useSession from next-auth/react to check if a user is signed in or not. Everything works fine when I navigate to the page through a link, but if I r ...

Experience a seamless transition as the background gently fades in and out alongside the captivating text carousel

I have a concept that involves three background images transitioning in and out every 5 seconds. Additionally, I am utilizing the native bootstrap carousel feature to slide text in synchronization with the changing background images. Solving the Issue ...

I'm currently leveraging Vue.js and Python Flask for my backend development. I'm looking to establish some local variables. What is the best way to accomplish this?

Here is my Vue js file where I am utilizing two URLs from localhost. My goal is to create a configuration file that will allow me to make changes in one place and have those changes reflected throughout. <template> <div> <div class="glob ...

Why won't the function activate on the initial click within the jQuery tabs?

When creating a UI with tabs, each tab contains a separate form. I have noticed that when I click on the tabs, all form save functions are called. However, if I fill out the first tab form and then click on the second tab, refresh the page, and go back t ...

Storing information in a database using Phantomjs

My app is built on phantomjs and here's how it currently operates: 1. A php script retrieves data from my postgres database as an array, 2. The array of data is then passed as an argument to a shell_exec command running a phantomjs script, 3. Phantomj ...