Bug 196894
Summary: | Date parses time-and-time string without timezone incorrectly | ||
---|---|---|---|
Product: | WebKit | Reporter: | T.J. Crowder <tj> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | fpizlo, keith_miller, msaboff, ross.kirsling, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 12 | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
T.J. Crowder
JavaScriptCore parses dates in this format incorrectly, because there's no timezone indicator but there is a time portion:
```js
new Date("2019-04-13T09:00:00")
```
It should parse it in _local time_, but parses it as UTC instead. V8, SpiderMonkey, and Chakra parse it correctly. This fiddle demonstrates the problem: https://jsfiddle.net/tjcrowder/ojmh3fsv/2/
The rules changed between ES2015 and ES2016 but have been stable since. Current rules are here: https://tc39.github.io/ecma262/#sec-date.parse
> When the UTC offset representation is absent, date-only forms are
> interpreted as a UTC time and date-time forms are interpreted as
> a local time.
This bug is similar to #89071 but that report (from 2012) is severely outdated now, not least because it predates this being added to the specification. (I believe #89071 can be closed as some form of "no longer relevant." Or if not, this can be made a duplicate of that and we can update its description.)
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/49882137>
Ross Kirsling
Closing as duplicate, since bug 89071 comment 2 provides the updated spec context you mentioned.
*** This bug has been marked as a duplicate of bug 89071 ***