HcpShadow / jquery-numberformatter

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

accountancy number format #52

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi

would it be possible to support the following format string to allow for 
bracketing as used in accountancy

e.g

$.formatNumber(number, {format:"#,##0;(#,##0)", locale:"en"});

would yield

number = 1213.99 as 1,213.99
number = -1213.99 as (1,213.99)

What version of the product are you using? On what operating system?
1.2.2

Original issue reported on code.google.com by tpkni...@gmail.com on 7 Sep 2011 at 3:30

GoogleCodeExporter commented 8 years ago
sorry didn't mean to submit this as a defect... and now I can't seem to edit it 
to change its status

Original comment by tpkni...@gmail.com on 7 Sep 2011 at 3:31

GoogleCodeExporter commented 8 years ago
Don't worry, have just updated it.

To answer your question, yes in theory. I have time planned this weekend for 
some bug-fixes and changes, so I will investigate and get back to you on the 
subject, it does seem like a good idea.

Original comment by apar...@gmail.com on 7 Sep 2011 at 3:37

GoogleCodeExporter commented 8 years ago
Whilst this is easy enough to implement outside of the plugin with some simple 
logic such as -

if (number < 0)
   $.formatNumber(number, {format:"(#,##0)", locale:"en"});
else
   $.formatNumber(number, {format:"#,##0", locale:"en"});

I think when I come to do release 1.3 I will add it in, as likely quite a few 
people might find this useful.

Original comment by apar...@gmail.com on 5 Feb 2012 at 2:17