Joel Prendes
asked 10 years ago

I use the DW Page theme, which has a Landing Page that uses jquery,countdown.min.js


According to Keith, the developer, this can be changed to countup by using (his code):

 $('#sinceCountdown').countdown({since: startYear, 
    format: 'YOWDHMS', description: 'Since New Year'});

However, in the landing.js script within DW Page, the code is as follows:

var dateStr=$(‘#countdown’).attr(‘data-until’); //returned from mysql timestamp/datetime field
var a=dateStr.split(” “);
var d=a[0].split(“-“);
var t=a[1].split(“:”);
var counto = new Date(d[0],(d[1]-1),d[2],t[0],t[1],t[2]);
$(‘#countdown’).countdown({until: counto});

I think most of that does not need to change, but could someone kindly tell me how I change the second piece of code to reflect the countup code?


Or, if you don’t want to use their code, just how to change the countdown timer in DW Page to a countup timer? Thanks!

1 Answers
answered 10 years ago

To resolve this issue you can open the  landing.js file in the folder path “dw-page/inc/assets/js/landing.js”. Remove all the code in this file then add the following code:

* Script for landing page
    var $dateStr=$('#countdown').data('until'); //returned from mysql timestamp/datetime field
    var $type = 'until';
    if( !$dateStr || $dateStr.length < 0 ) {
        $dateStr=$('#countdown').data('since'); //returned from mysql timestamp/datetime field
        $type = 'since';
    var a=$dateStr.split(" ");
    var d=a[0].split("-");
    var t=a[1].split(":");
    var counto = new Date(d[0],(d[1]-1),d[2],t[0],t[1],t[2]);
    if( $type == 'until' ) {
        $('#countdown').countdown({until: counto});    
    } else {
        $('#countdown').countdown({since: counto});    

Next, you can log in to Dashboard > Pages > Landing Page > open the “Text” frame then replace the following code:

 <div id="countdown" data-until="2013-9-25 10:00:00"></div>

With new code:

<div id="countdown" data-since="2013-9-25 10:00:00"></div>
Powered by DW Question & Answer Pro