Community Wishlist Survey 2022/Bots and gadgets/Give gadgets the option to read current timezone used on wiki

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)Reply[reply]


  • 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)Reply[reply]
    @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: 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 (talkcontribs) 14:42, 9 August 2022 (UTC)Reply[reply]
    Well, yes, by using the API, but that's not very practical. Tgr (talk) 17:45, 9 August 2022 (UTC)Reply[reply]