I'd like to have a datetimepicker that displays the date and time by default but only displays the date if the time is midnight. It should update the format when the value is changed. I can format the value when the datetimepicker is created to one or the other format, but if the time changes, I can't seem to update the picker's format. Any ideas on how to do this?
http://jsbin.com/ekilok/1/
http://jsbin.com/ekilok/1/
$(document).ready(function () { var dateFormat = "{0:M/d/yy}"; var datetimeFormat = "{0:M/d/yy h:mm tt}"; var d = new Date(2012, 11, 8, 11, 20); var d2 = new Date(2012, 11, 8); $('#StartWithDate').kendoDateTimePicker({ value: d, format: (d.getHours() === 0) ? dateFormat : datetimeFormat, change: function(e) { /* what goes here */ } }); $('#StartWithDateTime').kendoDateTimePicker({ value: d2, format: (d2.getHours() === 0) ? dateFormat : datetimeFormat, change: function(e) { /* what goes here */ } }); });