[Webkit-unassigned] [Bug 205652] New: Incorrect Timezone for ISO8601 date-time string with not timezone offset specified
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Dec 30 14:07:04 PST 2019
https://bugs.webkit.org/show_bug.cgi?id=205652
Bug ID: 205652
Summary: Incorrect Timezone for ISO8601 date-time string with
not timezone offset specified
Product: WebKit
Version: WebKit Nightly Build
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: haydenbraxton at haydenbraxton.com
When creating a new Date from an ISO8601 date-time string with no timezone offset specified, Safari assumes the timezone as UTC. This is correct according to ECMAScript 5, but incorrect according to ECMAScript 2019. This exists in currently released versions of Safari as well as the nightly build of webkit.
ECMAScript 5 reference
https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15
'All numbers must be base 10. If the MM or DD fields are absent “01” is used as the value. If the HH, mm, or ss fields are absent “00” is used as the value and the value of an absent sss field is “000”. The value of an absent time zone offset is “Z”.'
ECMAScript 2019 reference
https://www.ecma-international.org/ecma-262/#sec-date-time-string-format
'All numbers must be base 10. If the MM or DD fields are absent "01" is used as the value. If the HH, mm, or ss fields are absent "00" is used as the value and the value of an absent sss field is "000". When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time.'
Safari is correct accornding to ES5. Firefox and Chromium however handle the case according to ES2019.
For an example, suppose a create a Date object in the following way:
```
new Date('2019-12-06T00:00:00')
```
Safari assumes the timezone offset to be 'Z', so printing the result of `toISOString()` on this date would read '2019-12-06T00:00:00Z'.
Creating a date in the same way in Firefox or Chromium, the browser assumes the timezone offset according to local time. So assuming the local time is EST, in either of these browsers, printing the result of `toISOString()` on this date would read '2019-12-06T05:00:00Z'.
Safari should handle this case according to ES2019 as well.
For what it's worth, I shared this on twitter when I first ran into this issue. https://twitter.com/hayden_dev/status/1204445906663329793
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191230/29262bda/attachment-0001.htm>
More information about the webkit-unassigned
mailing list