JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//keith-wood.name/js/jquery.plugin.js"></script>
<script src="//keith-wood.name/js/jquery.countdown.js"></script>
<div data-zone="+10" class="countdown"></div>
<div data-zone="0" class="countdown"></div>
<div data-zone="-6" class="countdown"></div>
JavaScript
$('.countdown').each(function(){
// change the date in $.countdown.UTCDate($(this).data("zone") , 2015,4,23)
$(this).countdown({until:$.countdown.UTCDate($(this).data("zone") , 2015,4,22)}).on('update.countdown', function(event) {
var format = '%-S second%!S';
if (event.offset.years > 0 || event.offset.weeks > 0 || event.offset.days > 0 || event.offset.hours > 0 || event.offset.minutes > 0) {
if(event.offset.minutes > 0) {
format = '%-M minute%!M ' + format;
}
if(event.offset.hours > 0) {
format = '%-H hour%!H ' + format;
}
if(event.offset.days > 0) {
format = '%-d day%!d ' + format;
}
if(event.offset.weeks > 0) {
format = '%-w week%!w ' + format;
}
}
$(this).html(event.strftime(format));
}).on('finish.countdown', function(event) {
$(this).html('Finished');
});
});