5

I'm trying to play with the examples from jQuery UI, such as this one. I would like to use the globalization functions (for a currency field, for example), but it seems that Globalize.js has gone through a major API change, so that the code used in the UI examples doesn't work with the Globalize version I downloaded. For example, the jQuery UI depends on a Globalize.parseFloat function that doesn't exist in that version.

So apparently jQuery UI uses a legacy version of Globalize.js, but how should I download it? I couldn't find any information on that, neither on the API changes. I could download the JS files that are included by jQuery UI, obviously, but I was hoping for a "more official" solution.

Eduardo Dobay
  • 695
  • 1
  • 7
  • 15

3 Answers3

4

I can confirm that the Globalize 1.0.0-alpha releases are incompatible with the current jQuery UI 1.11.x releases. I have successfully used Globalize 0.1.1 with jQuery UI 1.11.x.

This blog post from jQuery UI indicates that they are "...working on a full rewrite of the datepicker widget. The rewrite will feature a far simpler API that will make customizations a lot easier. The rewrite builds on top of the rewritten Globalize library, which builds on top of CLDR, a comprehensive source for globalization data.". Hopefully, this rewrite will include more than just datepicker!

wedgef5
  • 81
  • 2
  • 8
  • 1
    That's correct. jQuery UI is working the migration to the new Globalize 1.0 for datepicker (https://github.com/jquery/jquery-ui/tree/datepicker-globalize-1.x) and for spinner (https://github.com/jquery/jquery-ui/tree/spinner-globalize-1.x). – Rafael Xavier May 14 '15 at 09:56
  • 2017 and Globalize 1.0 was released 2 years ago. Where is jQuery UI with this? – PapillonUK Mar 24 '17 at 11:33
  • I see the [jQuery UI roadmap](http://wiki.jqueryui.com/w/page/12138038/Roadmap) (updated 6 months ago) references these changes going into 1.13.x. That said, I don't even see a 1.13 branch in their repo yet, so it appears that it's going to be a while. – wedgef5 Mar 25 '17 at 16:03
2

It's 2016 already, two years later, but jQuery 1.11.x is still current (v1.12 in BETA). And I ran into this same issue for a brown-field project I'm doing. I managed to solve this thanks to the OP's analysis that jQuery UI indeed assumes the legacy Globalize version, and the solution of @wedgef5 to switch back to v0.1.1 of Globalize.

The OP did ask for an official answer. I guess there is none, but current best practice is to use a package manager. I use Bower which downloads the current version (now v1.1) by default. Assuming you did the same, you fix this in Bower as follows:

bower uninstall globalize --save

bower install globalize#0.1.1 --save

If you use a different package manager, something similar applies. After this code similar to this example works :). Your bower.json should be changed:

{ "name": "yourpackage", ... "dependencies": { ... "globalize": "0.1.1" // Used to be: "globalize": "^1.1.1" ... } ... }

Bart
  • 5,065
  • 1
  • 35
  • 43
0

Have you tried going to the releases tab in the globalize github project? You can cross-reference the release dates of globalize and jQueryUI and make your best guess from there.

MForMarlon
  • 865
  • 9
  • 24