Skip to content

fix(isMobilePhone): update tg-TJ locale to include all valid operator codes#2679

Open
easedu wants to merge 1 commit intovalidatorjs:masterfrom
easedu:fix/isMobilePhone-tg-TJ-regex
Open

fix(isMobilePhone): update tg-TJ locale to include all valid operator codes#2679
easedu wants to merge 1 commit intovalidatorjs:masterfrom
easedu:fix/isMobilePhone-tg-TJ-regex

Conversation

@easedu
Copy link
Contributor

@easedu easedu commented Mar 7, 2026

Description

Fixes the tg-TJ (Tajikistan) regex in isMobilePhone which was
incorrectly rejecting valid mobile phone numbers, as reported in #2544.

Problem

The existing regex did not cover all valid Tajik mobile operator codes.
Numbers with codes 90 and 91 were incorrectly rejected:

validator.isMobilePhone('+992901234567', 'tg-TJ') // false (should be true)
validator.isMobilePhone('+992911234567', 'tg-TJ') // false (should be true)

Fix

Updated the regex to include all valid operator codes for Tajikistan:
00, 55, 88, 90, 91, 92, 93, 95, 98, 99.

Tests

Added test cases for previously failing numbers and ensured existing
valid numbers continue to pass.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Closes #2544

… codes

Add missing operator codes 90 and 91 to Tajikistan mobile phone regex.
Updated regex now covers all valid codes: 00, 55, 88, 90, 91, 92, 93,
95, 98, 99.

Closes validatorjs#2544
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b1aea75) to head (97dade2).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2679   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2595      2595           
  Branches       659       659           
=========================================
  Hits          2595      2595           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: Incorrect Regular Expression for Tajikistan (tg-TJ) in validator.js

1 participant