Setting it up was very simple:
var defaultStart = new Date(); defaultStart.setMinutes(0); defaultStart.setSeconds(0); $('#startDate').datetimepicker({ startDate: defaultStart, onChangeDateTime: function(dp) { vm.event.startTime(dp && dp.getTime()); } });
There are many options available when setting up the picker. In this case I used the 'startDate' so that by default it shows today's date for the event. The 'onChangeDateTime' function is called when a user has made a change to the date time and in this case I use it to update the Knockout view model with the selected time.
Source code is available at bitbucket or you can play with the live test site.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.