trentrichardson/jQuery-Timepicker-Addon — Issue #273: unable to have initial value
Author: goodale
Created: 2011-11-14 05:56:39+00:00
State: open

I am unable to get the datetimepicker to initialize with predfined date & time (e.g. from the app server). I've tried two methods and neither works:

1. providing a value in the value attribute of the element. I've made sure the format is the same as defined for the initializer. This method isn't documented but it would be the most obvious to me for easily setting the initial date/time for the input.

For example,

$('.datetime').datetimepicker({timeFormat:'hh:mm TT',dateFormat:'yy-mm-dd',hour:23,minute:59,ampm:true});

2. use 'setDate' after the input is initialized as datetimepicker

$('.datetime').datetimepicker({timeFormat:'hh:mm TT',dateFormat:'yy-mm-dd',hour:23,minute:59,ampm:true});
var regOpen = $('#reg_open');
var d = new Date(2010,5,10);
regOpen.datetimepicker('setTime',d);

In both cases the datetimepicker displays properly but shows the current date and time.

note: using latest production release along with: