loicroot / jquery-countdown

Automatically exported from code.google.com/p/jquery-countdown
0 stars 0 forks source link

When days over 100 days, and "format" is "ddd:hh:mm:ss", the "ss" part would display "99" as max. #68

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For example,  
$('#countdown_1').countdown({
    format : "ddd:hh:mm:ss",
    image: 'libs/jquery-countdown/img/digits.png',
    startTime: "279:12:15:03"
});

it would display "279:12:14:99" after "279:12:15:00",

And I fixed it like this:
in file jquery.countdown.js line #46.

switch (options.format[i]) {
          case 'h':
            digits[c].__max = (':' == options.format[i-1]) ? 2: 9;
            if (':' == options.format[i-1] == 0)
              digits[c].__condmax = 4;
            break;
          case 'd':
            digits[c].__max = 9;
            break;
          case 'm':
          case 's':
            digits[c].__max = (':' == options.format[i-1]) ? 5: 9;
        }

Original issue reported on code.google.com by michael.the.ranidae on 25 Nov 2013 at 3:47

GoogleCodeExporter commented 9 years ago
BTW, "':' == options.format[i-1]" is just for me, it would not solve this 
problem if ":" is not a splitter .

Original comment by michael.the.ranidae on 25 Nov 2013 at 3:53