jQuery Date "Invalid Date"

1

I have a countdown function that works regularly on Google Chrome

var now = new Date();
var countTo = new Date("9 July 2015 14:30:00:00");
alert(countTo);
$('.timer').countdown(countTo, function(event) {
    var $this = $(this);
    switch(event.type) {
        case "seconds":
        case "minutes":
        case "hours":
        case "days":
        case "weeks":
        case "daysLeft":
            $this.find('span.'+event.type).html(event.value);
            break;
        case "finished":
            $this.hide();
            break;
    }
});

However, I gave alert(countTo); in Firefox and got the message Invalid Date . Basically this script is meant to make the comparison with a date x and generate the countdown.

    
asked by anonymous 06.08.2014 / 16:36

2 answers

2

Rafael.

Try using this date format.

var countTo = new Date("2015/07/09 10:00:00");
    
06.08.2014 / 16:42
1

Just remove the milliseconds that works in IE, FF, and CH:

var countTo = new Date("9 July 2015 14:30:00");
alert(countTo);
    
06.08.2014 / 16:50