Skip to content

Instantly share code, notes, and snippets.

@davidfuhr
Created July 16, 2014 09:03
Show Gist options
  • Save davidfuhr/90147d9e2d9d296f1775 to your computer and use it in GitHub Desktop.
Save davidfuhr/90147d9e2d9d296f1775 to your computer and use it in GitHub Desktop.
KendoUI DataSource timestamp handling
transport: {
parameterMap: function (options, operation) {
if (operation === "update" || operation === "create") {
$.each(options, function (key, value) {
if (value instanceof Date) {
options[key] = Math.round(value.getTime() / 1000);
}
});
}
return options;
}
},
schema: {
model: {
fields: {
dateField: {
parse: function (value) {
if (value && !(value instanceof Date)) {
value = new Date(value * 1000);
}
return value;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment