easyUI时间的先后的判断
$('#start_time').datebox({ onSelect: function(date){ var curr_time = new Date(); var curr_date = curr_time.getFullYear()+''+fullnum(curr_time.getMonth())+''+fullnum(curr_time.getDate()); var select_date = date.getFullYear()+''+fullnum(date.getMonth())+''+fullnum(date.getDate()); if(select_date>curr_date){ return true; }else{ $("#start_time").datebox("setValue",curr_time.getFullYear()+":"+(curr_time.getMonth()+1)+":"+curr_time.getDate()); } } }); function fullnum(obj){//对于月小于10格式的转换,因为Timestamp转换必须是2013-01-04这种格式 if(Number(obj) < 10){ return '0' + obj; }else{ return obj; } }