2

I am using Kendo datetime picker, as per their documentation I have set the date time as mentioned below, but by default this piece of code is setting current date and time. But I am looking for something like date time picker should be empty and user needs to be select the date and time. When I tried to remove the new Date() initialization, I was not getting date time picker at all it was just a textbox. Please anybody help in solving this issue.

$("#datetimepicker").kendoDateTimePicker({
value:new Date()
});
Abhinay
  • 338
  • 1
  • 7
  • 22

2 Answers2

3

set defaultOption to empty or null,

 defaultOption: null

Working Demo

Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
0

In case this helps someone else I was wanting to set the datetime empty in the Kendo UI Scheduler edit template's datetimepicker.

I first add a handler for the edit event .Events(e => e.Edit("onEdit")) and in the function I am setting the model's start and end values which the dropdown is bound to. I specifically check if the scheduler event is new with no recurrence ID to ensure the date/time is only cleared for new events but the value kept for editing existing events:

<script type="text/javascript">
   function onEdit(e) {
      var event = e.event;   
      if (event.isNew() && (event.recurrenceId == null)) {
         // default start/end times to empty
         event.set("start", "");
         event.set("end", "");
      }
   }
</script>
sonyisda1
  • 422
  • 1
  • 8
  • 21