Last modified: 2014-03-03 20:42:26 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34545, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32545 - MediaWiki should support <time> in WikiText
MediaWiki should support <time> in WikiText
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.21.x
All All
: Low enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n
Depends on:
Blocks: html5
  Show dependency treegraph
 
Reported: 2011-11-21 12:11 UTC by Daniel Friesen
Modified: 2014-03-03 20:42 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Friesen 2011-11-21 12:11:49 UTC
html5 has a <time> element. It carries the semantics noting that the contents are a date, and if the contents aren't in a set of machine readable formats there is a datetime="" attribute that can contain a machine readable format.
So eg: <time datetime="2011-11-12T14:54Z">November 12, 2011 6:54 PST</time> displays the date in a human readable format in PST while also noting the date in a machine readable time format.

It's possible some user agents may add support for functionality that takes advantage of these semantics. For example they may provide a display of the time in the user's current timezone. <time> is also used in some microdata formats iirc 

pubdate seams to have been removed from <time>. Even if it's added back we probably should strip it out of WikiText since inline text shouldn't be able to define what looks externally to be authoritative information about the entire page that MW defined.

We should permit the use of <time> inside WikiText.
Comment 1 Brion Vibber 2011-11-22 01:34:03 UTC
Current w3c draft HTML 5 spec for <time>:
<http://dev.w3.org/html5/spec/text-level-semantics.html#the-time-element>

A few things to consider in context of bug 19992 (using this to do localized time/datestamps using browser's client-side knowledge of user's timezone):

* if a 'datetime' attribute is present with the normalized timestamp, it's used as the date and/or time value -- thus the text contents may be freely formatted (or re-formatted)

* there's no standard for replacing visible times, so we'd probably want to use a class to mark localizable items

* the valueAsContent property doesn't distinguish between 'date only' and 'midnight UTC on that date', nor between 'time specified to the second at :00' and 'time specified to the minute'; could need to check the format or something to determine partial replacements

* note that applying timezone transformations to a UTC-midnight date timestamp may result in jumping off by a day depending on your local timezone -- probably not usually what's wanted.

* <time> will be theoretically relevant as metadata on things that you would probably not actually want to display localized in a user's timezone, for instance at <https://en.wikipedia.org/wiki/JFK#Assassination>:

"President Kennedy was assassinated in Dallas, Texas, at 12:30 pm [[Central Standard Time]] on November 22, 1963, ..."

this is relevant metadata and might be marked up something like:

"President Kennedy was assassinated in Dallas, Texas, at <time datetime='1963-11-22T12:30-06:00'>12:30 pm [[Central Standard Time]] on November 22, 1963</time>, ..."


meanwhile in UI and project coordination we're more likely to want to make them localizable:

"The IRC meeting will start at <time datetime='2011-11-25T12:00Z'>12:00 UTC on November 25</time>"

... but how will the system know we want to convert this one, and not the other one? Need a class? What about the contents? Would we lose that nice custom formatting there? Would we say 'too bad' and actually mark it up a little differently?

One possibility might be to have a wrapper parser function or template:

"The IRC meeting will start at {{#showtime:2011-11-25T12:00Z}}"

which might render to HTML:

"The IRC meeting will start at <time class='mw-showtime' datetime='2011-11-25T12:00Z'>2011-11-25 12:00 UTC</time>"

when then gets replacements done via JS into local time:

"The IRC meeting will start at <time class='mw-showtime' datetime='2011-11-25T12:00Z'>2011-11-25 04:00 PST</time>"

Code could emit the HTML w/ class markers directly when not going through wikitext...
Comment 2 Daniel Friesen 2012-02-19 02:05:57 UTC
Rather than a class maybe we should go for a data- param with some sort of format specifier. I don't doubt that people are going to be asking for "3 minutes ago" style timestamps as well as those formatted into a user's preferred time.
Comment 3 p858snake 2012-02-19 02:14:34 UTC
(In reply to comment #2)
> Rather than a class maybe we should go for a data- param with some sort of
> format specifier. I don't doubt that people are going to be asking for "3
> minutes ago" style timestamps as well as those formatted into a user's
> preferred time.
As for the format specifier, Just tell users to use the [[ISO 8601]] standard when entering time, What better solution than a standard?
Comment 4 Daniel Friesen 2012-02-19 03:03:47 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Rather than a class maybe we should go for a data- param with some sort of
> > format specifier. I don't doubt that people are going to be asking for "3
> > minutes ago" style timestamps as well as those formatted into a user's
> > preferred time.
> As for the format specifier, Just tell users to use the [[ISO 8601]] standard
> when entering time, What better solution than a standard?

Not input format, output format. As in what format of time js should insert into the element.
Comment 5 Daniel Friesen 2012-02-19 03:28:13 UTC
For example protect-expiring(-local), instead of "expires $1 (UTC)" / "expires $1" could be something like: "expires <time data-format="relative" datetime="$4">$1 (UTC)</time>"

Which will end up with a js replacement ending up with something like "expires <time data-format="relative" datetime="2012-0-12T03:03:47Z">in 5 minutes</time>".
Comment 6 Daniel Friesen 2012-02-20 04:12:26 UTC
Note that I added support for <data>, <time>, <meta>, and <link> (missing elements of Microdata) in WikiText in r111891.

Still need formatting code, parser function, etc... of course.
Comment 7 Daniel Friesen 2012-04-04 07:03:07 UTC
Change was backed out of svn for the git migration, new gerrit changeset:
https://gerrit.wikimedia.org/r/#change,4251
Comment 8 Andre Klapper 2013-03-22 14:18:24 UTC
(In reply to comment #7)
> https://gerrit.wikimedia.org/r/#change,4251

Patch was merged in November 2012.

As written in comment 6,
> Still need formatting code, parser function, etc... of course.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links