新版laydate设置起始时间,并根据起始时间设置结束时间最大值

<script>

//开始时间

var start = laydate.render({

elem: '#takedate',

type: 'date', //可选择:年月日

// theme: '#44acff',

min: -0, //最小日期为当前日期的前一天

max: +89,

trigger: 'click', //采用click弹出

 

ready: function () {

start.hint('日期可选值设定在 <br> 今日起89天内');

},

 

done: function (value, date, endDate) {

if(date!=''){

end.config.min = {

year: date.year,

month: date.month - 1,

date: date.date,

hours: date.hours,

minutes: date.minutes,

seconds: date.seconds

}; //开始日选好后,重置结束日的最小日期

end.config.max = {

year: date.year,

month: date.month - 1,

date: date.date + 89,

// hours: date.hours,

// minutes: date.minutes,

// seconds: date.seconds

}; //开始日选好后,重置结束日的最小日期

end.config.value = {

year: date.year,

month: date.month - 1,

date: date.date,

hours: date.hours,

minutes: date.minutes,

seconds: date.seconds

}; //将结束日的初始值设定为开始日

}

else{

end.config.min = {

year: '',

month: '',

date: '',

hours: '',

minutes: '',

seconds: ''

}; //开始日选好后,重置结束日的最小日期

end.config.btns = ['clear', 'now', 'confirm'];

}

}

});

 

//时间有效范围设定在: 上午八点到下午十点

var starttime = laydate.render({

elem: '#taketime',

format: 'HH:mm',

type: 'time', //可选择:时分秒

min: '08:00:00',

max: '22:00:00',

trigger: 'click' //采用click弹出

});

 

//结束时间

var end = laydate.render({

elem: '#stilldate',

type: 'date', //可选择:年月日时分秒

min: -0, //最小日期为当前日期的前一天

max: '2099-6-16 23:59:59',

trigger: 'click', //采用click弹出

ready: function () {

end.hint('日期可选值设定在 <br> 取车日起89天内');

},

 

done: function (value, date, endDate) {

if (date != '') {

// start.config.max = {

// year: date.year,

// month: date.month - 1,

// date: date.date,

// hours: date.hours,

// minutes: date.minutes,

// seconds: date.seconds

// }; //结束日选好后,重置开始日的最大日期

}

else {

start.config.max = {

year: '',

month: '',

date: '',

hours: '',

minutes: '',

seconds: ''

}; //开始日选好后,重置结束日的最小日期

start.config.btns = ['clear', 'now', 'confirm'];

}

}

});

//时间有效范围设定在: 上午八点到下午十点

var endtime = laydate.render({

elem: '#stilltime',

format: 'HH:mm',

type: 'time', //可选择:时分秒

min: '08:00:00',

max: '22:00:00',

trigger: 'click', //采用click弹出

});

 

</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值