Page MenuHomePhabricator

Show localised timestamp on wiki pages such as program pages
Open, Needs TriagePublic

Assigned To
None
Authored By
01tonythomas
May 22 2021, 11:30 AM
Referenced Files
F35440469: conf-highlight.png
Aug 14 2022, 1:00 AM
F35440467: conf-button.png
Aug 14 2022, 1:00 AM
F35440468: conf-localized-time.png
Aug 14 2022, 1:00 AM
F34463793: Screenshot 2021-05-22 at 13.27.54.png
May 22 2021, 11:30 AM
Tokens
"Love" token, awarded by Quiddity.

Description

For wiki pages which show when something happens (such as conference program pages), the timestamps should be available in the local time of the reader.

There are various options to achieve that:

Screenshot 2021-05-22 at 13.27.54.png (326×420 px, 32 KB)

Event Timeline

Seems both more complicated and less user-friendly than just showing the times in the user's timezone. The deploy calendar on Wikitech has code for that (also for highlighting the event that's happening currently); https://meta.wikimedia.org/wiki/WikiConference_North_America/2020 also had some sort of gadget.

Woah, knew this would be solved better like that. Thanks @Tgr. Probably something we should do next time then.

Nice finding! Dropping it here: https://meta.wikimedia.org/wiki/WikiConference_North_America/2020#Program says

Want this schedule in your local timezone? Visit Special:MyPage/common.js, add importScript('User:Enterprisey/schedule-local-time.js'); (link) on a new line at the bottom, save, and then reload this page.

Wonder whether that should be listed on https://www.mediawiki.org/wiki/Hackathons/Handbook/Program or https://www.mediawiki.org/wiki/Hackathons/Suggestions and decline this task as it didn't happen for the 2021 Hackathon?

Ideally, we'd use such a tool for all Wikimedia events, not just the hackathon. Not sure if we have a central list for conference tools.

I think turning something like @APerson's user script into a gadget and making it relatively easy to enable on schedule pages would be ideal. The only better thing would be building the js functionality into MediaWiki or an extension natively (which I would also support). With https://meta.wikimedia.org/wiki/Template:Zonestamp already built this would make a nice combination. The template output could be tweaked to make some microformat for the gadget to read too if needed.

(Mark times up with <time>, very easy to do things like hover overs then.)

(Mark times up with <time>, very easy to do things like hover overs then.)

Great idea! I've done that in https://meta.wikimedia.org/wiki/Special:Diff/21495109

Support making a gadget. Requires some design & implementation effort and I'd be happy to help out.

Tgr renamed this task from Show zonestamp localised timestamp on hover in wiki pages to Show localised timestamp on wiki pages such as program pages.Jun 2 2021, 9:16 PM
Tgr updated the task description. (Show Details)

Poor person's link if no-one implements this until next event™: https://meetingtimes.toolforge.org/

I came back to this task today because of wanting local times displayed on the https://wikimania.wikimedia.org/wiki/2021:Program schedule. I added the <time/> wrapper to the [[Template:Zonestamp]] output there and also added class="zonestamp".

This makes it possible to use a "simple" bit of code in the user's common.js to show all of the zonestamp links on the page in your local time:

wikimania:User:BDavis (WMF)/zonestamp.js
/**
 * Display times wrapped in [[Template:Zonestamp]] as local times.
 * 
 * License: CC0
 */
mw.hook("wikipage.content").add(function () {
	document.querySelectorAll("time.zonestamp").forEach(function (e) {
		e.textContent = new Date(e.dateTime).toLocaleString();
	});
});
wikimania:User:BDavis (WMF)/common.js
mw.loader.load( "/w/index.php?title=User:BDavis_(WMF)/zonestamp.js&action=raw&ctype=text/javascript" ); // Backlink: [[User:BDavis (WMF)/zonestamp.js]]

I wrote a script that IMO covers the common conference use cases:

  • Convert a timestamp or a time range into the reader's time zone, using Intl.DateTimeFormat with timeStyle: "short" (typically resulting in something like 6:00 PM or 18:00 for timestamps, 6:00 – 8:00 PM for time ranges).
  • Display the time zone which these time stamps are in (so that the page can say "Times are in UTC" and then that text gets updated as needed).
  • Highlight events which are happening right now, and allow direct linking to them (it adds an #lt-current id to the first such event).

Let me know what you think about it.

A more pragmatic script (relying on the other one) for the Wikimania 2022 markup specifically: https://wikimania.wikimedia.org/wiki/User:Tgr/conference-helper-WM2022.js
Code for loading:

mw.loader.load('https://wikimania.wikimedia.org/w/index.php?title=User:Tgr/conference-helper-WM2022.js&action=raw&ctype=text/javascript'); // Backlink: [[User:Tgr/conference-helper-WM2022.js]]

(Do not load the other script, it's included.)

Time & time zone localizedcurrent event highlighting"Jump to current" button on top of page
conf-localized-time.png (451×245 px, 16 KB)
conf-button.png (344×709 px, 27 KB)
conf-highlight.png (842×1 px, 241 KB)