Project:Countdown
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

#1

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?

#2

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?

#3

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..

#4

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

nobody click here