Created
July 16, 2014 09:03
-
-
Save davidfuhr/90147d9e2d9d296f1775 to your computer and use it in GitHub Desktop.
KendoUI DataSource timestamp handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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