企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 日期选择 参考文档: [https://xdsoft.net/jqplugins/datetimepicker/](https://xdsoft.net/jqplugins/datetimepicker/) [TOC] ## 选择日期 ![](https://box.kancloud.cn/700998ff0274f7978cfb91e5c66145b6_247x219.png) ``` <input id="datetimepicker" class="form-control"> <script> require(['hdjs'], function (hdjs) { hdjs.datetimepicker('#datetimepicker', { timepicker: false, format: 'Y-m-d', onChangeDateTime: function (dp, $input) { console.log($input.val()) } }); }) </script> ``` ## 日期与时间 ![](https://box.kancloud.cn/de19c63f28c1120558a902a1d0b511a0_313x246.png) ``` <input id="datetimepicker" class="form-control"> <script> require(['hdjs'], function (hdjs) { hdjs.datetimepicker('#datetimepicker',{ format:'Y-m-d H:i:s', step:5, onChangeDateTime:function(dp,$input){ console.log($input.val()) } }); }) </script> ``` ## 区间时间 ![](https://box.kancloud.cn/d7f434b3e3dbb7d577689d8a3202ccd6_377x224.png) ``` Start <input id="date_timepicker_start" value=""> End <input id="date_timepicker_end" value=""> <script> require(['hdjs'], function (hdjs) { hdjs.datetimepicker('#date_timepicker_start',{ format:'Y/m/d', onShow:function( ct ){ this.setOptions({ maxDate:jQuery('#date_timepicker_end').val()?jQuery('#date_timepicker_end').val():false }) }, timepicker:false }); hdjs.datetimepicker('#date_timepicker_end',{ format:'Y/m/d', onShow:function( ct ){ this.setOptions({ minDate:jQuery('#date_timepicker_start').val()?jQuery('#date_timepicker_start').val():false }) }, timepicker:false }); }) </script> ``` ## 时间选择 ![](https://box.kancloud.cn/2aec04a67d2dc39a437b2136d888989f_204x234.png) ``` 时间<input id="datetimepicker" class="form-control""> <script> require(['hdjs'], function (hdjs) { hdjs.datetimepicker('#datetimepicker',{ datepicker: false, format: 'h:i' }); }) </script> ```