Problems, need help? Have a tip or advice? Post it here.
12 posts Page 2 of 2
I think, Simon, this is what is happening -

The timeago script compares the dates set in the <abbr> elements with the local date of the visitor's system and then shows the difference.

One problem with the way we have been outputting the publish date
Code: Select all
<abbr class="timeago" title="<cms:show k_page_date />"> .. </abbr>

would be that visitors from other time zones will see the interval as compared to their local times so, for example, a page published in UK just two minutes back will be shown as 7 hours ago for someone who is in a UTC+07:00 time zone.

To rectify this, please make the following changes:
Code: Select all
<cms:set my_time_zone='+07:00' />
<abbr class="timeago" title="<cms:date k_page_date format='Y-m-d' />T<cms:date k_page_date format='H:i' /><cms:show my_time_zone />"> .. </abbr>

In the code above we are outputting the timestamp in ISO 8601 format (e.g. 2007-04-05T14:30+01:30) that has the time-zone info attached.
If your time zone is GMT itself, use '+00:00';

The second change that you should make is this:
In the jquery.timeago.js file, find the following line
Code: Select all
settings: {
      refreshMillis: 60000,
      allowFuture: false,

Set the allowFuture to true.
Code: Select all
settings: {
      refreshMillis: 60000,
      allowFuture: true,

These changes should rectify the problem.
If, however, you find that a new post shows you '1 Hour from now' instead of '1 minute ago', it would suggest that Couch is using the wrong timezone for your publish dates. This is set in the config file
Code: Select all
define( 'K_GMT_OFFSET', +7.5 );

Modify this to your zone.
Please remember that only new files will take the revised time zone.

Hope this helps. Please let me know.
Hi KK, its currently showing correctly now


Ignore the above :lol: Looks like it's working now
12 posts Page 2 of 2