Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

LocalTimes

Summary: Display RecentChanges and History timestamps in the local timezone of each visitor.
Version: 20121231
Prerequisites: JavaScript
Status: Beta
Maintainer: Petko
Users: +3 (view / edit)
Discussion: LocalTimes-Talk?

Description

When many authors from different countries use a wiki, it is annoying to see the date/time stamps in a single timezone, different from their own. For an author in Europe or in New Zealand, having the dates in the Dallas/TX timezone makes it hard to estimate when an edit was actually done.

The recipe rewrites the timestamps in RecentChanges pages and on page histories to show the time in the local timezone of each author. The original date/time string is moved to a tooltip/title and appears when the mouse cursor is positioned over the link.

The recipe is now enabled on pmwiki.org, see for example Site.AllRecentChangesShort.

Installation

Copy localtimes.js to your pmwiki/pub directory. Add to local/config.php such code:

foreach($RecentChangesFmt as $k=>$v)
  $RecentChangesFmt[$k] = str_replace('$CurrentTime',
    '[[{$Group}.{$Name}?action=diff#diff$Now|$CurrentTime ]]', $v);

if(@$_GET['nolt']==''
  && ($action=="diff" || strpos($pagename, 'RecentChanges')!==false)) {
    $HTMLFooterFmt['LocalTimes'] = '<script type="text/javascript"
      src="$FarmPubDirUrl/localtimes.js"></script>';
}

Note that the first part of the code is the same as in the recipe "Better RecentChanges" from TrackChanges. If you already have it installed, you don't need to repeat the code.

Configuration and usage

Currently nothing can be configured. The recipe doesn't need any interaction.

Notes

The visitors' browsers need to have JavaScript enabled or they will see the date/time in the timezone of the server.

Change log / Release notes

  • 20121231 - minor refactoring, changes from less than 24 hours show just the time.
  • 20121109 - changed today's changes to show just the time.
  • 20110607 - fix tooltip titles in Internet Explorer.
  • 20110605 - first public release, ready to be tested.

See also

Contributors

Petko is author and maintainer of this recipe.

Comments

See discussion at LocalTimes-Talk?

User notes +3: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on December 31, 2012, at 09:25 PM