Early on in the requirements stage of ResourceLoader development we decided to use ISO8601 as the format for representing timestamps in URLs. This was chosen for it's legibility, conformance to a standard and ease of generation. However this was somewhat of an oversight since the timestamp "1970-01-01T00:00:00Z" gets URL encoded to be "1970-01-01T00%3A00%3A00Z" which leaves something to be desired. Also, generating this format in JavaScript requires sending a extra 220 bytes (minified and compressed).
So, before we seal the deal on using 8601, I would like to collect some ideas about alternatives which would ideally...
* Be legible in a URL * Conform to a well-defined/well-known standard * Be easy to generate from a unix timestamp in both PHP and JavaScript
Proposals wanted.
- Trevor
ISO 8601 does not mandate the use of separators within date and time. The following are equivalent.
"basic" format: 19850412T101530Z "extended" format: 1985-04-12T10:15:30Z
On 9/30/10 12:30 PM, Trevor Parscal wrote:
Early on in the requirements stage of ResourceLoader development we decided to use ISO8601 as the format for representing timestamps in URLs. This was chosen for it's legibility, conformance to a standard and ease of generation. However this was somewhat of an oversight since the timestamp "1970-01-01T00:00:00Z" gets URL encoded to be "1970-01-01T00%3A00%3A00Z" which leaves something to be desired. Also, generating this format in JavaScript requires sending a extra 220 bytes (minified and compressed).
So, before we seal the deal on using 8601, I would like to collect some ideas about alternatives which would ideally...
- Be legible in a URL
- Conform to a well-defined/well-known standard
- Be easy to generate from a unix timestamp in both PHP and JavaScript
Proposals wanted.
- Trevor
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Neil Kandalgaonkar wrote:
ISO 8601 does not mandate the use of separators within date and time. The following are equivalent.
"basic" format: 19850412T101530Z "extended" format: 1985-04-12T10:15:30Z
I'm not sure I'd call the "basic" format very readable.
Internally, MediaWiki largely uses "YYYYMMDDhhmmss" stored as a string, not as a timestamp. I think this is fairly readable personally, but it's obviously breaking standards.
MZMcBride
Well, the MediaWiki timestamp string ("19850412101530") is very similar to the "basic" ISO8601 format ("19850412T101530Z"), the difference being the use of T as a separator and the Z at the end to indicate GMT.
I guess I'm a little confused why someone would find "19850412101530" to be "fairly readable" while also finding "19850412T101530Z" to be "not very readable".
- Trevor
On 9/30/10 12:56 PM, MZMcBride wrote:
Neil Kandalgaonkar wrote:
ISO 8601 does not mandate the use of separators within date and time. The following are equivalent.
"basic" format: 19850412T101530Z "extended" format: 1985-04-12T10:15:30Z
I'm not sure I'd call the "basic" format very readable.
Internally, MediaWiki largely uses "YYYYMMDDhhmmss" stored as a string, not as a timestamp. I think this is fairly readable personally, but it's obviously breaking standards.
MZMcBride
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
2010/9/30 Neil Kandalgaonkar neilk@wikimedia.org:
ISO 8601 does not mandate the use of separators within date and time. The following are equivalent.
"basic" format: 19850412T101530Z "extended" format: 1985-04-12T10:15:30Z
Does it also allow replacing the separators with whatever you want? Colons get urlencoded but dashes are fine, so what about (and I know I'm stealing this suggestion from /someone/, I just can't remember who suggested it to me) 1985-04-12T10-15-30Z ?
Roan Kattouw (Catrope)
As of r74042 a new format is supported by wfTimestamp called TS_ISO8601_BASIC. This is being used by ResourceLoader now.
Thank you to everyone for contributing your ideas.
- Trevor
On 9/30/10 2:12 PM, Roan Kattouw wrote:
2010/9/30 Neil Kandalgaonkarneilk@wikimedia.org:
ISO 8601 does not mandate the use of separators within date and time. The following are equivalent.
"basic" format: 19850412T101530Z "extended" format: 1985-04-12T10:15:30Z
Does it also allow replacing the separators with whatever you want? Colons get urlencoded but dashes are fine, so what about (and I know I'm stealing this suggestion from /someone/, I just can't remember who suggested it to me) 1985-04-12T10-15-30Z ?
Roan Kattouw (Catrope)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 9/30/10 2:12 PM, Roan Kattouw wrote:
Does it also allow replacing the separators with whatever you want?
If you use a separator for time, ISO 8601:2004 section 3.4.4 says it has to be hyphen for year, month, day, and colon for hour, minute, and second.
I was under the impression that wfUrlencode left :s unescaped - except on IIS - would that not work for the ResourceLoader?
Conrad
On 30 Sep 2010 23:12, "Neil Kandalgaonkar" neilk@wikimedia.org wrote:
On 9/30/10 2:12 PM, Roan Kattouw wrote:
Does it also allow replacing the separators with whatever you want?
If you use a separator for time, ISO 8601:2004 section 3.4.4 says it has to be hyphen for year, month, day, and colon for hour, minute, and second.
--
Neil Kandalgaonkar (| neilk@wikimedia.org
_______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.o...
wikitech-l@lists.wikimedia.org