I noticed that when using it for a count up function, the code does not count up, it counts down once the page is loaded.

Comments

ogiebobo’s picture

I was able to get it to work by changing the value of _countdown_direction to 1, instead of -1 in the countdown.js file. Should the code do this automatically if the date set is in the past?

BarisW’s picture

Did anyone got this working? It seems that the whole .js is prepared to work with a negative _countdown_direction, it just have to be set somewhere.
I'm not sure how to compare the current time and the displayed time in JS thought. Anyone?

BarisW’s picture

Ah, I found the bug.
The problem is that countdown.js checks for a string in the html..

        else if (thisChild.nodeName == '#text') {
          if (thisChild.nodeValue.indexOf(' since') >= 0) {
            _countdown_direction = 1;
            this.objDirText = thisChild;
          }
          else if (thisChild.nodeValue.indexOf(' until') >= 0) {
            this.objDirText = thisChild;
          }
        }

I changed the output of my html by overriding countdown.tpl.php
And in that file I changed the default string '@hours, @minutes, @seconds since @event' to 'You are @hours, @minutes and @seconds overdue'.

Changing the word since to overdue solved my problem, but it would be much better if the JS doesn't rely on textual strings in the code..

BarisW’s picture

At least... you should wrap a Drupal.t() around it so these strings are translatable and the countup still works in all languages.

usingsession’s picture

Issue summary: View changes
Status: Active » Closed (outdated)