RESOLVED DUPLICATE of bug 235468 238626
[JSC] Support non-spec-required date+time input, white-space delimited time (`YYYY-MM-DD HH:mm:ss`) as an extension
https://bugs.webkit.org/show_bug.cgi?id=238626
Summary [JSC] Support non-spec-required date+time input, white-space delimited time (...
strarsis
Reported 2022-03-31 12:29:21 PDT
On `iOS`/`iPad` Safari browser engine the JavaScript `Date` fails to parse `ISO 8601` date+time inputs where the date and time are delimited by a white-space instead of the `T` character (e.g. `2022-03-22 17:51:57`): The `Date` constructor fails with `Invalid date format`. The usage of a white-space as delimiter between date and time isn't specified by ISO 8601, but is allowed by the RFC that is mostly used on the web. Most Browsers and JavaScript libraries support and output `ISO 8601` formatted dates with date+time delimited by a white-space (`Chrome` (`Blink`/`Chromium`); `Firefox` (`Gecko`); `FeathersJS`; ...). Code demonstration: `new Date('2022-03-22 17:51:57')` Live demonstration: https://playcode.io/879708/
Attachments
Live demonstration of the issue (32 bytes, text/plain)
2022-03-31 12:31 PDT, strarsis
no flags
strarsis
Comment 1 2022-03-31 12:31:04 PDT
Created attachment 456271 [details] Live demonstration of the issue
Yusuke Suzuki
Comment 2 2022-04-06 01:34:02 PDT
(In reply to strarsis from comment #0) > On `iOS`/`iPad` Safari browser engine the JavaScript `Date` fails to parse > `ISO 8601` date+time inputs where the date and time are delimited by a > white-space instead of the `T` character (e.g. `2022-03-22 17:51:57`): > The `Date` constructor fails with `Invalid date format`. > > The usage of a white-space as delimiter between date and time isn't > specified by ISO 8601, but is allowed by the RFC that is mostly used on the > web. Note that ECMAScript spec is "date-times based upon a simplification of the ISO 8601"[1], not a ISO 8601 or RFC. So using space here is implementation-dependent behavior (spec only accepts "T" case.) But it can be a good extension. [1]: https://tc39.es/ecma262/#sec-date-time-string-format
Yusuke Suzuki
Comment 3 2022-04-06 03:23:40 PDT
Ah, I extended it in bug 235468. *** This bug has been marked as a duplicate of bug 235468 ***
Note You need to log in before you can comment on or make changes to this bug.