or
$("#grid").kendoGrid({ dataSource:{ data:[ { utcdate: kendo.parseDate("2012-04-18 11:23:45Z", "u"), localdate: new Date() } ], schema:{ model:{ fields:{ utcdate:{ type:"date" }, localdate:{ type:"date" } } } } }, height:360, groupable:true, scrollable:true, sortable:true, pageable:true, columns:[ { field:"utcdate", title:"local from UTC", format:"{0:yyyy-MM-dd HH:mm:ss}", width: 150 }, { field:"utcdate", title:"UTC from UTC", format:"{0:u}", width: 150 }, { field:"utcdate", title:"UTC-S from UTC", format:"{0:s}", width: 150 }, { field:"localdate", title:"local from local", format:"{0:yyyy-MM-dd HH:mm:ss}", width: 150 }, { field:"localdate", title:"UTC from local", format:"{0:u}", width: 150 }, { field:"localdate", title:"UTC-S from local", format:"{0:s}", width: 150 } ]});Looking at the Kendo UI source code for parsing dates, it clearly does not have a check for the "Z" timezone marker. And is also missing a UTC() function call to create the date. The formatting functions also don't use the JavaScript Date UTC functions.
Can this be fixed globally somehow?
Best Regards,
Wannes.
01.uwdataSource = new kendo.data.DataSource({02. transport: {03. read: {04. url: crudServiceBaseUrl + "/GetUnderwriterData"05. },06. create: {07. url: crudServiceBaseUrl + "/POSTaddUnderwriterData",08. type: "POST",09. contentType: "application/json"10. }, 11. update: {12. url: crudServiceBaseUrl + "/POSTUnderwriterData",13. type: "POST",14. contentType: "application/json"15. },16. parameterMap: function (options, operation) {17. if (operation !== "read" && options.models) {18. return kendo.stringify(options.models[0]);19. }20. },21. error: function (args)22. {23. if (args.errors) {24. alert('there was an error');25. var grid = $("#underwriterGrid").data("kendoGrid");26. grid.one("dataBinding", function (e) { 27. e.preventDefault();//cancel grid rebind if error occurs 28. 29. for (var error in args.errors) {30. showMessage(grid.editable.element, error, args.errors[error].errors);31. } 32. });33. }34. 35. }36. },37. schema: {38. //Define the field which contains the error39. errors: function (response) {40. return response.error;41. }, 42.43. },//End of Schema
});
uwdataSource.bind("error", dataSource_error);
01.function showMessage(container, Code, errors) {02. var validationMessageTmpl = kendo.template($("#message").html());03. //add the validation message to the form04. container.find("[data-valmsg-for=" + Code + "],[data-val-msg-for=" + Code + "]").replaceWith($(validationMessageTmpl({ field: Code, message: errors[0] })))05. // .replaceWith(validationMessageTmpl({ field: name, message: errors[0] }))06. }07. 08.function dataSource_error(e) {09. alert(e.xhr.responseText); // displays "error"10. }//Index.cshtml<script type="text/kendo-template" id="message"> <div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error" style="margin: 0.5em; display: block; " data-for="#=field#" data-valmsg-for="#=field#" id="#=field#_validationMessage"> <span class="k-icon k-warning"> </span>#=message#<div class="k-callout k-callout-n"></div> </div></script>