From 834c3ee1dc4dae136feaebafaeee78a9e41da007 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 7 Jun 2011 10:55:46 +0200 Subject: [PATCH] Fixed javascript bug in price_format for max decimals. --- js/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/utils.js b/js/utils.js index 900db5b0..781382b3 100644 --- a/js/utils.js +++ b/js/utils.js @@ -213,12 +213,12 @@ function price_format(post, num, dec, label, color) { num = "0"; sign = (num == (num = Math.abs(num))); var max = dec=='max'; - if(max) dec = 15 - Math.floor(Math.log(Math.abs(num))); + if(max) dec = num==0 ? 2 : 15 - Math.floor(Math.log(Math.abs(num))); if(dec<0) dec = 2; decsize = Math.pow(10, dec); num = Math.floor(num*decsize+0.50000000001); cents = num%decsize; - num = Math.floor(num/decsize).toString(); + num = Math.floor(num/decsize).toString(); for( i=cents.toString().length; i