Page MenuHomePhabricator

Investigate how to display the timezone for event dates [not V0]
Closed, ResolvedPublic2 Estimated Story Points

Description

This should be a super quick, timeboxed investigation to see if we can display the timezone with the event datetime.

Event Timeline

ldelench_wmf set the point value for this task to 2.
vyuen raised the priority of this task from Medium to Needs Triage.
vyuen removed the point value for this task.
vyuen triaged this task as Medium priority.Jun 30 2022, 5:03 PM
vyuen set the point value for this task to 2.
ifried renamed this task from Investigate how to display the timezone for event dates to Investigate how to display the timezone for event dates [not V0].Jul 11 2022, 2:29 PM

@Daimona is this still relevant/going to be worked on?

@Daimona is this still relevant/going to be worked on?

I would say it's still relevant, yes. It wasn't prioritized so far because we were focusing on the related tasks first (DST, timezone selector), but it should be ready now. In fact, we briefly talked about this in our last engineering convo. I'll work on this task tomorrow, probably.

First of all, MediaWiki does not have any function that lets you format a timestamp in a way that also includes the timezone. PHP does (e.g., the "e" identifier to DateTime::format), but that has two issues: first, it doesn't respect the user preference for time display; second, it's not localized. In fact, I think localization is what makes this task not trivial. The first approach I would try is to use the methods in Language that format a datetime according to the user preferences, and then appending the timezone to the result. This would at least respect the user preferences. Note that doing so could in theory be wrong if the format chosen by the user already includes the timezone, but I don't think we can do anything about it. I'm not sure if any language defines a date preference with the time zone in it.

The next l10n thing to address is the localization of the timezone name itself. Time zone names are canonically in English (e.g., "Europe/Berlin"). The selector on Special:Preferences makes the region translatable, whereas the city/location name remains in English. If we want to copy that, we would have to either move the timezone localisation code to its own class, or copy that logic. If we're OK with keeping the region name in English, at least for the moment, then this is no longer a concern.

Finally, we need to make sure that the whole time + timezone string is localisable. I think the format may vary depending on the language, so we should create an interface message for it, whose English form could be "<time> (<timezone>)" (or maybe without the parentheses?), e.g. "14:30, 15 August 2022 (Europe/Berlin)".

I think the above should be enough, but I would also want to confirm that with someone who knows more about l10n, in case I missed something.