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 7742503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:17:32+00:00 2026-06-01T09:17:32+00:00

What result is right for the following test cases? //Chrome 19 Opera 12 Firefox

  • 0

What result is right for the following test cases?

                                                    //Chrome 19     Opera 12       Firefox 11    IE 9          Safari 5.1.1
console.log(Date.parse("2012-11-31T23:59:59.000Z"));//1354406399000 NaN            NaN           1354406399000 NaN
console.log(Date.parse("2012-12-31T23:59:59.000Z"));//1356998399000 1356998399000  1356998399000 1356998399000 1356998399000
console.log(Date.parse("2012-12-31T23:59:60.000Z"));//NaN           NaN            NaN           NaN           1356998400000
console.log(Date.parse("2012-04-04T05:02:02.170Z"));//1333515722170 1333515722170  1333515722170 1333515722170 1333515722170
console.log(Date.parse("2012-04-04T24:00:00.000Z"));//NaN           1333584000000  1333584000000 1333584000000 1333584000000
console.log(Date.parse("2012-04-04T24:00:00.500Z"));//NaN           NaN            1333584000500 1333584000500 NaN
console.log(Date.parse("2012-12-31T10:08:60.000Z"));//NaN           NaN            NaN           NaN           1356948540000
console.log(Date.parse("2012-13-01T12:00:00.000Z"));//NaN           NaN            NaN           NaN           NaN
console.log(Date.parse("2012-12-32T12:00:00.000Z"));//NaN           NaN            NaN           NaN           NaN
console.log(Date.parse("2012-12-31T25:00:00.000Z"));//NaN           NaN            NaN           NaN           NaN
console.log(Date.parse("2012-12-31T24:01:00.000Z"));//NaN           NaN            NaN           1356998460000 NaN
console.log(Date.parse("2012-12-31T12:60:00.000Z"));//NaN           NaN            NaN           NaN           NaN
console.log(Date.parse("2012-12-31T12:00:60.000Z"));//NaN           NaN            NaN           NaN           1356955260000
console.log(Date.parse("2012-00-31T23:59:59.000Z"));//NaN           NaN            NaN           NaN           NaN
console.log(Date.parse("2012-12-00T23:59:59.000Z"));//NaN           NaN            NaN           NaN           NaN
console.log(Date.parse("2012-02-29T12:00:00.000Z"));//1330516800000 1330516800000  1330516800000 1330516800000 1330516800000
console.log(Date.parse("2011-02-29T12:00:00.000Z"));//1298980800000 NaN            NaN           1298980800000 NaN
console.log(Date.parse("2011-03-01T12:00:00.000Z"));//1298980800000 1298980800000  1298980800000 1298980800000 1298980800000

// extended years:
console.log(Date.parse("0000-01-01T00:00:00.000Z"));//-621672192e5  -621672192e5   -621672192e5  -621672192e5  -621672192e5
console.log(Date.parse("+275760-09-13T00:00:00.000Z"));//8.64e15    NaN            8.64e15       8.64e15       8.64e15
console.log(Date.parse("-271821-04-20T00:00:00.000Z"));//-8.64e15   NaN            -8.64e15      -8.64e15      -8.6400000864e15
console.log(Date.parse("+275760-09-13T00:00:00.001Z"));//NaN        NaN            NaN           8.64e15 + 1   8.64e15 + 1
console.log(Date.parse("-271821-04-19T23:59:59.999Z"));//NaN        NaN            NaN           -8.64e15 - 1  -8.6400000864e15 - 1

// https://github.com/kriskowal/es5-shim/issues/80 Safari bug with leap day
console.log(Date.parse("2034-03-01T00:00:00.000Z") -
            Date.parse("2034-02-27T23:59:59.999Z"));//86400001      86400001       86400001       86400001      1

// Time Zone Offset
console.log(Date.parse("2012-01-29T12:00:00.000+01:00"));//132783480e4 132783480e4  132783480e4  132783480e4    132783480e4
console.log(Date.parse("2012-01-29T12:00:00.000-00:00"));//132783840e4 132783840e4  132783840e4  132783840e4    132783840e4
console.log(Date.parse("2012-01-29T12:00:00.000+00:00"));//132783840e4 132783840e4  132783840e4  132783840e4    132783840e4
console.log(Date.parse("2012-01-29T12:00:00.000+23:59"));//132775206e4 132775206e4  132775206e4  132775206e4    132775206e4
console.log(Date.parse("2012-01-29T12:00:00.000-23:59"));//132792474e4 132792474e4  132792474e4  132792474e4    132792474e4
console.log(Date.parse("2012-01-29T12:00:00.000+24:00"));//NaN         1327752e6    NaN          1327752000000  1327752000000
console.log(Date.parse("2012-01-29T12:00:00.000+24:01"));//NaN         NaN          NaN          1327751940000  1327751940000
console.log(Date.parse("2012-01-29T12:00:00.000+24:59"));//NaN         NaN          NaN          1327748460000  1327748460000
console.log(Date.parse("2012-01-29T12:00:00.000+25:00"));//NaN         NaN          NaN          NaN            NaN
console.log(Date.parse("2012-01-29T12:00:00.000+00:60"));//NaN         NaN          NaN          NaN            NaN
console.log(Date.parse("-271821-04-20T00:00:00.000+00:01"));//NaN      NaN          NaN          -864000000006e4 -864000008646e4
console.log(Date.parse("-271821-04-20T00:01:00.000+00:01"));//-8.64e15 NaN          -8.64e15     -8.64e15        -864000008640e4

Seems that ECMAScript should be more specific for edge cases; currently is says that invalid date formats are implementation dependent, am I right?

  • 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-01T09:17:33+00:00Added an answer on June 1, 2026 at 9:17 am

    According to the ES5 spec, Date.parse will only work with valid ISO 8601 dates. Anything else is implementation dependent (in practice, IE < 9 doesn’t work with standard ISO dates, it requires a ‘/’ seperator). So if you feed it an invalid date (such as 2012-11-31) you can get anythying, from 2012-12-01 to an error.

    In your tests:

    2012-12-31T23:59:60.000Z
    

    should work, though probably not as you expect. Using 60 for seconds indicates a leap second, it isn’t equivalent to 24:00:00, only Safari seems to get that right.

    Also:

    2012-04-04T24:00:00.000Z
    

    should work, it indicates midnight at the end of 4 April, 2012 so Firefox is in error there.

    The formats that ES5 implementations should support are in the spec.

    Oh, and you should probably also test omission of the ‘T’ (since it is optional in certain cases that I think include browsers) and different time zones such as:

    2012-04-03 23:50:00+10:00
    2012-04-03 23:50:00-04:15
    2012-04-03 23:50:00+10
    20120403T235000+1000
    

    and so on with YYYYDDD and YYYYWwwD formats, though implementations aren’t required to support them.

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

Sidebar

Related Questions

I've the following players, each value corresponds to a result in percentage of right
The following query does not return any result SELECT user_id FROM test WHERE poll_id
I have the following query which gives me the right results. But it's super
I found that some result of MBRContains(g1,g2) and other functions seems not right to
I have this right now: <%= f.select :credit, (0..500) %> This will result in
I googled this a little but couldn't find a good result. Right now I'm
I am looking for extensional DCG test cases. Means test cases that check the
I've done the following test: private static object threadLocker = new object(); private static
Consider the following test case: $start = new DateTime(2011-02-25); $end = new DateTime(2011-03-25); $interval
I am tyring to test Whoosh for text searching and right now a simple

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.