[Mediawiki-l] New Extension: AllTimeZones

Daniel Friesen lists at nadir-seen-fire.com
Wed Apr 4 19:35:58 UTC 2012

On Tue, 03 Apr 2012 20:12:57 -0700, nischay nahata <nischayn22 at gmail.com>  

> Hi,
> I have made an extension called AllTimeZones [1] that lets anyone put up
> dates in a page in all Timezone formats.
> I think it will be especially useful for admins when announcing a meeting
> rather than the current usage I saw at
> http://meta.wikimedia.org/wiki/Wikidata/Events (using the Template:UTC  
> with
> local time link) as I don't like the idea of opening a new website just  
> to
> check my local time.
> Reedy already suggested to make the zones in UTC format (I am still  
> working
> at it), any other comments are most welcome.
> The UI  really needs some work IMHO. You can see its screenshot at [2].
> [1]http://www.mediawiki.org/wiki/Extension:AllTimeZones
> [2]https://github.com/nischayn22/AllTimeZones/raw/master/timezone.png

We actually already have some plans on how to handle this case:
The intent is to support the html5 <time> element.
- <time> will be allowed in WikiText.
- When a certain attribute is specified time will automatically be  
localized by JS using the user's preferences, a cookie, or their browser  
- We will have a parser function that formats time into contentlang and  
outputs a <time> with said attribute.

Relevant bugs:
- https://bugzilla.wikimedia.org/show_bug.cgi?id=32545 - MediaWiki should  
support <time> in WikiText
- https://bugzilla.wikimedia.org/show_bug.cgi?id=19992 - Support  
client-side date/time formatting for user's local timezone (JavaScript)
- https://bugzilla.wikimedia.org/show_bug.cgi?id=30857 - Requesting more  
user-friendly timestamps

I've introduced a changeset that adds support for <time> in WikiText:
- https://gerrit.wikimedia.org/r/#change,4251

I also wrote some code for parsing the datetime="" of a <time> element.

The next step would probably be porting our Language::sprintfDate and  
other date related methods to our JS mw.language system.

After that we'd incorporate it into the jQuery.fn.formatTime code I also  
have partially written. And start handling the preferences and cookies.

Then we'd probably add in the parser function and relative time code.

When we're done with that stuff we can probably come up with a good user  
interface to make out of that.

Here's my thought on that right now:
- The timezone portion of the output becomes a stylized button (probably  
not directly <button> but a css style that's button-ish)
- Clicking on the button brings up a timezone map (a nice intuitive one  
with a real map)
- When you change the timezone it will either use the api to change your  
user preference or set either a localStorage key or cookie (cookies have  
the domain advantage, while localStorage has the "not sending pointless  
cookies" and StorageEvent advantages).

We'll also want to come up with a good switching ui for  

~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

More information about the MediaWiki-l mailing list