Installing JQuery for globalization using plain javascript - fuzzy error
I am trying to customize jquery globalize with suggested js / json setting (for date module) using the javascript example suggested here . <w> In this code, I am trying to customize it and use jquery-ui datepicker to format it:
(function () {
$(function () {
$.when(
$.getJSON("/Scripts/cldr/cldr-json/cldr-core-master/supplemental/likelySubtags.json"),
$.getJSON("/Scripts/cldr/cldr-json/cldr-numbers-modern-master/main/en/numbers.json"),
$.getJSON("/Scripts/cldr/cldr-json/cldr-core-master/supplemental/numberingSystems.json"),
$.getJSON("/Scripts/cldr/cldr-json/cldr-dates-modern-master/main/en/ca-gregorian.json"),
$.getJSON("/Scripts/cldr/cldr-json/cldr-dates-full-master/main/en/timeZoneNames.json"),
$.getJSON("/Scripts/cldr/cldr-json/cldr-core-master/supplemental/timeData.json"),
$.getJSON("/Scripts/cldr/cldr-json/cldr-core-master/supplemental/weekData.json")
).then(function () {
// Normalize $.get results, we only need the JSON, not the request statuses.
return [].slice.apply(arguments, [0]).map(function (result) {
return result[0];
});
}).then(Globalize.load).then(function () {
var culture = "en";
Globalize(culture);
$("input.datepicker").datepicker({
prevText: '<i class="fa fa-chevron-left"></i>',
nextText: '<i class="fa fa-chevron-right"></i>',
dateFormat: Globalize.dateFormatter({ date: "short" })
});
});
});})();
And I am getting error
E_DEFAULT_LOCALE_NOT_DEFINED: The default locale is undefined. in globalize.js @ line 105
What am I doing wrong?
+3
source to share
1 answer
I used the same code and had the same error. Instead:
var culture = "en";
Globalize(culture);
$("input.datepicker").datepicker({
prevText: '<i class="fa fa-chevron-left"></i>',
nextText: '<i class="fa fa-chevron-right"></i>',
dateFormat: Globalize.dateFormatter({ date: "short" })
});
I just have: Globalize.locale ("en"); and that fixed it.
- Make sure your function is called
- Make sure all your json objects are checked out
+5
source to share