parse.js
function (value) {

      if(value === undefined) return null;

      if(value instanceof Date) {
         return value;
      }

      var date = null, replace, regex, a = 0, length = helpers.date.regex.length;

      value = value.toString();

      for(a; a < length; a++) {
         regex = helpers.date.regex[a];

         if(value.match(regex.test)) {

            if(regex.replace.indexOf("-") > -1){
               replace = value.replace(regex.test, regex.replace).split("-");
               date = new Date(parseInt(replace[0]), parseInt(--replace[1]), parseInt(replace[2]));
            }
            else {
               replace = parseInt(value.replace(regex.test, regex.replace));
               date = new Date(replace);
            }

            break;
         }
      }

      return date;
   }
function (value) {

      if(value === undefined) return null;

      if(value instanceof Date) {
         return value;
      }

      var date = null, replace, regex, a = 0, length = helpers.date.regex.length;

      value = value.toString();

      for(a; a < length; a++) {
         regex = helpers.date.regex[a];

         if(value.match(regex.test)) {

            if(regex.replace.indexOf("-") > -1){
               replace = value.replace(regex.test, regex.replace).split("-");
               date = new Date(parseInt(replace[0]), parseInt(--replace[1]), parseInt(replace[2]));
            }
            else {
               replace = parseInt(value.replace(regex.test, regex.replace));
               date = new Date(replace);
            }

            break;
         }
      }

      return date;
   }
function ( value ) { if ( value === undefined ) return null ; if ( value instanceof Date ) { return value ; } var date = null , replace , regex , a = 0 , length = helpers . date . regex . length ; value = value . toString ( ) ; for ( a ; a < length ; a ++ ) { regex = helpers . date . regex [ a ] ; if ( value . match ( regex . test ) ) { if ( regex . replace . indexOf ( "-" ) > - 1 ) { replace = value . replace ( regex . test , regex . replace ) . split ( "-" ) ; date = new Date ( parseInt ( replace [ 0 ] ) , parseInt ( -- replace [ 1 ] ) , parseInt ( replace [ 2 ] ) ) ; } else { replace = parseInt ( value . replace ( regex . test , regex . replace ) ) ; date = new Date ( replace ) ; } break ; } } return date ; }
Try convert the value on date object. If failed, return false
Try convert the value on date object . If failed return false