我使用Date Range Picker插件进行bootstrap,我需要启用日期时间范围最多24小时。
以下示例允许我选择日期范围:
<input type="text" name="daterange" value="" />
<script type="text/javascript">
$(function() {
$('input[name="daterange"]').daterangepicker({
timePicker: true,
timePickerIncrement: 30,
locale: {
format: 'MM/DD/YYYY h:mm A'
}
});
});
</script>
选择开始日期和时间后,结束日期应为距开始日期和时间24小时。 (将结束日期和时间限制为从开始日期时间算起的24小时)
如何使用插件实现此目的?
答案 0 :(得分:0)
我会为oninput创建一个事件监听器,根据startdate unix时间戳测试enddate,然后如果它更大,则将其从输入的时间恢复到24小时。片段即将推出......
$('.parent > div').each(function(index, value) {
$(this).append(value);
});
&#13;
*** Following extensions are not compiled:
gdbm:
Could not be configured. It will not be installed.
Check ext/gdbm/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
making enc
make[1]: Nothing to be done for `enc'.
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
make[1]: Nothing to be done for `encs'.
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./x86_64-darwin16-fake ./tool/rbinstall.rb --make="/Applications/Xcode.app/Contents/Developer/usr/bin/make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"
installing binary commands: /Users/Hao/.rvm/rubies/ruby-head/bin
dyld: lazy symbol binding failed: Symbol not found: _utimensat
Referenced from: /Users/Hao/.rvm/src/ruby-head/libruby.2.5.dylib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _utimensat
Referenced from: /Users/Hao/.rvm/src/ruby-head/libruby.2.5.dylib
Expected in: /usr/lib/libSystem.B.dylib
make: *** [do-install-nodoc] Abort trap: 6
++ return 2
&#13;
编辑:bootstrap daterangepicker已经具有此功能的内置功能。</ p>