Comments (6)
1e15 - 999999913600000 === 1 day
from es5-shim.
(!Date.parse || Date.parse("+275760-09-13T00:00:00.000Z") !== 8.64e15) - works fine, so native Date.parse used in Safari 5.1, and native Date.parse('+033658-09-27T01:46:40.000Z') === 1e15 in Safari
from es5-shim.
same issue:
alert(Date.parse('2034-03-01T00:00:00.000Z') - Date.parse('2034-02-27T23:59:59.999Z')); // alerts 1 in Safari
so, es5-shim should replace native Date.parse for Safari
from es5-shim.
another Date.parse issue in Chrome:
Date.parse('1995-02-04T24:00') === Date.parse('1995-02-05T00:00')
24:00 - midnight is a special case and should be parsed, Chrome returns NaN...
from es5-shim.
Some tests (native Date.parse):
//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
What is right results for this tests?
from es5-shim.
IMHO, Firefox implementaion is best, except "Date.parse("2012-04-04T24:00:00.500Z")"
from es5-shim.
Related Issues (20)
- All V8 versions have the Date shim loaded. HOT 1
- Rounding errors with toExponential in Edge 15/16 HOT 4
- IE9 error: Redeclaration of const property HOT 5
- Something in the shim causes Chrome to throw a warning HOT 3
- 4.5.11 got a tag, but not a full release HOT 2
- `hasAutomationEqualityBug` triggers deprecation warnings in Firefox
- Cannot convert undefined or null to object PropTypes.shape() HOT 9
- Question: Why concatenate Symbols with a string without assigning it to a variable? HOT 6
- Why not set bound.prototype = target.prototype directly? HOT 3
- in ie8 Object.keys failed this conversion HOT 3
- Action required: Greenkeeper could not be activated 🚨
- String#lastIndexOf has a shallow-wrapper shim that does nothing and always gets applied HOT 1
- Dependency Dashboard
- Conflict ES5-shim(sham) 4.5.15 and ES6-shim(sham) 0.35.x HOT 19
- Please change the name of the default branch HOT 1
- External URL linking to spam websites HOT 2
- errors with Object.defineProperty under ie8 since 4.6.3 HOT 6
- Incompatibility with awilix HOT 17
- Invalid Date on Safari HOT 2
- ⚠️ `webkitStorageInfo` is going away HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from es5-shim.