您当前的位置: > 个人博客 > javascript

datepicker,结束时间必须大于开始时间

2016-10-13 00:16:48 点击量:45 标签: 收藏本文

$('#js-start-time').datepicker({
	dateFormat:'yy-mm-dd',
	onSelect: function( startDate ) { var $startDate = $( "#js-start-time" ); var $endDate = $('#js-end-time'); var endDate = $endDate.datepicker( 'getDate' ); if(endDate < startDate){
			$endDate.datepicker('setDate', startDate - 3600*1000*24);
		}
		$endDate.datepicker( "option", "minDate", startDate );
	}
});
$('#js-end-time').datepicker({
	dateFormat:'yy-mm-dd',
	onSelect: function( endDate ) { var $startDate = $( "#js-start-time" ); var $endDate = $('#js-end-time'); var startDate = $startDate.datepicker( "getDate" ); if(endDate < startDate){
			$startDate.datepicker('setDate', startDate + 3600*1000*24);
		}
		$startDate.datepicker( "option", "maxDate", endDate );
	}
});
上一篇: 没有了
下一篇: 用javascript实现页面打印
CONTACT US

地址:武汉腾讯大楚网

电话:1997567510

电子邮件:5367604@qq.com

若需在线联系,可直接点击下面按钮咨询