Skip to content

Commit e1b0a27

Browse files
committed
Spinner: Use Globalize 1.x
1 parent 450d75f commit e1b0a27

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ui/spinner.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// AMD. Register as an anonymous module.
1515
define([
1616
"jquery",
17+
"globalize",
1718
"./core",
1819
"./widget",
1920
"./button"
@@ -23,7 +24,7 @@
2324
// Browser globals
2425
factory( jQuery );
2526
}
26-
}(function( $ ) {
27+
}(function( $, Globalize ) {
2728

2829
function spinner_modifier( fn ) {
2930
return function() {
@@ -407,19 +408,19 @@ return $.widget( "ui.spinner", {
407408

408409
_parse: function( val ) {
409410
if ( typeof val === "string" && val !== "" ) {
410-
val = window.Globalize && this.options.numberFormat ?
411-
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
411+
// FIXME handle optional different locales
412+
val = Globalize ? Globalize.parseNumber( val ) : +val;
412413
}
414+
// TODO: Why not to return NaN?
413415
return val === "" || isNaN( val ) ? null : val;
414416
},
415417

416418
_format: function( value ) {
417419
if ( value === "" ) {
418420
return "";
419421
}
420-
return window.Globalize && this.options.numberFormat ?
421-
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
422-
value;
422+
// FIXME handle optional different locales
423+
return Globalize ? Globalize.formatNumber( value, this.options.numberFormat ) : value;
423424
},
424425

425426
_refresh: function() {

0 commit comments

Comments
 (0)