Open
Description
I recently noticed that the regular expression for Tajikistan (tg-TJ) in validator.js is incorrect. Currently, it does not properly validate all valid Tajik phone numbers.
- The regex does not account for all valid mobile operator codes in Tajikistan.
- Some valid phone numbers are incorrectly rejected.
Valid Tajikistan Phone Numbers (Should Pass Validation)
+992 90 1234567
+992 91 7654321
(this phone numbers can't pass the validation)
Reproductions
const validNumber1 = '+992901234567',
const validNumber2 = '+992911234567',
validator.isMobilePhone(validNumber1) // false
validator.isMobilePhone(validNumber2) // false
Suggested Fix
The correct phone number format should include the following valid operator codes:
00, 55, 88, 90, 91, 92, 93, 95, 98, 99
A more accurate regex would be:
/^(\+992|992)?(00|55|88|90|91|92|93|95|98|99)\d{7}$/
Validator.js version: 13.15.0
Node.js version: v20.9.0
OS platform: macOS