From 34181d4b8ae00936325d137d201caf060a22df35 Mon Sep 17 00:00:00 2001 From: Jason Skowronek Date: Sat, 14 Feb 2015 15:28:55 -0700 Subject: [PATCH 1/2] added support for more than 99 days. might be better off adding support for months, but this will have to suffice for now. --- js/jquery.countdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.countdown.js b/js/jquery.countdown.js index 9ddcd82..513e2fa 100644 --- a/js/jquery.countdown.js +++ b/js/jquery.countdown.js @@ -185,7 +185,7 @@ var formatCompute = function(d, options) { }; // add leading zeros -var pad = function(x){return (1e15+""+x).slice(-2)}; +var pad = function(x){return (("" + x).length == 1) ? (1e15 + "" + x).slice(-2) : x;}; var digits = []; var intervals = []; From edcd528cd9d4b603203c05442c0da4d9cedf7f51 Mon Sep 17 00:00:00 2001 From: Jason Skowronek Date: Sat, 14 Feb 2015 16:03:51 -0700 Subject: [PATCH 2/2] fixed format padding pattern to handle more than 2 days digits --- js/jquery.countdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.countdown.js b/js/jquery.countdown.js index 513e2fa..6a92568 100644 --- a/js/jquery.countdown.js +++ b/js/jquery.countdown.js @@ -179,7 +179,7 @@ var formatCompute = function(d, options) { m: d.getUTCMinutes(), s: d.getUTCSeconds() }; - return format.replace(/(dd|hh|mm|ss)/g, function($0, form) { + return format.replace(/(d+|hh|mm|ss)/g, function($0, form) { return pad(parse[form[0]]); }); };