File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,8 @@ export function validateNationalIdentityNumber(
153153 const date = new Date ( ) ;
154154 const baseYear =
155155 separator === '+' ? date . getUTCFullYear ( ) - 100 : date . getUTCFullYear ( ) ;
156- year = baseYear - ( ( baseYear - yearStr ) % 100 ) ;
156+ year =
157+ baseYear - ( ( baseYear - Number . parseInt ( yearStr as string , 10 ) ) % 100 ) ;
157158 break ;
158159 }
159160 // if it's the short format, without a separator, we need to special handle the year for the date validation.
@@ -176,7 +177,7 @@ export function validateNationalIdentityNumber(
176177 day = day - 60 ;
177178 }
178179
179- return isValidDate ( year , month , day , centuryStr || separator ) ;
180+ return isValidDate ( year , month , day , Boolean ( centuryStr || separator ) ) ;
180181}
181182
182183// just reexport the no method for API feature parity
You can’t perform that action at this time.
0 commit comments