-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced libphonenumber-js with custom functions #6205
Replaced libphonenumber-js with custom functions #6205
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for care-egov-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
if (value.length > 12 && value.startsWith("+910")) { | ||
value = "+91" + value.slice(4); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this intend to do? Can you add comments for the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It eliminates 0 if any at the beginning of a number after +91. For ex +9109876543214 will be formatted as +919876543214. The libphonenumber-js library was also doing this. Hyderabad's area code for landline is 40 but I have never seen landline number with 40, everyone uses 040 followed by 8 digits. Similarly for other areas. That 0 should be eliminated while storing it in E164 format. Later I also noticed that chrome's autofill feature adds a 0 at the beginning after country code. So this will handle that too.
👋 Hi, @print-Sathvik, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
I am closing this PR as the diff shows others' work as part of this PR |
WHAT
Replaced libphonenumber-js with custom functions
Proposed Changes
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
HOW
🤖 Generated by Copilot at e1dd23a
libphonenumber-js
dependency and replace it with custom phone number utility functions (link)src/Common/constants.tsx
andsrc/Common/static/countryPhoneAndFlags.json
(link, link, link, link, link, link, link, link, link, link, link, link, link, link)+91
instead of empty strings orundefined
insrc/Components/Patient/PatientRegister.tsx
,src/Components/Resource/ResourceCreate.tsx
, andsrc/Components/Users/UserFilter.tsx
(link, link, link)asYouType
variable and initialization fromsrc/Components/Form/FormFields/PhoneNumberFormField.tsx
(link)useEffect
hook to initializesetValue
function withfield.value
or+91
insrc/Components/Form/FormFields/PhoneNumberFormField.tsx
(link)