What's new in 2.2.0?
- Total count for hours
%I
, minutes%N
, seconds%T
; - Count to weeks left to complete a month
%W
(issue #210); - Defer initialization, allow control the start of the plugin (issue #198);
- Fix pluralization bug when return is zero ( issue #187).
Deferred initialization
Allows the registration of callbacks before starting the plugin, so always renders at the initialization.
$('#clock').countdown('YYYY/MM/DD', {defer: true})
.on('update.countdown', function(event) {
$(this).html(event.strftime('%D days till end...'));
})
.countdown('update') //
.countdown('start');
Total count
Standalone usage of any time component in the formatter:
%I
hours count till end;%N
minutes count till end;%T
seconds count till end;
$('#clock').countdown('YYYY/MM/DD', function(event) {
$(this).html(event.strftime('%I hours left'));
$(this).html(event.strftime('%N minutes left'));
$(this).html(event.strftime('%T seconds left'));
});
Weeks left %W
To use in conjunction of the months %m
displays only the weeks left to complete that month:
$('#clock').countdown('YYYY/MM/DD', function(event) {
$(this).html(event.strftime('%m months and %W weeks till end...'));
});