wulanrahayu / jquery-formatcurrency

Automatically exported from code.google.com/p/jquery-formatcurrency
GNU General Public License v3.0
0 stars 0 forks source link

NaN output produced when '-.01' input #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. http://jsbin.com/iniri3/5/edit
2. Alternatively from #1, go to 
http://bendewey.com/code/formatcurrency/demo/format_as_you_type.html and type 
in "-.01" in bottom left input field.

What is the expected output? What do you see instead?
Expected output: -$0.01
Actual output: ($NaN.01)

What version of the product are you using? On what operating system?
jQuery 1.3.2 with latest jquery-formatcurrency as of 6/23/10.

Please provide any additional information below.

Original issue reported on code.google.com by ryan.mck...@nrel.gov on 23 Jun 2010 at 5:19

GoogleCodeExporter commented 9 years ago
Accepted and committed (rev#58) to repository to be included in next release 
(v1.4)

Original comment by bdewe...@hotmail.com on 23 Jun 2010 at 5:55

GoogleCodeExporter commented 9 years ago
Amazingly fast response!  You made the change as quickly as I could hack-patch 
it, kudos :)

In case it's helpful to anyone, here is a quick fix for 1.3.  It is a hack, so 
I'd recommend checking out trunk and minifying it for critical apps.

jQuery.fn.formatCurrencyIssue19Fix = function() {
  $this = $(this);
  var num = $this[$this.is('input, select, textarea') ? 'val' : 'html']();
  num = num.replace("-.","-0.");
  $this[$this.is('input, select, textarea') ? 'val' : 'html'](num);
};

$('.selector').formatCurrencyIssue19Fix();

Original comment by ryan.mck...@nrel.gov on 23 Jun 2010 at 6:05

GoogleCodeExporter commented 9 years ago
jQuery FormatCurrency v1.4 has been released

Original comment by bdewe...@hotmail.com on 24 Jun 2010 at 3:34