Date parses invalid ISO8601 string
Reported by
fairweat...@gmail.com,
Aug 19 2017
|
|||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
Steps to reproduce the problem:
1. Open the console and execute
2. new Date('2012-11-31T23:59:59.000Z').toISOString();
3.
What is the expected behavior?
RangeError: Invalid time value
What went wrong?
Displays: "2012-12-01T23:59:59.000Z"
Did this work before? No
Chrome version: 60.0.3112.90 Channel: stable
OS Version: Fedora 23
Flash Version:
ES5-shim is still shimming Date for this error.
https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L1411
,
Aug 22 2017
Able to reproduce the issue on Mac 10.12.6, Win-10 and Ubuntu 14.04 using chrome reported version #60.0.3112.90 and latest canary #62.0.3192.2. This is a non-regression issue as it is observed from M45 old builds. Hence, marking it as untriaged to get more inputs from dev team. Thanks...!!
,
Aug 28 2017
,
Aug 30 2017
The specification here is pretty vague. See https://tc39.github.io/ecma262/#sec-date.parse . Dates which are not really valid are still permitted based on implementation-specific rules. Here, ChakraCore seems to follow V8 in permitting this date, whereas SpiderMonkey and JSC reject the date. I'd suggest waiting for a more specific Date spec before making any changes here.
,
Aug 30 2017
Thanks for looking at the problem, it's a pity that in 2017, and with the ISO8601 specification, that there are still inconsistencies (implementation-specific rules) with `Date` across engines.
,
Aug 30 2017
I agree that this is a pity! Unfortunately, the Date constructor is more than just an ISO 8601 date parser.
,
Aug 30 2017
For me it makes `Date` many things, but not an ISO8601 parser, so parsing such strings remains something that must be performed prior to constructing a `Date` object. Again thanks, I can only hope that the "specification" tightens up on this in the future.
,
Aug 31
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Sep 4
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by tkent@chromium.org
, Aug 20 2017