File tree Expand file tree Collapse file tree 1 file changed +0
-41
lines changed Expand file tree Collapse file tree 1 file changed +0
-41
lines changed Original file line number Diff line number Diff line change 115
115
errorMessageKey : 'badBrazilCEPAnswer'
116
116
117
117
} ) ;
118
-
119
- $ . formUtils . addValidator ( {
120
- name : 'brdate' ,
121
- validatorFunction : function ( val ) {
122
- var regExpCharacter = / [ ^ \d ] / ;
123
- var regExpSpace = / ^ \s + | \s + $ / g;
124
- if ( val . length !== 10 ) {
125
- return false ;
126
- }
127
-
128
- splitData = val . split ( '/' ) ;
129
- if ( splitData . length !== 3 ) {
130
- return false ;
131
- }
132
-
133
- splitData [ 0 ] = splitData [ 0 ] . replace ( regExpSpace , '' ) ;
134
- splitData [ 1 ] = splitData [ 1 ] . replace ( regExpSpace , '' ) ;
135
- splitData [ 2 ] = splitData [ 2 ] . replace ( regExpSpace , '' ) ;
136
-
137
- if ( ( splitData [ 0 ] . length !== 2 ) || ( splitData [ 1 ] . length !== 2 ) || ( splitData [ 2 ] . length !== 4 ) ) {
138
- return false ;
139
- }
140
-
141
- if ( regExpCharacter . test ( splitData [ 0 ] ) || regExpCharacter . test ( splitData [ 1 ] ) || regExpCharacter . test ( splitData [ 2 ] ) ) {
142
- return false ;
143
- }
144
-
145
- day = parseInt ( splitData [ 0 ] , 10 ) ;
146
- month = parseInt ( splitData [ 1 ] , 10 ) - 1 ;
147
- year = parseInt ( splitData [ 2 ] , 10 ) ;
148
-
149
- var newDate = new Date ( year , month , day ) ;
150
- if ( ( newDate . getDate ( ) !== day ) || ( newDate . getMonth ( ) !== month ) || ( newDate . getFullYear ( ) !== year ) ) {
151
- return false ;
152
- } else {
153
- return true ;
154
- }
155
- } ,
156
- errorMessage : '' ,
157
- errorMessageKey : 'badDate'
158
- } ) ;
159
118
160
119
} ) ( jQuery ) ;
You can’t perform that action at this time.
0 commit comments