<div class="layui-inline"> <label class="layui-form-label">申请时间</label> <div class="layui-input-inline"> <input type="text" class="layui-input" id="timeStart" placeholder=" - "> </div> 至 <div class="layui-input-inline"> <input type="text" class="layui-input" id="timeEnd" placeholder=" - "> </div> </div>
- layui.use('laydate', function(){
- var laydate = layui.laydate;
- var startDate = laydate.render({
- elem: '#timeStart'
- ,max:"2099-12-31"
- ,done: function(value, date){
- endDate.config.min ={
- year:date.year,
- month:date.month-1,
- date: date.date
- };
- }
- });
- var endDate = laydate.render({
- elem: '#timeEnd'
- ,min:"1970-1-1"
- ,done: function (value, date) {
- startDate.config.max={
- year:date.year,
- month:date.month-1,
- date: date.date
- }
- }
- });
- })
注意:设置月份时需要减一