RESOLVED DUPLICATE of bug 89071 205652
Incorrect Timezone for ISO8601 date-time string with not timezone offset specified
https://bugs.webkit.org/show_bug.cgi?id=205652
Summary Incorrect Timezone for ISO8601 date-time string with not timezone offset spec...
haydenbraxton
Reported 2019-12-30 14:07:04 PST
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
Attachments
Radar WebKit Bug Importer
Comment 1 2020-01-01 00:26:57 PST
Ross Kirsling
Comment 2 2020-01-03 15:17:06 PST
*** This bug has been marked as a duplicate of bug 89071 ***
Note You need to log in before you can comment on or make changes to this bug.