Community Wishlist Survey 2022/Bots and gadgets/Give gadgets the option to read current timezone used on wiki
Jump to navigation
Jump to search
Give gadgets the option to read current timezone used on wiki
- Problem: Many wiki's use other timezones than UTC, some of them even alternate with daylight saving time (DST). As a result, some gadgets that use the current time on the wiki (Twinkle for example) have to be modified when ported to another wiki. Also, JavaScript does not have a nice solution to detect when a wiki goes in to DST. (An example is nlwiki switching between CET and CEST).
- Proposed solution: Create a JavaScript variable (eg.
mw.currenttimezone
) with the time difference from UTC as its value. - Who would benefit: All wiki's that do not use UTC as their timezone.
- More comments:
- Phabricator tickets:
- Proposer: Bas dehaan (talk) 21:15, 22 January 2022 (UTC)
Discussion
- You can use
parseInt( mw.user.options.get( 'timecorrection' ).split( '|' )[ 1 ] )
to get the time offset of the current user in minutes (this came up during code review recently, thanks to SD0001 for tracking down the solution). Not sure if there's an easy way to get the default time offset of the wiki, though (without making an API request). --Tgr (talk) 19:35, 29 January 2022 (UTC)- @Tgr and @Bas dehaan I just happen to come across this today. You can actually retrieve the default time offset of a wiki by retrieving the site info. For instance: https://de.wikipedia.org/wiki/Spezial:ApiSandbox#action=query&format=json&meta=siteinfo&siprop=general will show that the timezone is Europe/Berlin and the time offset (on this specific day in the summer) is 120 minutes from GMT/UTC. —TheDJ (talk • contribs) 14:42, 9 August 2022 (UTC)
Voting
Support Fazart (talk) 00:44, 29 January 2022 (UTC)
Support it could also be handy if this were to be accessible through the API (for example for Toolforge-hosted tools) --Daniuu (talk) 11:09, 29 January 2022 (UTC)
Support clear quality of life improvement. Natuur12 (talk) 16:56, 29 January 2022 (UTC)
Support Not every wikis, especially smaller regional language wikis, use the UTC as their timezone. Thingofme (talk) 02:20, 30 January 2022 (UTC)
Support —— Eric Liu(Talk) 07:56, 30 January 2022 (UTC)
Support Matěj Suchánek (talk) 11:31, 30 January 2022 (UTC)
Support --g (talk) 15:17, 30 January 2022 (UTC)
Support Jmaxx37 (talk) 18:39, 30 January 2022 (UTC)
Support 🌸 Sakura emad 💖 (talk) 15:52, 31 January 2022 (UTC)
Support WikiAviator (talk) 09:54, 3 February 2022 (UTC)
Support Growthsakup (talk) 12:57, 4 February 2022 (UTC)
Support - Darwin Ahoy! 01:03, 5 February 2022 (UTC)
Support paul2520 (talk) 19:32, 5 February 2022 (UTC)
Support Vulp❯❯❯here! 03:39, 6 February 2022 (UTC)
Support Ayumu Ozaki (talk) 05:02, 6 February 2022 (UTC)
Support Toadspike (talk) 16:02, 6 February 2022 (UTC)
Support — Eric0892 02:20, 7 February 2022 (UTC)
Support ~~~~
User:1234qwer1234qwer4 (talk) 22:12, 7 February 2022 (UTC)Support Hanif Al Husaini (talk) 00:39, 8 February 2022 (UTC)
Support --evrifaessa (talk) 15:52, 11 February 2022 (UTC)