Hello, I would like to know how I could program the local time zone to show up for https://github.com/miraheze/CreateWiki/blob/master/SpecialRequestWiki.php instead of UTC. For example if my timezone is set as GMT -10 the Special:RequestWiki page should show the GMT - 10 time not the UTC.
Topic on Project:Support desk
@Ciencia Al Poder Any idea about this?
No idea, although you should clarify who is 'my timezone'? server or client
Client's timezone
The server has no idea about the client's timezone, that's not information that's sent in the request headers, so it will require JavaScript on the client to grab the timezone, and probably make an ajax call to the server to re-send the entire contents again in the correct timezone, or reparse all dates on the page with JavaScript (scary at best)
Hmm. Thanks for the response.
@Ciencia Al Poder Thinking about it, wouldn't it be possible if the clients timezone is set in Special:Preferences?
Yes, you can use the same methods Special:RecentChanges and page histories use to format dates and times
@Ciencia Al Poder I'm not exactly sure how I would integrate that into an extension.
You should probably hire a developer if you are not able to copy&paste what other parts of the code are already doing. I'm just a volunteer not actively working on MediaWiki code.
@Ciencia Al Poder Sorry for asking so much. If it's not to much bother could you at least point me to a similar extension that uses this type of code?
It's done in MediaWiki core, you can see Special:Log, Special:RecentChanges, Special:Contributions and page histories. It shouldn't be hard to see how the dates are transformed to the user timezone set in preferences...
Thank you