Ecmascript 5 Date.parse for ISO 8601 test cases

Posted by 4esn0k on Stack Overflow See other posts from Stack Overflow or by 4esn0k
Published on 2012-04-04T05:26:04Z Indexed on 2012/04/04 5:29 UTC
Read the original article Hit count: 378

Filed under:
|

What results is right for next test cases?

                                                    //Chrome        Opera          Firefox       IE 9          Safari
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

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about iso8601