Topic on Project:Support desk

Program local timezone for extension

13
Reception123 (talkcontribs)
Reception123 (talkcontribs)
Ciencia Al Poder (talkcontribs)

No idea, although you should clarify who is 'my timezone'? server or client

Reception123 (talkcontribs)

Client's timezone

Ciencia Al Poder (talkcontribs)

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)

Reception123 (talkcontribs)

Hmm. Thanks for the response.

Reception123 (talkcontribs)

@Ciencia Al Poder Thinking about it, wouldn't it be possible if the clients timezone is set in Special:Preferences?

Ciencia Al Poder (talkcontribs)

Yes, you can use the same methods Special:RecentChanges and page histories use to format dates and times

Reception123 (talkcontribs)

@Ciencia Al Poder I'm not exactly sure how I would integrate that into an extension.

Ciencia Al Poder (talkcontribs)

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.

Reception123 (talkcontribs)

@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?

Ciencia Al Poder (talkcontribs)

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...

Reception123 (talkcontribs)

Thank you

Reply to "Program local timezone for extension"