Opened 7 years ago

Last modified 7 years ago

#15030 open bug

Incompatibility with Globalize v1.x

Reported by: Éric Cordeiro Owned by:
Priority: blocker Milestone: 1.13.0
Component: ui.spinner Version: 1.12.0
Keywords: Cc:
Blocked by: Blocking:

Description

The Spinner widget uses Globalize functions that are no longer supported in the current version of the library (1.x).
That functions are: Globalize.parseFloat and Globalize.format which were replaced respectively by Globalize.parseNumber and Globalize.formatNumber.

https://github.com/jquery/globalize/blob/master/doc/migrating-from-0.x.md#globalizeformat
https://github.com/jquery/globalize/blob/master/doc/migrating-from-0.x.md#globalizeparseintparsefloat

--> master/ui/widgets/spinner.js

(...)
_parse: function( val ) {
	if ( typeof val === "string" && val !== "" ) {
		val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat( val, 10, this.options.culture ) : +val;
	}
	return val === "" || isNaN( val ) ? null : val;
},

_format: function( value ) {
	if ( value === "" ) {
		return "";
	}
	return window.Globalize && this.options.numberFormat ? Globalize.format( value, this.options.numberFormat, this.options.culture ) : value;
},
(...)

My suggestion is to test the version of Globalize to switch the correct functions.

Change History (2)

comment:1 Changed 7 years ago by Scott González

Milestone: none1.12.1
Priority: minorblocker
Status: newopen

comment:2 Changed 7 years ago by Scott González

Milestone: 1.12.11.13.0

The changes are too big, because we support more than just number formats. We already have API changes for spinner planned for 1.13 which will remove the use of Globalize inside spinner and just expose formatting and parsing options where the end user can use Globalize directly (which will be our recommendation). As such, 1.12 will continue to only support Globalize 0.x.

Note: See TracTickets for help on using tickets.