Knockout-Kendo.js DatePicker / WebAPI / ISO 8601 Date binding

asp.net-web-api, iso8601, kendo-ui, knockout.js

Solution

The Kendo.UI DatePicker uses the following default date time format: `MM/dd/yyyy h:mm tt`

So you just need to change it with the `format` option:

<input data-bind="kendoDatePicker: { value: bigday, format: 'yyyy-MM-dd' }" />

Demo JSFiddle.

Note that there is also a parseFormats which you can use if you want to parse your dates in one format but display them in a different format.

Problem

I'm having troubles with the ISO 8601 format as generated from the ASP.NET WebAPI and binding to the KendoUI DatePicker widget using Knockout-Kendo.js. References: ``` http://cdn.kendostatic.com/2012.3.1315/styles/kendo.common.min.css http://cdn.kendostatic.com/2012.3.1315/styles/kendo.default.min.css http://cdn.kendostatic.com/2012.3.1315/js/kendo.core.min.js http://cdn.kendostatic.com/2012.3.1315/js/kendo.web.min.js http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js http://rniemeyer.github.com/knockout-kendo/js/knockout-kendo.min.js ``` Html: ``` <span data-bind="text: bigday"></span><br /> <input data-bind="kendoDatePicker: bigday" /> ``` Javascript: ``` function ViewModel() { var self = this; self.bigday = ko.observable("2013-06-01T00:00:00"); // ISO 8601 date as returned from ASP.NET WebAPI } ko.applyBindings(new ViewModel()); ``` http://jsfiddle.net/bschafer/NGLEp/ For some reason the value is not binding to the KendoDatePicker but it is binding to the span w/o a problem.

Original source