Frage

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".

War es hilfreich?

Lösung

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>}'

Andere Tipps

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'

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top