嗨我正在尝试为链接的日期时间选择器开发bootstrap jquery但是使用jsfiddle http://jsfiddle.net/srknthcse/CujDK/311/我没有正常工作我选择了No-library ...任何帮助将不胜感激。谢谢你
<div class="container">
<div class='col-md-5'>
<div class="form-group">
<div id="startdatetime-from" class="input-append date">
<input type="text" id="datetimepicker-input" readonly ></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
<div class='col-md-5'>
<div class="form-group">
<div id="startdatetime-from1" class="input-append date1">
<input type="text" id="datetimepicker-input1" readonly ></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
</div>
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear();
var hours= d.getHours();
var minutes=d.getMinutes();
$(function() {
$('#startdatetime-from').datetimepicker({
language: 'en',
showMeridian:'true',
autoclose:'true',
format: 'hh:mm PP dd-MM-yyyy '
});
$("#startdatetime-from").data('datetimepicker').setLocalDate(new Date(year, month, day, hours, minutes));
var d1=new Date();
var d2=new Date(d1);
var addedhour=d2.setHours(d1.getHours()+4);
$('#startdatetime-from1').datetimepicker({
language: 'en',
showMeridian:'true',
autoclose:'true',
format: 'hh:mm dd-MM-yyyy '
});
$("#startdatetime-from1").data('datetimepicker').setLocalDate(new Date(year, month, day, hours, minutes));
$("#startdatetime-from").on("dp.change", function (e) {
$('#startdatetime-from1').data("DateTimePicker").minDate(e.date);
});
$("#startdatetime-from1").on("dp.change", function (e) {
$('#startdatetime-from').data("DateTimePicker").maxDate(e.date);
});
});
答案 0 :(得分:0)
<div class="container">
<div class='col-md-10'>
<div class="form-group">
<div id="startdatetime-from" class="input-append date">
<input type="text" id="datetimepicker-input" readonly></input>
</div>
<div></div>
<div class='col-md-10'>
<div class="form-group">
<div id="startdatetime-from1" class="input-append date1">
<input type="text" id="datetimepicker-input1" readonly></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
</div>
</div>
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear();
var hours = d.getHours();
var minutes = d.getMinutes();
$(function () {
$('#startdatetime-from').datetimepicker({
language: 'en',
autoclose: 'true',
format: 'HH:mm PP dd-MM-yyyy '
});
$("#startdatetime-from").data('datetimepicker').setLocalDate(new Date(year, month, day, hours, minutes));
$('#startdatetime-from1').datetimepicker({
language: 'en',
autoclose: 'true',
format: 'HH:mm PP dd-MM-yyyy '
});
$("#startdatetime-from1").data('datetimepicker').setLocalDate(new Date(year, month, day, hours+4, minutes));
});