Toml: Allow space to seperate date and time as per RFC3339

Created on 30 Jul 2016  路  5Comments  路  Source: toml-lang/toml

With the recent exciting addition of better support for time and date with #414, I think it's time to reconsider the decision to not to allow spaces in date-times (see #279).

For example, compare the time of the moon landing with/without T:

datetime = 1969-07-20T20:18
google_results = 7

datetime = 1969-07-20 20:18
google_results = 5360

Another famous (less pleasant) date:

datetime = 2001-09-11 10:28
google_results = 87_900

datetime = 2001-09-11T10:28
google_results = 7

Seems to me that allowing a space as well would fit the "obvious" part of TOML very well here. The format appears to be several orders of magnitude more popular. In fact, I'd go so far as saying that using T in datetimes is a rather obscure format used only by programmers who have read the Wikipedia page of ISO 8601/RFC3339, as opposed to normal users. While I personally find using a T rather neat, it's not so good for readability.

As for complexity, I believe the addition of allowing a space between date and time ("T" / " ") would be trivial.

Most helpful comment

That's right, but the RCF 3339 removes that possibility to remove ambiguity (see Apendix A) and toml specs follow the RFC not the ISO.

ISO 8601 allows the delimiter T to be omitted. I think this means that you may write: 2007-04-0514:30 or even 200704051430 instead of 2007-04-05T14:30, if this has been agreed upon. The RFC does not allow this, and requires a delimiter (whether that delimiter be T, t or ).

This is a different issue from allowing space in addition to T. The RFC specifically mentions that applications may allow space for readability. See https://tools.ietf.org/html/rfc3339#section-5.6

This also introduces no ambiguity in the grammar, and is a commonly used format compared to the T-variant, as seen in the number of search results mentioned above.

I think readability is a very important part of being "obvious".

All 5 comments

But doesn't the RFC 3339 specify that "T" must be present between date and time? Your change would effectively make toml Datetime format not compliant with the RFC.

Not necessarily..

NOTE: ISO 8601 defines date and time separated by "T".
Applications using this syntax may choose, for the sake of
readability, to specify a full-date and full-time separated by
(say) a space character.

That's right, but the RCF 3339 removes that possibility to remove ambiguity (see Apendix A) and toml specs follow the RFC not the ISO.

ISO 8601 states that the "T" may be omitted under some
circumstances. This grammar requires the "T" to avoid ambiguity.

I'm all for making this mandatory, displaying a different variant should be left to the user interface / front-end side.

That's right, but the RCF 3339 removes that possibility to remove ambiguity (see Apendix A) and toml specs follow the RFC not the ISO.

ISO 8601 allows the delimiter T to be omitted. I think this means that you may write: 2007-04-0514:30 or even 200704051430 instead of 2007-04-05T14:30, if this has been agreed upon. The RFC does not allow this, and requires a delimiter (whether that delimiter be T, t or ).

This is a different issue from allowing space in addition to T. The RFC specifically mentions that applications may allow space for readability. See https://tools.ietf.org/html/rfc3339#section-5.6

This also introduces no ambiguity in the grammar, and is a commonly used format compared to the T-variant, as seen in the number of search results mentioned above.

I think readability is a very important part of being "obvious".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LongTengDao picture LongTengDao  路  4Comments

jacobconley picture jacobconley  路  4Comments

mqudsi picture mqudsi  路  3Comments

ChristianSi picture ChristianSi  路  4Comments

tamasfe picture tamasfe  路  3Comments