-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Low priorityCreated by Linear-GitHub SyncCreated by Linear-GitHub Sync🐛 bugSomething isn't workingSomething isn't working
Description
Found a bug? Please fill out the sections below. 👍
Issue Summary
There is an inconsistency in phone number formatting across different country codes in the phone input component. The bug is caused by the way phone numbers are parsed and formatted using the libphonenumber-js library without enforcing a standardized formatting pattern. This leads to unpredictable spacing and grouping of numbers depending on the country code.
Steps to Reproduce
- Go to the phone number input field in the app (
packages/features/components/phone-input/PhoneInput.tsx). - Enter a phone number with a country code, e.g.,
+58XXXXXXXXXX. - Observe the format of the number displayed.
- Change the country code to
+1or+44and enter the respective number. - Compare the displayed format across different country codes.
Actual Results
- Phone numbers appear in inconsistent formats depending on the country code.
- Some country codes add extra spacing or different grouping of digits.
- The "+" prefix is always added, sometimes resulting in unexpected formatting.
Expected Results
- Phone numbers should follow a consistent, standardized format regardless of the country code.
- Ideally, the formatting should align with the E.164 standard or a uniform international format for all numbers.
Technical details
- Files involved:
packages/lib/formatPhoneNumber.tspackages/features/components/phone-input/PhoneInput.tsx
- Code snippet causing the issue (from
formatPhoneNumber.ts):
export const formatPhoneNumber = (phoneNumber: string) => {
const parsedPhoneNumber = parsePhoneNumberWithError(phoneNumber);
return parsedPhoneNumber?.isValid() ? parsedPhoneNumber.formatInternational() : phoneNumber;
};-
The issue occurs because:
PhoneInput.tsxautomatically adds a "+" prefix to all numbers.formatPhoneNumberrelies onlibphonenumber-jswhich applies different spacing/grouping rules per country code.- No standardized formatting pattern is enforced.
-
Environment details:
- Browser: [Add your browser version here]
- Node.js version: [Add your Node.js version here]
- No backend involvement — purely frontend formatting issue
Evidence
- Testing performed manually by entering numbers for multiple country codes (+58, +1, +44).
- Screenshots/videos should be attached to show the inconsistency (e.g., different spacing applied).
This bug is self-contained and limited to the phone input and formatting logic. Fixing it would significantly improve the consistency and user experience of the phone number input feature.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Low priorityCreated by Linear-GitHub SyncCreated by Linear-GitHub Sync🐛 bugSomething isn't workingSomething isn't working