//初始化设置
$('.date-picker-custom').datepicker({
language: "zh-CN",
autoclose: true,
format: 'yyyy-mm-dd',
clearBtn: true,
orientation:'bottom-left',
rtl : App.isRTL(),
/* todayBtn : true,
todayHighlight : true, */
autoclose : true,
viewDate : new Date(),
startDate : getDay(new Date(), 0, '-') //开始日期不能小于当天
}).on('changeDate', function (ev) {
$(ev.target).focusout();
$('#endDate').val(getDay(ev.date, 30, '-'));
});
//文本框初始日期设置,这里间隔为7天
$('#startDate').val(getDay(new Date(), 0, '-'));
$('#endDate').val(getDay(new Date(), 30, '-'));
//正数为往后加日期,负数为昨天、前天。。。,str为日期间隔符,例如 -,/
function getDay(currentDate, num, str) {
datepicker设置初始时间和时间联动计算
最新推荐文章于 2021-03-26 12:30:27 发布