JS方法 判断 有效日期不能小于今天
function IsDateCompare(beginDate, endDate) {
// var beginArrayDate = /(\d{4})-(\d{1,2})-(\d{1,2})/.exec(beginDate);
// var endArrayDate = /(\d{4})-(\d{1,2})-(\d{1,2})/.exec(endDate);
var beginArrayDate = beginDate.split('-');
var endArrayDate = endDate.split('-')
if (parseInt(endArrayDate[0], 10) > parseInt(beginArrayDate[0], 10)) return true;
if (parseInt(endArrayDate[0], 10) == parseInt(beginArrayDate[0], 10)) {
if (parseInt(endArrayDate[1], 10) > parseInt(beginArrayDate[1], 10)) return true;
else {
if (parseInt(endArrayDate[1], 10) == parseInt(beginArrayDate[1], 10)) {
if (parseInt(endArrayDate[2], 10) >= parseInt(beginArrayDate[2], 10)) return true;
}
}
}
return false;
}
一点一滴 坚持,汇成知识的海洋~ 希望自己能进步!