I am creating a penny auction site and I have several auctions on the home page. Each auction gets its own timer based on a date from the mysql date format, which is in format 'Y-m-d H:i:s'.
The code works fine and the timers all start counting down perfectly on Firefox and Chrome, but in Safari the number shows NaN:NaN:NaN
Here's my function, its using the jquery countdown plugin by Keith Wood:
function updateTimers() {
$( ".il-timer" ).each(function( index ) {
var timer = $(this);
var end_date = $(timer).attr('data-end-date');
var auction_id = $(timer).attr('data-auction-id');
var end = new Date(Date.parse(end_date,"yyyy-mm-dd hh:mm:ss"));
$('#auction_listing_timer_'+auction_id).countdown({until: end, format: 'HMS', compact: true, description: ''});
//Do it every 10 seconds...
setTimeout(function(){
updateTimers();
}, 10000);
});
};