Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7839521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:27:53+00:00 2026-06-02T15:27:53+00:00

First of all, I think timezone probably has something to do with this. I’m

  • 0

First of all, I think timezone probably has something to do with this. I’m in EST/EDT. Also, I’m testing this on chromium 17 / linux.

Now, let’s say I create two dates like this:

// December 5

dateFromNumbers = new Date(2020, 11, 5);
dateFromString = new Date("2020-12-5");

It seems these dates should have identical timestamps, and they do:

+dateFromNumbers == +dateFromString; // true

…at least in this case. But in some cases, they don’t:

// December 15

dateFromNumbers = new Date(2020, 11, 15);
dateFromString = new Date("2020-12-15");

+dateFromNumbers == +dateFromString; // false

What’s going on here?

dateFromNumbers; // Tue Dec 15 2020 00:00:00 GMT-0500 (EST)
dateFromString;  // Mon Dec 14 2020 19:00:00 GMT-0500 (EST)

Looks like dateFromString is 5 hours earlier than dateFromNumbers in this case (EST is GMT – 5, I’m sure it’s related somehow).

It seems to affect the ends of months October through December. Here’s a fiddle that makes it easy to see which days differ (unless you are red-green colorblind, in that case it may be difficult to see, my apologies).

http://jsfiddle.net/9gBfX/

What gives?


Notes:

  • You can set your system timezone to EST/EDT to see the jsfiddle example as I’m seeing it.
  • Date’s month numbers are zero-based; the 11 is not a typo.
  • This issue appears in every year that I checked.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:27:55+00:00Added an answer on June 2, 2026 at 3:27 pm

    After looking in V8’s source code:

    // Specification:
    // Accept ES5 ISO 8601 date-time-strings or legacy dates compatible
    // with Safari.
    <...>
    //  A string that matches both formats (e.g. 1970-01-01) will be
    //  parsed as an ES5 date-time string - which means it will default
    //  to UTC time-zone. That's unavoidable if following the ES5
    //  specification.
    

    Reading the surrounding code, it seems that a date-time string with both month and day 2 symbols long is considered a valid ES5 date-time string. Further down in the ES5 parser, after it parses the dates and times, there’s a comment:

    // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given.
    

    In case of “YYYY-MM-DD”, once the code gets that far, the ES5 parser has successfully parsed the entire string, so it returns before the legacy parser gets a chance to localize the timezone. Otherwise (month/day are one symbol long) it’s treated as a “legacy” datetime and the legacy parser gets to deal with it and localize it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I think this question is not C# independent. But can also
first of all: this is not the same as this . The ModelBackend has
first of all: I really love this site and I think this is the
First of all, I don't think this question is a duplicate of Detect 64bit
First of all, I reviewed this question , but I think I need a
First of all, I've looked at EVERY other post here, about this (I think)
First, I would to thank everyone for all the help they provide via this
First of all, I found this: Objective C HTML escape/unescape , but it doesn't
First of all sorry that I could not think of a more descriptive title.
First of all, I think it is absolutely ridiculous that padding is considered part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.