WdatePicker.js开始日期和结束日期比较

jQuery.validator.addMethod("endDate",
       function(value, element) {
           var startDate = $('#course\.lifeStartDate').val();
           var endDate = $('#course\.lifeEndDate').val();
           if(startDate.length==0 || endDate.length==0){//如果开始时间和结束时间有一个没输入,不做校验
                   return true;
           }
           return new Date(startDate.replace("-", "/").replace("-", "/")) < new Date(value.replace("-", "/").replace("-", "/"));

       },
       "结束日期必须大于开始日期!");

原文地址:https://www.cnblogs.com/mybug/p/5421629.html