$('#altdate').datetimepicker({
timeFormat: 'hh:mm:ss',
dateFormat: 'yy-mm-dd',
altField: "#Event_datetime",
altFormat: "yy-mm-dd",
altTimeFormat: 'hh:mm:ss',
altFieldTimeOnly: false,
onClose: function( selectedDate ) {
//alert(selectedDate);
$( "#altenddate" ).datetimepicker( "option", "minDate", selectedDate );
if (selectedDate < ($.datepicker.formatDate('yy-mm-dd', new Date())) ) {
start_in_past = true;
}
}
});
$('#altenddate').datetimepicker({
timeFormat: 'hh:mm:ss',
dateFormat: 'yy-mm-dd',
altField: "#Event_enddatetime",
altFormat: "yy-mm-dd",
altTimeFormat: 'hh:mm:ss',
altFieldTimeOnly: false,
onClose: function( selectedDate ) {
//alert(selectedDate);
$( "#altdate" ).datetimepicker( "option", "maxDate", selectedDate );
}
});
当我离开 datetimepicker 字段时,#Event_datetime 字段正确地填充了值“2012-12-23 13:00:00”;但是,当我关闭 enddate 之一时,该行
$( "#altdate" ).datetimepicker( "option", "maxDate", selectedDate );
场上只设“2012-12-23”!使用“maxDateTime”作为选项也不起作用,得到maxDateTime.getFullYear is not a function
.
如何根据客户的要求使用完整的字符串设置 maxDate(Time):yy-mm-dd hh:mm:ss