for TCV Age Validator
This commit is contained in:
parent
54d6a7573c
commit
ea41029424
@ -22,9 +22,9 @@ function processInput($input) {
|
||||
|
||||
// Step 2: Filter only 17 digits long strings
|
||||
if (preg_match('/^\d{17}$/', $cleanedInput)) {
|
||||
// Step 3: Check if the first four digits are within 2004-2018
|
||||
// Step 3: Check if the first four digits are within 2007-2025
|
||||
$firstFourDigits = substr($cleanedInput, 0, 4);
|
||||
if ($firstFourDigits >= 2004 && $firstFourDigits <= 2018) {
|
||||
if ($firstFourDigits >= 2007 && $firstFourDigits <= 2025) {
|
||||
return ['valid' => $cleanedInput];
|
||||
} else {
|
||||
return ['invalid' => $cleanedInput, 'reason' => 'First four digits are not within 2004-2018'];
|
||||
|
Loading…
Reference in New Issue
Block a user