Search code examples
jquerytwitter-bootstrapcountdowncountdowntimer

Bootstrap countdown timer Jquery


I have the website: http://www.indiespil.dk/aitasi-under-construction-page/Aitasi/image/

I need to change the countdown timer, I am using Bootstrap, CSS and HTML.

The timer is a Jquery timer, this one: https://github.com/rendro/countdown/

I downloaded a HTML template and I have been editing. This single problem really struggles me! The code looks like this:

(function () {
  // Countdown
    // To change date, simply edit: var endDate = January 26, 2015 20:39:00";
    $(function() {
      var endDate = "January 26, 2015 20:39:00";
      $('.tk-countdown .row').countdown({
        date: endDate,
        render: function(data) {
          $(this.el).html('<div><div class="days"><span>' + this.leadingZeros(data.days, 2) + '</span><span>days</span></div><div class="hours"><span>' + this.leadingZeros(data.hours, 2) + '</span><span>hours</span></div></div><div class="tk-countdown-ms"><div class="minutes"><span>' + this.leadingZeros(data.min, 2) + '</span><span>minutes</span></div><div class="seconds"><span>' + this.leadingZeros(data.sec, 2) + '</span><span>seconds</span></div></div>');
        }
      });
    }); 
}());

When I change the Date to February, 28 2015 20:00:00 it simply removes the entire countdown timer from my website. What can I do?


Solution

  • Although I can't try the code myself, I'm willing to bet that the issue is an incorrect date format. in the original code, it has January 26, 2015 20:39:00, but you're trying to use February, 28 2015 20:00:00. See below:

    January 26, 2015 20:39:00
    February, 28 2015 20:00:00
            ^-------------------- this comma is misplaced
    

    Change it to February 28, 2015 20:00:00 and I bet you it'll work.

    Edit:

    looks like there is also a typo at the top of the file. It has

    ?jQuery(function($){
    

    for line 1. Remove the ?