Search code examples
jqueryfirefoxcountdown

jQuery countdown Keith Wood not working in mozilla


I am working on a site and I've installed Keiths Woods's jQuery countdown. It's working perfectly on Chrome but in IE, Mozilla, iPad, and iPhones it does not work. The count down counts perfectly until 10.1.2012. It shows 72 days, 7 hours and so on. On other browsers it shows NaN days, NaN hours and so on.

I have the following HTML:

<html>
<head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jquery.countdown.min.js"></script>
    <script type="text/javascript" src="scripts.js"></script>
    <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="jquery.countdown.css" media="screen" />
</head>
<body>
    <div class="body">
        <div class="countdown"></div>
        <div class="logo"></div>
    </div>
</body>
</html>

Inside scripts.js I have:

$(document).ready(function(){
    var date = new Date('10.1.2012'); 
    $('.countdown').countdown({until: date , format: 'DHMS'}); 
});

What is wrong with jquery.countdown.min.js? I have no idea what to do.


Solution

  • Try uncapping the D to d:

    $('.countdown').countdown({until: date , format: 'dHMS'}); 
    

    Because the same is done on the homepage of the plugin:

    $(selector).countdown({until: liftoffTime, format: 'dHM'});
    

    Edit: Change to the following, it works for me in Safari:

    var date = new Date(2012, 10-1, 1);
    

    The parsing of the string probably went wrong in browsers other than Chrome.