jquery-countdown icon indicating copy to clipboard operation
jquery-countdown copied to clipboard

How do I display 3 digits for days ('ddd')?

Open osumac24 opened this issue 10 years ago • 9 comments

I'd like to countdown from a date that is more than 99 days away.

osumac24 avatar Jan 28 '15 18:01 osumac24

I need this too. Any fix for this?

chyenw avatar Mar 20 '15 05:03 chyenw

I forked this project with the change to include 3 digit days.

skowronek avatar Mar 20 '15 06:03 skowronek

Interesting! i tried using it but i can't seem to get the countdown timer to work well. I want it do count down to 20th March 2016.

  $(function(){
    $(".digits").countdown({
      image: "img/digits.png",
      format: "dd:hh:mm:ss",
      endTime: new Date(2016,3,20)
    });

but the days seems wrong... any help?

chyenw avatar Mar 20 '15 07:03 chyenw

Try this:

$(function(){
    $(".digits").countdown({
      image: "img/digits.png",
      format: "ddd:hh:mm:ss",
      endTime: new Date(2016,3,20)
    });

The API is pretty explicit to the format parameter. I modified is to allow unlimited dddddd's, so you could theoretically show all days.

skowronek avatar Mar 20 '15 16:03 skowronek

I was unable to find a solution so I ended up using/modifying flipclock.js

osumac24 avatar Mar 20 '15 17:03 osumac24

I read everything I could find here but still I only get 2 digits for days. Here's my code:

jQuery(document).ready(function($) {
    $('#counter').countdown({ 
        image: "wp-content/themes/sometheme/img/digits.png", 
        format: "ddd:hh:mm:ss", 
        endTime: new Date('12/29/16 23:59:59') 
    });
});

jadeye avatar Jun 29 '16 18:06 jadeye

is there a way to show only days and hrs? seems like ddd:hh couting down from hours as seconds... any suggestions?

zilahir avatar Oct 16 '16 16:10 zilahir

For 3 digits, try to modify this lines 148 --> if( format.indexOf('ddd') == 0 ) { 182 --> return format.replace(/(ddd|hh|mm|ss)/g, function($0, form) { 188 --> var pad = function(x){if(x > 99){return x}else{return (1e15+""+x).slice(-2)}

For me works

luisaoxxy avatar Apr 11 '18 14:04 luisaoxxy

I'd like to countdown from a date that is more than 99 hours. Is there a way to show 3 digits hrs?

clock = $('.clock').FlipClock({ clockFace: 'HourlyCounter', autoStart: false, language: 'es', callbacks: { stop: function() { $('.message').html('The clock has stopped!') } } }); but when hours is >99 seems wrong... any help?

sakara27 avatar Feb 27 '19 14:02 sakara27