Bug 196894 - Date parses time-and-time string without timezone incorrectly
Summary: Date parses time-and-time string without timezone incorrectly
Status: RESOLVED DUPLICATE of bug 89071
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-13 02:36 PDT by T.J. Crowder
Modified: 2020-01-03 15:19 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description T.J. Crowder 2019-04-13 02:36:38 PDT
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.)
Comment 1 Radar WebKit Bug Importer 2019-04-13 20:14:23 PDT
<rdar://problem/49882137>
Comment 2 Ross Kirsling 2020-01-03 15:19:23 PST
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 ***