Page MenuHomePhabricator

Citoid unable to parse ISO dates with punctuation missing in date and/or time
Open, MediumPublic

Description

Reported here: https://www.mediawiki.org/w/index.php?title=Topic:U08urfahk3n865wx&topic_showPostId=u08w3kfx1ieazyxd&fromnotif=1#flow-post-u08w3kfx1ieazyxd

The date reported there had mixed punctuation and we are unable to parse it: 20170821T1415+0300Z

However we are also not able to parse no punctuation either, i.e. 20171207T124731Z which according to Wikipedia ( 😃 ) is a valid ISO format. Neither Date.parse() nor the chrono library recognises it.

Reported to chrono here: https://github.com/wanasit/chrono/issues/239

TODO: either submit pull request to chrono and/or use a custom parser.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Mvolz triaged this task as Medium priority.Oct 19 2017, 4:15 PM
Mvolz renamed this task from Failure to validate datetime string to Citoid unable to parse ISO dates with no or mixed punctuation.Dec 7 2017, 1:12 PM
Mvolz updated the task description. (Show Details)

Both 20170821T1415+0300Z and 20171207T124731Z are valid date-time notations; they are different variants of the ISO 8601 format.

Mvolz renamed this task from Citoid unable to parse ISO dates with no or mixed punctuation to Citoid unable to parse ISO dates with punctuation missing in date and/or time.Dec 7 2017, 1:40 PM
Mvolz updated the task description. (Show Details)

Both 20170821T1415+0300Z and 20171207T124731Z are valid date-time notations; they are different variants of the ISO 8601 format.

Thanks! I opened a ticket with chrono: https://github.com/wanasit/chrono/issues/239

By my reading of the standard punctuation can be missing from the date, time, or both. And the date can be trunctated UP to the year.

We can either submit a pr there or use a custom parser depending on whether they think it should be supported there.

By my reading of the standard punctuation can be missing from the date, time, or both. And the date can be trunctated UP to the year.

Yup, I read it in the same way.

We can either submit a pr there or use a custom parser depending on whether they think it should be supported there.

Since it's a genuine ISO format, I'm inclined to think that a date-parsing module should support it :)

Mvolz removed Mvolz as the assignee of this task.Nov 14 2019, 10:48 AM