Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(function($) {
var kendo = window.kendo;
var globalize = window.Globalize;
function expandNumberFormat(numberFormat) {
numberFormat.groupSizes = numberFormat.groupSize;
numberFormat.percent.groupSizes = numberFormat.percent.groupSize;
numberFormat.currency.groupSizes = numberFormat.currency.groupSize;
}
kendo.culture = function (cultureName) {
var cultures = kendo.cultures, culture;
if (cultureName !== undefined) {
culture = kendo.findCulture(cultureName) || cultures[EN];
culture.calendar = culture.calendars.standard;
cultures.current = culture;
if (globalize && !globalize.load) {
expandNumberFormat(culture.numberFormat);
}
} else {
return cultures.current;
}
};
if (globalize && !globalize.load) {
kendo.toString = function (value, format, culture) {
if ($.isPlainObject(culture)) {
culture = culture.name;
}
return globalize.format(value, format, culture);
};
}
if (globalize && !globalize.load) {
kendo.parseDate = function (value, format, culture) {
if (objectToString.call(value) === '[object Date]') {
return value;
}
return globalize.parseDate(value, format, culture);
};
kendo.parseFloat = function (value, culture) {
if (typeof value === NUMBER) {
return value;
}
if (value === undefined || value === null) {
return null;
}
if ($.isPlainObject(culture)) {
culture = culture.name;
}
value = globalize.parseFloat(value, culture);
return isNaN(value) ? null : value;
};
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.