验证xxxx-xx-xx xx:xx:xx格式的日期,不含闰年

jQuery. validator. addMethod( "time_formatter", function( value, element) {
var reg = / ^ ( \d {4} ) - (( 0 ([ 1-9 ] {1} )) | ( 1 [ 0|1|2 ])) - (([ 0-2 ]([ 0-9 ] {1} )) | ( 3 [ 0|1 ])) \s ([ 01 ][ 0-9 ] | 2 [ 0-3 ]) : ([ 0-5 ][ 0-9 ]) : ([ 0-5 ][ 0-9 ]) $ /;
     return this. optional( element) || ( reg. test( value));
}, "时间格式如1970-01-01 00:00:00");

你可能感兴趣的:(前端)