0
votes

When I display the compact countdown with two significant digits it shows something like:

"2d 12:00:00" and minutes/seconds stay at "00" forever. How can I get it to display something like: "2d 12h" instead?

Strangely enough if I use the non-compact output, everything works as expected, i.e. it shows only "2 days 12 hours".

2
We can just guess. Any code to show? - Roko C. Buljan
Not sure what code you mean. I call it as code<span class="countdown"><?=Date::showTimeDifference($v['endDate'])?> <input type="hidden" value="<?=Date::secondsDifference($v['endDate'])?>" /></span> - user1583209
... and in jquery.countdown.js I have: "format: dhms" (all low caps), "compact: true", "significant: 2" - user1583209

2 Answers

1
votes

Apparently the compact option has a fixed layout. In order to achieve what I want, a custom layout needs to be created as follows

layout: '{d<}{dn}{dl}{d>} {h<}{hn}h{h>} {m<}{mn}m{m>} {s<}{sn}s{s>}'

0
votes

It's imortant to use layouts and there 'mnn' for minutes, 'snn' for seconds etc. Look the code below:

$('#compactLayout').countdown({
    until: liftoffTime, 
    compact: true, 
    layout: 'just <b>{dn} {dl} {hnn}{sep}{mnn}{sep}{snn}</b> {desc}', 
    description: 'to wait'
});

Use only 'sn' instead 'snn'