Countdown Timers - Bug introduced in v3.4

Report issues with Enuuk Auction Platform or Mods here - remember to raise a ticket with phpauction.net as well
Post Reply
RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Countdown Timers - Bug introduced in v3.4

Post by RWAP » Mon Aug 10, 2015 9:30 pm

v3.4 of Enuuk implemented an important change - to allow you to synchronise the countdown timers with the server clock - prior to this, if you opened the same window in several tabs, you could actually get a different countdown in each one.

The problem is that the synchronised time ignores the timezone on the server, so someone in another time zone will actually see a different countdown altogether (and may even see 0 hours, 0 minutes, 0 seconds on a live auction because their local time is in advance of the end of the auction) !!

To overcome this, in
themes\default\header.php

Find:

Code: Select all

            var countdownSync = <?=$siteOptions['countdownSync'] ?>;
Change this to read:

Code: Select all

            var countdownSync = <?=$siteOptions['countdownSync'] ?>;
            var serverTimeZone = <?=explode(':',date('P'))[0]?>;
Then, in themes\default\js\global.js
Find:

Code: Select all

    // Countdown
    $('span.countdown').each( function() {
        var tim = $(this);
        var dateField = tim.find('input').val();
        //dateField can be: just seconds before end (just numbers), or ending in js Date format
        var untilVal = /^\d+$/.test(dateField) ? dateField : eval("new Date("+dateField+")");
        //countdown admits both seconds delta and date as "until" field
        var params = {until:untilVal, expiryUrl: window.location.href};
        //Add server time synchronization
        params.serverSync = countdownSync ? serverTime : null;
        //Big or small clock format
        params.compact = tim.hasClass('smallClock');
        tim.countdown(params);
    });
Change this to read:

Code: Select all

    // Countdown
    $('span.countdown').each( function() {
        var tim = $(this);
        var dateField = tim.find('input').val();
        //dateField can be: just seconds before end (just numbers), or ending in js Date format
        var untilVal = /^\d+$/.test(dateField) ? dateField : eval("new Date("+dateField+")");
        //countdown admits both seconds delta and date as "until" field
        var params = {until:untilVal, expiryUrl: window.location.href};
        //Add server time synchronization
        params.serverSync = countdownSync ? serverTime : null;
        params.timezone = serverTimeZone;
        //Big or small clock format
        params.compact = tim.hasClass('smallClock');
        tim.countdown(params);
    });

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests