my97datepicker 开始时间,结束时间

1.在设置开始时间结束时间的时候,发现不能使用同门的函数来进行id的命名.如果用同门会有冲突.

2.双月份显示,开始时间小于结束时间
<script type="text/javascript">
$(function(){
    $("#waterStartTime").bind("click",function(){
        WdatePicker({doubleCalendar:true,startDate:'%y-{%M-1}-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',autoPickDate:true,maxDate:'#F{$dp.$D(\'waterEndTime\')||\'%y-%M-%d\'}',onpicked:function(){waterEndTime.click();}});
        //WdatePicker({startDate:'%y-{%M-1}-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',autoPickDate:true,maxDate:'#F{$dp.$D(\'endTime\')||\'%y-%M-%d\'}',onpicked:function(){endTime.click();}});
    });
    $("#waterEndTime").bind("click",function(){
        WdatePicker({doubleCalendar:true,startDate:'%y-{%M-1}-%d',minDate:'#F{$dp.$D(\'waterStartTime\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',autoPickDate:true});
        //WdatePicker({startDate:'%y-{%M-1}-%d',minDate:'#F{$dp.$D(\'startTime\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',autoPickDate:true});
    });
});
</script>


-------------------------------------------------------
<script type="text/javascript">
	var d=new Date();
	//document.getElementById('startTime').value=d.getFullYear() +'-'+( d.getMonth()+1)+'-'+d.getDate()+' ' + d.getHours()+':'+d.getMinutes()+':'+d.getSeconds();
	$("#waterStartTime").val(d.getFullYear() +'-'+0+( d.getMonth()+1)+'-'+(d.getDate())+' ' + '00:00:00');
	$("#waterEndTime").val(d.getFullYear() +'-'+0+( d.getMonth()+1)+'-'+(d.getDate())+' ' + '23:59:59');
</script>


----------------------------------------------------
<li>
								<label>
									 创建开始时间: 
								</label> 
								<input id="waterStartTime" name="waterStartTime" type="text" style="width: 180px" fieldName='createTime' operator='>=' controltype='date'>
							</li>
							<li>
								<label>
									 创建结束时间: 
								</label> 
								<input id="waterEndTime" name="waterEndTime" type="text" style="width: 180px" fieldName='createTime' operator='<=' controltype='date'>
							</li>



-----------------------------------------------------
开始时间小于结束时间

$('#searchBtn',c).bind('click', function() {
		var staTime = $("#waterStartTime").val();
		var endTime = $("#waterEndTime").val();
		var d1 = new Date(staTime.replace(/-/g,"/"));
		var d2 = new Date(endTime.replace(/-/g,"/"));
		if (Date.parse(d1) - Date.parse(d2) >= 0) {  
			FrosJquery.dialog.alert("开始时间不能早于结束时间");  
	        return;  
	    }
		$("#waterwayFreightListGrid").trigger("reloadGrid");
	});

你可能感兴趣的:(my97datepicker)