Date formats and ISO 8601
Matt Mackall
mpm at selenic.com
Tue Jul 26 19:49:46 UTC 2016
On Tue, 2016-07-26 at 10:24 -0700, Adrian Klaver wrote:
> On 07/26/2016 12:46 AM, Marcus Harnisch wrote:
> >
> > Hi all
> >
> > I just happened to notice that contrary to claims made by "hg help
> > dates", Mercurial does not support ISO 8601 format (cf.
> > https://en.wikipedia.org/wiki/ISO_8601). Could this be added? A common
> > standard would be really helpful in scripts where tools might generate
> > time stamps to be used by Mercurial.
> I am guessing you are referring to the lack of T. That is permitted:
>
> https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
>
>
> It is permitted to omit the 'T' character by mutual agreement.[21]
>
> 21. "ISO 8601:2004(E)". ISO. 2004-12-01. "4.3.2 NOTE: By mutual
> agreement of the partners in information interchange, the character [T]
> may be omitted in applications where there is no risk of confusing a
> date and time of day representation with others defined in this
> International Standard."
Also, we probably wouldn't change our output format at this stage, even if this
clause didn't exist. Undoubtedly there are plenty of scripts parsing our dates
that would explode if a 'T' suddenly appeared.
While we may output valid 8601 dates, we're not accepting all of them:
$ hg debugdate "2016-07-26T18:33:19+00:00"
abort: invalid date: '2016-07-26T18:33:19+00:00'
Ho hum. I'll spin up a patch.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list