Ch Hong
Ch Hong

Reputation: 378

Countdown Today date in jquery

The code below is working perfectly, but when I change the date to today's date (for example: 2016/01/06 05:00:00) then the countdown will show to 00 days 00:00:00, but still got 4 hour need to count down. How can I do it?

<span class='countdown' value='2016/01/06 05:00:00'></span><br />
<span class='countdown' value='2016/04/06 23:59:59'></span><br />
<span class='countdown' value='2016/05/07 01:15:15'></span><br />

$(function(){
    $('.countdown').each(function(){
        $(this).countdown($(this).attr('value'), function(event) {
        $(this).text(
        event.strftime('%D days %H:%M:%S')
      );
        });
    });
});

a jsFiddle example - https://jsfiddle.net/smh5nhgz/1/

Upvotes: 0

Views: 91

Answers (1)

Mukund Kn
Mukund Kn

Reputation: 45

The countdown worked fine for me.

<span class='countdown' value='2016/01/06 05:00:00'></span><br />

It shows 00 days 00:00:00 only if the set time is greater than the current time. I was able to get a 4 hour count down.

Upvotes: 1

Related Questions