html 代码
//清除历史缓存 autocomplete="off"
<input type="text" class="layui-input form-control" id="date-time" name="date-time" autocomplete="off">
js代码
layui.use('laydate', function () {
let layDate = layui.laydate;
let maxDate = dateFormat('YYYY-mm-dd 23:59:59',new Date());
//日期范围
layDate.render({
elem: '#date-time',
range: '~',
format: 'yyyy-MM-dd hh:mm:ss',
type:'datetime',
max:maxDate,
//选择结束日期默认当天23:59:59
ready: function(date){
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
$(".laydate-main-list-1 .layui-laydate-content li ol li:last-child").click();
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
}
});
});