prochy77 / jquery-numberformatter Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/jquery-numberformatter
Automatically exported from code.google.com/p/jquery-numberformatter
What steps will reproduce the problem?
1. have a very long number; say 123456789012345678901234567890123456789
2. use the numberFormatter
What is the expected output? What do you see instead?
expected output: either nicely formatted, or, if using scientific notation,
something like
1,234564456354+38 (or something)
what is given:
1..23.456.789.012.345.68e.+38,00
What version of the product are you using? On what operating system?
Please provide any additional information below.
Sample html:
<html>
<head/>
<body>
<!-- yeah. ensure that these are available... but ok -->
<script type="text/javascript" src="jquery-uncompressed.js"></script>
<script type="text/javascript" src="jshashtable-2.1_src.js"></script>
<script type="text/javascript" src="jquery.numberformatter-1.2.1.js"></script>
<script>
$(document).ready( function() {
$(".number").each( function() {
$(this).formatNumber({locale:"de"});
}
);
$(".number").each( function() {
console.log("element width(chars): " + this.innerHTML.length);
console.log("element width: " + this.clientWidth );
}
);
} );
</script>
<div>
<div class="number">12</div>
<div class="number">23000002342342.234</div>
<div class="number"
style="width:auto">123456789012345678901234567890123456789</div>
</div>
</body>
Original issue reported on code.google.com by [email protected]
on 28 Feb 2011 at 4:11
What steps will reproduce the problem?
$.formatNumber('000000000', {format:"000,000,000",locale:"de"})
or
$.formatNumber(0, {format:"000,000,000",locale:"de"})
What is the expected output? What do you see instead?
I would expect the result to be 000,000,000 but instead, the result is 000000000
What version of the product are you using? On what operating system?
jquery-numberformatter v1.2, jquery 1.6.1
Original issue reported on code.google.com by dan.imbrogno
on 12 Jun 2011 at 4:04
What steps will reproduce the problem?
1. Initialise flipcounter with some basic options.
2. Bind a function to onAnimationStopped option
3. In that function do a flipcounter startAnimation which sets the number
option to: getNumber + 500.
4. When document is ready call step() for the first time initially.
What is the expected output? What do you see instead?
I except the animation just to keep on going and each time incrementing by 500.
What version of the product are you using? On what operating system?
1.1, Windows 7, FF5
Please provide any additional information below.
$(document).ready(function() {
$("#counter").flipCounter({
number: 0, // the initial number the counter should display, overrides the hidden field
formatNumberOptions: {
format:"$000,000,000,000,000",
locale:"us"
},
digitClass:"counter-digit", // class of the counter digits
counterFieldName:"counter-value", // name of the hidden field
digitHeight:40, // the height of each digit in the flipCounter-medium.png sprite image
digitWidth:30, // the width of each digit in the flipCounter-medium.png sprite image
imagePath:"img/flipCounter-medium.png", // the path to the sprite image relative to your html document
onAnimationStarted:false, // call back for animation upon starting
onAnimationStopped:step, // call back for animation upon stopping
onAnimationPaused:false // call back for animation upon pausing
});
step();
});
function step()
{
$("#counter").flipCounter(
"startAnimation",
{
number: parseInt(($("#counter").flipCounter("getNumber") + 500)),
//easing: jQuery.easing.easeInOutQuad,
duration: 3000
});
}
I've fixed this problem by editing the 1.1 source code. I've added a function:
// Remove an option
function _removeOption(option) {
data.remove(option);
}
Which is called at the end of _stopAnimation():
// Stop animation
function _stopAnimation() {
if(true !== _getOption('animating')) return false;
clearInterval(_getOption('interval'));
_setOption('number', _getOption('end_number'));
_setOption('start_number', null);
_setOption('end_number', null);
_setOption('timer', 0);
_setOption('animating',false);
var onAnimationStopped = _getOption('onAnimationStopped');
if(typeof onAnimationStopped == 'function') onAnimationStopped.call(obj, obj);
_removeOption('onAnimationStopped');
}
With this possibility I can determine my own pace of the animation. I could
increment numbers for x seconds then wait x seconds and increment again. This
gives a bit more flixibility.
Original issue reported on code.google.com by [email protected]
on 18 Aug 2011 at 6:44
Attachments:
What steps will reproduce the problem?
1. r10 or higher
2. load page attempting to use $.numberFormat in client code
3. Notice Chrome's console bark at you about no $._roundNumber being defined.
TypeError: Object function $(element) {
...
} has no method '_roundNumber'
What is the expected output? What do you see instead?
see above
What version of the product are you using? On what operating system?
1.2.2.min on Mac OS X, Chrome 11.0.696.68
jshashtable 2.1
jquery 1.4.4 min
Please provide any additional information below.
r10 to r12 exhibit the problem. Changing $._roundNumber to jQuery._roundNumber
seems to solve it for me. $ isn't passed into the scope, jQuery is.
Original issue reported on code.google.com by [email protected]
on 23 May 2011 at 8:01
It would be good if this also provided an option for adding ordinal
suffixes to numbers.
Original issue reported on code.google.com by [email protected]
on 16 Apr 2010 at 2:23
[deleted issue]
What steps will reproduce the problem?
1. format: #,###.00、local:us
2. test number: 4.9999
3. result:4.0
What is the expected output? What do you see instead?
5.0
What version of the product are you using? On what operating system?
jquery.numberformatter-1.1.2.js
Please provide any additional information below.
Separately calculate integer and decimal places
Original issue reported on code.google.com by [email protected]
on 12 Mar 2010 at 5:35
Using jquery.numberformatter-1.2.1.js
var ss = '' + $.formatNumber(23, { format: "000" });
I expect "023" but getting "23" instead.
I need to keep that leading zero.
Original issue reported on code.google.com by [email protected]
on 17 Dec 2010 at 4:55
What steps will reproduce the problem?
1.jQuery.parseNumber( '5%' ) => 0
2.jQuery.parseNumber( '16% ) => 0.2
3.jQuery.parseNumber( '24%' ) => 0.2
What is the expected output? What do you see instead?
Results should be 0.05, 0.16, and 0.24 respectivbely
What version of the product are you using? On what operating system?
numberformatter 1.2.2 with jQuery 1.4.4
Please provide any additional information below.
[1] Number.prototype.toFixed uses $ in place of jQuery
[2] In jQuery.parseNumber function, if number is a percentage, the minimum
precision must be 2
Original issue reported on code.google.com by [email protected]
on 25 Aug 2011 at 2:16
What steps will reproduce the problem?
1. Fill a "lire" input with the value of a "euro" input (two textbox).
2. txtEuro is $("#txtEuro") and txtLire is $("#txtLire")
3. I use this:
function calculateLire(txtEuro, txtLire) {
var euro = $(txtEuro).parse({ locale: "it" });
if (euro == 0) {
$(txtLire).val(0);
}
else {
$(txtLire).val((euro * 1936.27));
// at this point txtLire contain a correct value ("us" formatted)
$(txtLire).format({ format: "#.000", locale: "it" });
}
}
Locale "it" have dec="," , group="." like "de"
What is the expected output? What do you see instead?
with "1" in txtEuro I have 193627,000.
Correct string is 1936,270 .
I also try this trick:
$(txtLire).format({ format: "#.000", locale: "us" });
$(txtLire).format({ format: "#.000", locale: "de" });
but not does what I want...
How can I use this plugin for obtain the right result?
What version of the product are you using? On what operating system?
version 1.1.2 (on Windows XP, Firefox and Maxthon)
Please provide any additional information below.
I think the problem is on format function:
// now we need to convert it into a number
while (text.indexOf(group) > -1)
text = text.replace(group, '');
the number 1936.27 become 193627 here...
bye
Alessandro
Original issue reported on code.google.com by alessandro.piccione.75
on 23 Jun 2009 at 11:05
What steps will reproduce the problem?
1. create a var in javascript equal to a number. (e.g. var myNum=2343.543)
2. execute $(myNum).formatNumber({format:"#,###.00", locale:"us"});
3.
What is the expected output? What do you see instead?
Expected myNum to now be 2,343.54, or for the return value of this function
call to be that formatted number. Instead, you get an error from jQuery that "a
is undefined"
What version of the product are you using? On what operating system?
1.2.1 on Windows 7 in Firefox 4, with Firebug 1.7.0
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 7 Apr 2011 at 6:41
What steps will reproduce the problem?
1. loading the script
What is the expected output? What do you see instead?
Any, I see error: Hashtable is not defined
What version of the product are you using? On what operating system?
1.2.1 Linux Ubuntu 64b
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Dec 2010 at 2:26
What steps will reproduce the problem?
1. If i intro "hello"
2. I get "Nan.Nan"
3. Is posible to get "0.00" instead of Nan.Nan?
Original issue reported on code.google.com by [email protected]
on 8 Jul 2010 at 4:04
One line of code was enough...
I've added the line :
locale == "tr" ||
to this part of your code...
Thanks for writing this useful code...
-------
else if (locale == "de" ||
locale == "vn" ||
locale == "es" ||
locale == "dk" ||
locale == "at" ||
locale == "gr" ||
locale == "tr" ||
locale == "br"
)
{
dec = ",";
group = ".";
}
---------
Original issue reported on code.google.com by [email protected]
on 1 Jun 2009 at 10:39
Attachments:
What steps will reproduce the problem?
1. Set format pattern "#,###.###".
javascript code example is this.
$('#forms1').format({format:"#,###.###", locale:"jp"});
2. Write input field with value "3456.00".
html code example is this.
<input name="textfield" type="text" id="forms1" maxlength="20"
value="333333.0000000">
3. Formatted value "3,456." is displayed.
What is the expected output? What do you see instead?
I want to display "3,456" in textfield.
What version of the product are you using? On what operating system?
Windows Vista
Internet Explorer 7
jquery 1.3.1
jquery.numberformatter.js 1.1.1
Please provide any additional information below.
I needed decimalSeparatorAlwaysShown flag,
such as decimalSeparatorAlwaysShown flag in Java SDK java.text.NumberFormat.
(here from
http://java.sun.com/j2se/1.5.0/docs/api/java/text/NumberFormat.html)
decimalSeparatorAlwaysShown : only affects formatting, and only where
there might be
no digits after the decimal point, such as with a pattern like
"#,##0.##", e.g.,
if true, 3456.00 -> "3,456." if false, 3456.00 -> "3456"
And then, I implemented decimalSeparatorAlwaysShown flag in this
numberformat library.
Please check this code, and Would you take patch into
jquery-numberformatter code ?
Original issue reported on code.google.com by advweb.nanasi.jp
on 11 Mar 2009 at 5:26
Attachments:
What steps will reproduce the problem?
1. use IE7
2. $.numberFormat(0, {format:"#,##0"})
3. $.numberFormat(0.234, {format:"#,##0.00"})
What is the expected output? What do you see instead?
for 2. expected output = 0, but IE7 returns null
for 3. expected output = 0.23, but IE7 returns .23
What version of the product are you using? On what operating system?
jquery.numberformatter-1.2.1.js, Windows 7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 17 Nov 2010 at 5:16
What steps will reproduce the problem?
1. enter 1,9999 into the txtAmount textbox
2. $("#txtAmount").format({format:"#.00",locale:'nl'});
What is the expected output? What do you see instead?
- expected: 2,00
- I see 1,00
What version of the product are you using? On what operating system?
1.1.2 (OS = windows)
Original issue reported on code.google.com by [email protected]
on 18 Jan 2010 at 10:24
In The Netherlands (Holland) for currencies we use a dot as the thousands
separator, e.g. EUR 1.234.567,89
But for other numbers a (narrow) space is used, e.g. 1 234 567,89
For more info and other countries (to make the list complete):
http://en.wikipedia.org/wiki/Decimal_separator#Arabic_numeral_system
Original issue reported on code.google.com by [email protected]
on 19 Feb 2009 at 11:09
What steps will reproduce the problem?
1. Apply the number format (#,###)
2. Apply the number format again (#,###)
3. Results in NaN on a number like 1,234,567
What is the expected output? What do you see instead?
Should not do anything.
What version of the product are you using? On what operating system?
1.1.0
Please provide any additional information below.
Using along with tablesorter. If I sort twice, results in the NaN on large
numbers.
Original issue reported on code.google.com by [email protected]
on 27 May 2010 at 11:29
What steps will reproduce the problem?
1. Type '1.15' in a field
1. Run formatNumber({format:"#,##0.##%", locale:"us"}) on the field
What is the expected output? What do you see instead?
If the field is labeled as a percentage and is showing a default of, say,
"1.25%", expected result might be "1.15%", but instead it is "115%"
What version of the product are you using? On what operating system?
1.2.2, Mac OS X 10.6.8
Please provide any additional information below.
Sometimes, if a field is marked as a percentage and is showing a percentage
value, users will expect to be able to type in a similar value and simply omit
the % sign. I'm working around this by first adding "%" to the number if it
doesn't already have it, before parsing/formatting it.
Original issue reported on code.google.com by [email protected]
on 29 Aug 2011 at 5:37
I'm using the new version 1.2. I just add a new line in test.html "<script
type="text/javascript" src="prototype-1.6.0.3.js"></script>". Then the
formatter doesn't work.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2010 at 7:57
Attachments:
What steps will reproduce the problem?
1. Create input field with "5000000.56789" value.
Sample html code is this.
<input type="text" value="5000000.56789" size="50" id="target" />
2. Use jquery.numberformatter-1.1.1.js, and
format text value with "#,###.###" pattern. ("dec" is "." in locale:jp)
Sample javascript code is this.
$('#target').format({format:"#,###.###", locale:"jp"});
3. "5,000,000.5" is displayed in textfield.
Neither "5,000,000.567" and "5,000,000.568" is displayed.
What is the expected output? What do you see instead?
"5,000,000.567", or "5,000,000.568" are displayed in textfield.
What version of the product are you using? On what operating system?
Windows Vista
Internet Explorer 7
jquery 1.3.1
jquery.numberformatter.js 1.1.1
Please provide any additional information below.
I found javascript code problem.
Please check my posting patch, and Would you fix your
jquery.numberformatter.js library code ?
Original issue reported on code.google.com by advweb.nanasi.jp
on 12 Mar 2009 at 1:05
Attachments:
What steps will reproduce the problem?
1. Format "00"
2. Number is "3"
3. format should return "03"
Can a format for leading zeros be specified?
Original issue reported on code.google.com by [email protected]
on 25 Mar 2010 at 1:54
What steps will reproduce the problem?
1. Use IE6
2. As JScript does not have Array's indexOf, define it into Array.prototype
3. The loop in function init() while be wrong, since it will include indexOf
What version of the product are you using? On what operating system?
1.2-RELEASE
Please provide any additional information below.
Instead of a for/in loop on nfAllLocales, use plain old for(;;) loop, as it will not include user defined prototype attribute (in this case Array.prototype.indexOf)
Original issue reported on code.google.com by [email protected]
on 14 Oct 2010 at 1:33
What steps will reproduce the problem?
<html>
<head>
</head>
<body>
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script src="jquery.numberformatter.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery('span').format({format:"#,##0.00 EUR", locale:"de"});
});
// document.writeln("Number: " + jQuery.format({format:"#,###.00",
locale:"de"}));
</script>
</body>
<span>10000.1</span>
</html>
What is the expected output? What do you see instead?
Expected: 10.000,10 EUR
Actual: 100.001,00 EUR
What version of the product are you using? On what operating system?
1.1.2 on Windows
Please provide any additional information below.
In US locale it works correctly
Original issue reported on code.google.com by [email protected]
on 23 Apr 2009 at 11:59
What steps will reproduce the problem?
1.
JavaScript
$("#testPercent").blur(function(){
//alert($(this).val()+' -- '+$(this).parseNumber({format:"#.##%", locale:"us"}));
$(this).parseNumber({format:"#.##%", locale:"us"});
$(this).formatNumber({format:"#.##%", locale:"us"});
});
$("#testPercent1").blur(function(){
$(this).parseNumber({format:"#.00%", locale:"us"});
$(this).formatNumber({format:"#.00%", locale:"us"});
});
HTML
<table border="0">
<tbody>
<tr>
<td>Field 4. On blur formats %</td>
<td><input id="testPercent" type="text" tabindex="1" />
</td>
<td>Format: "#.##%" Locale: "us"</td>
</tr>
<tr>
<td>Field 5. On blur formats %</td>
<td><input id="testPercent1" type="text" tabindex="1" />
</td>
<td>Format: "#.00%" Locale: "us"</td>
</tr>
</tbody>
</table>
2. When a value with two decimals and percentage sign is entered, the last
digit is lost
3. Entered: 3.33%
What is the expected output? What do you see instead?
Expected: 3.33% Result: 3.3% in the first field and 3.30% in the second field
What version of the product are you using? On what operating system?
1.2.2 jQuery 1.6.2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 24 Aug 2011 at 7:16
Maybe I'm just using it the wrong way, but this plugin does not work for me at
all. A few examples, tested on version 1.1.0:
A) $.formatNumber() does not work at all:
1. $.formatNumber(123456.789, {format: "#,##0.0", locale: "us"})
2. expected result: "123,456.8"
3. actual result "123456.789"
B) Dosn't work with other locales, either:
1. $.formatNumber(123456.789, {format: "#,##0.0", locale: "de"})
2. expected result: "123.456,8"
3. actual result "123456,789"
C) Formatting a number in an element also does not work:
1. $("<span>123456.789</span>").format({format: "#,##0.0", locale: "de"}).text()
2. expected result: "123.456,8"
3. actual result "123.456.789,0"
D) And also:
1. $("<span>0</span>").format({format: "#", locale: "us"}).text()
2. expected result: ""
3. actual result: "0"
It looks like this plugin has some serious issues.
I can understand, to a certain extent, that in C) the plugin expects the text
value to be in the locale I ask for (maybe I should be able to specify an
inputLocale parameter?).
Anaway that's the case $.formatNumber() should be able to handle, only that
this function does not do anything useful at all. Looking at its
implementation, it should be renamed to formatString() or something, because
formatting a number is certainly not what it does. ;-)
Original issue reported on code.google.com by [email protected]
on 16 Aug 2010 at 12:22
What steps will reproduce the problem?
1. call $.formatNumber with a number and formatting options
What is the expected output? What do you see instead?
A formatted string (12345->12,345, I get 12345)
What version of the product are you using? On what operating system?
1.1.0
Please provide any additional information below.
I extracted the code that actaully does the formatting from $.fn.format
and created a new formatNumber method that is called by $.fn.format for
each JQuery object, but can also be called for any string representing a
number.
I didn't see the point in keeping the old formatNumber method (it should
probably be renamed to represent what it does, which is convert to locale)
jquery objects aren't the only way you might want to use this
functionality, I needed this change to support number formatting in
JavaScript Templates.
another small issue, $.format and $.parse are a generic names that are
used by other unrelated plugins, it should probably be named
$.formatNumber and $.parseNumber to avoid conflicts with other plugins
Original issue reported on code.google.com by [email protected]
on 24 Mar 2009 at 5:36
Attachments:
What steps will reproduce the problem?
1. enter the number 1000000.12345 to an input with id="elemId"
2. call format function for the input like this:
$("#elemId").format({format:"###,##0.00###"});
What is the expected output?
1,000,000.12345
What do you see instead?
1,000,000.123
What version of the product are you using?
1.1.0 with jquery 1.3.2
On what operating system?
red hat 5 with firefox 3.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Feb 2010 at 5:38
What steps will reproduce the problem?
1. entering negative number to the field
2.
3.
What is the expected output? What do you see instead?
I see NaN instead -1234
What version of the product are you using? On what operating system?
Last version, winXp
Please provide any additional information below.
I tried to format with
$("#field").format({format:"-#,###,###", locale:"hu"}); doesn't help.
Original issue reported on code.google.com by [email protected]
on 22 Jan 2009 at 3:30
What steps will reproduce the problem?
1. Select a group of elements to format
2. Observe that the format is correctly applied to the first match
3. Observe that it's not for the subsequent matches.
Example:
<table>
<tr><td class="money">2.5</td></tr>
<tr><td class="money">2.5</td></tr>
<tr><td class="money">2.5</td></tr>
<tr><td class="money">2.5</td></tr>
</table>
<script type="text/javascript">
jQuery('td.money').format({format:'$#,###.00',locale:'us'});
</script>
Expected output:
$2.50
$2.50
$2.50
$2.50
Actual output:
$2.50
2.50
2.50
2.50
(Note that part of the format works, but the $ part is lost after the first
value).
Original issue reported on code.google.com by [email protected]
on 11 Feb 2010 at 7:19
Hi, I am looking for a very simple example of using this code, such as:
<html>
<body>
<script language=javascript>
var mynumber = 1234567.8901
document.write("hi this is the number " + mynumber.format("#,##0.00", "en"))
</script>
</body>
</html>
I see some partial examples in the project home but it's not clear to me how to
do the above. Would it be possible to provide a complete example that includes
all of the HTML code and lists out all of the js code that is referenced by the
HTML?
Original issue reported on code.google.com by [email protected]
on 30 Apr 2011 at 2:04
What steps will reproduce the problem?
1. Use non US format, Russia for example:
$(this).formatNumber({format: "# ###", locale: "ru"});
What is the expected output? What do you see instead?
Hard-coded US number format.
What version of the product are you using? On what operating system?
1.2.1
Please provide any additional information below.
In attach diff for resolve this problem.
Original issue reported on code.google.com by [email protected]
on 7 Dec 2010 at 3:05
Attachments:
What steps will reproduce the problem?
1. browser ie8
2. use the following code:
$(function(){
$(".amount").live('blur',function(){
$(this).parseNumber({format:"#,##0.00", locale:"nl"});
$(this).formatNumber({format:"#,##0.00", locale:"nl"});
});
});
3. when I leave the input field blank, on blur it will display ',00' instead of
the expected output '0,00'. It works correct in ff and chrome.
What version of the product are you using? On what operating system?
jquery.numberformatter-1.2.1.js, windows 7, browser ie8
Please provide any additional information below.
The problem is on line 323:
onesFormat.substr(-1,1) => this will return '#' in ie and '0' in chrome or ff
with the format "#,##0.00"
I replaced it with onesFormat.charAt(onesFormat.length-1) and it worked fine.
Original issue reported on code.google.com by [email protected]
on 11 Jan 2011 at 8:56
What steps will reproduce the problem?
1. Add an input field. Value: "0,998"
2. Format with NumberFormatter using "0.00" as format, locale "de" (US
locale should have the same problem)
3.
What is the expected output?
"1,00"
What do you see instead?
"0,00"
What version of the product are you using? On what operating system?
1.1.2
Code lines 294 ff do not take add carry into account.
Therefore, nearly useless plugin.
Original issue reported on code.google.com by [email protected]
on 24 Nov 2009 at 9:50
What steps will reproduce the problem?
1. User inputs number with more than one group separator (e.g. 5,000,000)
2. Call "format" function
3. Notice that you get a "NaN"
What is the expected output? What do you see instead?
I expect to get back "5,000,000" (or whatever, based on format string). Instead
I'm getting NaN.
What version of the product are you using? On what operating system?
Firefox 3.0.7, Mac OS X 10.4.11
Please provide any additional information below.
The "text.replace(group,'')" only removes the first instance of the grouping
separator. It should
remove all of them. See attached for a patch.
Original issue reported on code.google.com by [email protected]
on 11 Mar 2009 at 4:45
Attachments:
Add a wrapper / single method to call parse and format in a single call.
Original issue reported on code.google.com by [email protected]
on 9 May 2011 at 8:52
What steps will reproduce the problem?
1. Create a test page referencing jquery and the latest numberformatter
2. add the following to the html:
<div id="test">-434.4343</div>
<script type="text/javascript">
$("#test").format({format:"-#,###.00", locale:"us"});
</script>
What is the expected output? What do you see instead?
I expected the output to read "-434.43". Instead I see "-,434.43".
What version of the product are you using? On what operating system?
jquery 1.3.1, numberformatter 1.1.0, windows server 2008
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 4 Feb 2009 at 9:58
else if (locale == "de" ||
locale == "vn" ||
locale == "es" ||
locale == "dk" ||
locale == "at" ||
locale == "gr" ||
locale == "br" ||
locale == "it"
)
{
dec = ",";
group = ".";
}
Original issue reported on code.google.com by [email protected]
on 21 Sep 2009 at 11:16
$('<p>1</p><p>2</p><p>3</p>').format({format:'Price: #,###.00 €'})
will output:
<p>Price: 1.00 €</p><p>2.00</p><p>3.00</p>
where it should be:
<p>Price: 1.00 €</p><p>Price: 2.00 €</p><p>Price: 3.00 €</p>
Solution:
Move lines 215-243 before line 209 (return each...)
Regards, Blaz
Original issue reported on code.google.com by [email protected]
on 12 May 2010 at 5:17
What steps will reproduce the problem?
1.JavaScript:
$("#testPercent").blur(function(){
//alert($(this).val()+' -- '+$(this).parseNumber({format:"#.##%", locale:"us"}));
$(this).parseNumber({format:"#.##%", locale:"us"});
$(this).formatNumber({format:"#.##%", locale:"us"});
});
HTML
<input id="testPercent" type="text" tabindex="1" />
2.Enter 3.33%. Tab out. Results is 3.3%. Expected: 3.33%
3. Tab in
What is the expected output? What do you see instead?
Expected: 3.3%. Result: 3%. Repeat again. Expected: 3% Result: %
What version of the product are you using? On what operating system?
1.2.2. jQuery 1.6.2.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 24 Aug 2011 at 7:11
What steps will reproduce the problem?
1. override the $ operator.
var $my= jQuery.noConflict();
2. try to format a number
amount = $my.formatNumber(amount, {format:'#,###.00', locale:'us'});
What is the expected output? What do you see instead?
I expected the formatted amount. I've got a javascipt error instead:
$ is null or not an object.
What version of the product are you using? On what operating system?
Version 1.2.2? Windows7/IE8
Please provide any additional information below.
a fix would be to not use the '$.' operator in the plugin.
instead user direct 'jQuery.'.
Original issue reported on code.google.com by [email protected]
on 8 Jul 2011 at 8:35
PL (Polish) locale is same as FR (123 456,78), so quick fix will be:
var nfLocalesLikeFR = [ 'cz','fi','fr','ru','se','pl' ];
Original issue reported on code.google.com by [email protected]
on 7 Sep 2010 at 2:03
What steps will reproduce the problem?
var fakediv= $("<div>");
fakediv.html(0.026030368763557687);
fakediv.format({format:"#,###.00", locale:"de"});
What is the expected output? What do you see instead?
0,02 but i get: 26.030.368.763.557.690,00
What version of the product are you using? On what operating system?
1.1.2 windows/firefox 3.6
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 13 Aug 2010 at 11:56
Add it in the same "if" expression as Brazil "br":
if (
...
locale == "br" ||
locale == "pt"
)
{
dec = ",";
group = ".";
}
Original issue reported on code.google.com by rgl%[email protected]
on 25 Jan 2010 at 11:00
If someone enters a number that is not supported by the current locale (e.g.
"45,3" instead of
"43.3") the resulting string will be "NaN.Na". This is a bit ugly. Maybe it
would be better to do
nothing instead, just return the original string...
Original issue reported on code.google.com by [email protected]
on 13 Aug 2009 at 12:59
What steps will reproduce the problem?
1. in IE Number.toFixed(x) does no rounding
2. in Firefox/Webkit Number.toFixed(x) does rounding
What is the expected output? What do you see instead?
An input of 0.05 with a format of #,##0.0 should result in 0.1:
IE = 0.0
Firefox/Webkit = 0.1
Please provide any additional information below.
Remove toFixed on #283 and either round or truncate, e.g to round:
var k = Math.pow(10, decimalFormat.length);
number = (Math.round(number * k) / k).toString();
Original issue reported on code.google.com by [email protected]
on 15 Feb 2011 at 1:37
What steps will reproduce the problem?
1. jshashtable-2.1_src.js , jshashset_src.js , jquery.numberformatter-1.2.1.js
2. jquery.1.4
3. just run it and throw uncaught error
What is the expected output? What do you see instead?
the number being format properly like what it said in description
What version of the product are you using? On what operating system?
1.2.1 - Chrome.4
Please provide any additional information below.
-- entire error
Uncaught Error: key must not be undefined
(anonymous function)jshashtable-2.1_src.js:85
putjshashtable-2.1_src.js:217
initjquery.numberformatter-1.2.1.js:127
formatCodesjquery.numberformatter-1.2.1.js:135
jQuery.parseNumberjquery.numberformatter-1.2.1.js:405
KG.Grid.helpers.addCommasgrids.js:617
fields.renderergrids.js:659
Ext.grid.GridView.Ext.extend.doRenderext-all-debug.js:46544
Ext.grid.GroupingView.Ext.extend.doRenderext-all-debug.js:51147
Ext.grid.GridView.Ext.extend.renderRowsext-all-debug.js:47295
Ext.grid.GroupingView.Ext.extend.renderRowsext-all-debug.js:51091
Ext.grid.GridView.Ext.extend.renderBodyext-all-debug.js:47300
Ext.grid.GridView.Ext.extend.afterRenderext-all-debug.js:46622
Ext.grid.GroupingView.Ext.extend.afterRenderext-all-debug.js:51036
callext-all-debug.js:1459
Original issue reported on code.google.com by [email protected]
on 3 Feb 2011 at 11:21
What steps will reproduce the problem?
1. Set percent format on blur ("#.0%").
2. Enter any numeric value and than lose the focus.
3. Set the focus again and lose it again.
What is the expected output? What do you see instead?
Expected formatted value with % postfix.
Instead we can see: NaN,N%
What version of the product are you using? On what operating system?
v. 1.1.2, OS Win XP SP3
Please provide any additional information below.
jQuery.fn.format failed.
Line 249: var number = new Number(text.replace(dec,".").replace(neg,"-"));
Original issue reported on code.google.com by [email protected]
on 13 Oct 2009 at 5:49
What steps will reproduce the problem?
1. make the script to run when onblur (just like the example)
2. enter non numeric entry
3. the value will be NaN.NaN
What is the expected output? What do you see instead?
0 (zero), for certain people, make it zero is more reasonable than NaN.NaN
What version of the product are you using? On what operating system?
NumberFormatter version 1.1.2 (dated 2/6/08)
Please provide any additional information below.
you can add this line of code at line 241 just after the var number = new
Number(text.replace(dec, ".").replace(neg, "-")); code.
here is the code to force it to 0 if NaN value produced.
if (isNaN(parseFloat(number))) number = 0;
Original issue reported on code.google.com by [email protected]
on 12 Nov 2009 at 12:55
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.