-
Notifications
You must be signed in to change notification settings - Fork 81
Update index.js #75
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Open
chetanbnagmoti
wants to merge
1
commit into
sample-usr:master
Choose a base branch
from
chetanbnagmoti:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update index.js #75
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please changes this Check Because Some Country code Have more than 17 digit including country code so only accepted 15 digit so it is wrong
Hi @chetanbnagmoti, |
Yes ,Are You Right But Your Format Of Some Countries Are Wrong So That is
why Validation Is Not Check Accurate .
Ex => Jordan Have Format ==> +962 7XX XXX XXX but when I am console your
format then this is ==>
{
"format": "+... ... ... ... ... ..",
"typicalLength": 17
}
And Also Console This country object ==>
{
"name": "Jordan",
"regions": [
"middle-east"
],
"iso2": "jo",
"countryCode": "962",
"dialCode": "962",
"format": "+... ... ... ... ... ..",
"priority": 0
}
Correct Format for Jamaica => +. (...) ...-....
{
"name": "Jamaica",
"regions": [
"america",
"carribean"
],
"iso2": "jm",
"countryCode": "1876",
"dialCode": "1876",
"format": "+.... ... ... ... ... ..",
"priority": 0
}
The above Jordan format is wrong .So Can it be possible to correct the
format of those wrong Countries.
…On Tue, Dec 3, 2024 at 7:28 PM Raza ***@***.***> wrote:
Hi @chetanbnagmoti <https://github.com/chetanbnagmoti>,
Can you give me an example of a phone number that exceeds that limit?
I am not sure, but last I checked the maximum length for a given phone
number could not exceed 15 digits as per ITU standards
<https://stackoverflow.com/a/3350566> (which is worldwide).
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4OCWJOQ7JX2HKVNJGCYVL32DW2J5AVCNFSM6AAAAABS5FZ4V2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJUGYZTKMRQGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
const [isPhoneValid, setIsPhoneValid] = useState(false);
const handleValidation = (inputNumber, country) => {
const dialCode = country.dialCode;
const cleanedNumber = inputNumber.replace(/\s+/g, "");
console.log("country ===>", country);
// For India, ensure it's exactly 10 digits after the country code
if (dialCode === "91") {
const numberWithoutCode = cleanedNumber.replace(`${dialCode}`, "");
return numberWithoutCode.length === 10;
}
// For other countries, check if the number length matches the
country's typical length
let typicalLength = country.format.match(/\./g)?.length;
console.log("typicalLength ======>", { format: country.format,
typicalLength });
let numberWithoutCode = cleanedNumber.replace(`${dialCode}`, "");
numberWithoutCode = `${dialCode}${numberWithoutCode}`;
if (typicalLength >= 17) {
typicalLength = 15;
}
return numberWithoutCode.length === typicalLength;
};
<Grid item lg={12} width={"100%"}>
<FormControl fullWidth>
<FormLabel>Mobile Number</FormLabel>
<PhoneInput
country={"in"}
value={linkData.mobileNumber}
onChange={handlePhoneChange}
placeholder="Phone Number"
countryCodeEditable={false}
disableDropdown={false}
autoFormat={true}
inputProps={{
name: "mobileNumber",
required: true,
autoFocus: false,
autoComplete: "off",
}}
inputStyle={{
backgroundColor: !isPhoneValid ? "white" : "white",
}}
dropdownStyle={{
height: !isEditClinet ? "150px" : "120px",
fontSize: "20px",
paddingTop: "10px",
width: "360px",
marginTop: "15px",
borderRadius: "5px",
}}
isValid={(inputNumber, country) => {
const isValid = handleValidation(inputNumber, country);
setIsPhoneValid(isValid);
return isValid;
}}
/>
</FormControl>
</Grid>
<Grid item lg={12} display="flex" justifyContent="center" sx={{ width:
"100%" }}>
<CustomButton
variant="contained"
disabled={
linkData.mobileNumber === "" ||
!isPhoneValid
// linkData.mobileNumber.length < 12
}
onClick={handleSubmitForm}
{!isEditClinet ? "Add Number & Share" : "Save Details"}
</CustomButton>
</Grid>
//I want to dIsable this submit button . //Please suggest to me what I can
do for this.
…On Tue, Dec 3, 2024 at 9:18 PM chetan nagmoti ***@***.***> wrote:
Yes ,Are You Write But Your Format Of Some Countries Are Wrong So That is
why Validation Is Not Check Accurate .
Ex => Jordan Have Format ==> +962 7XX XXX XXX but when I am console your
format then this is ==>
{
"format": "+... ... ... ... ... ..",
"typicalLength": 17
}
And Also Console This country object ==>
{
"name": "Jordan",
"regions": [
"middle-east"
],
"iso2": "jo",
"countryCode": "962",
"dialCode": "962",
"format": "+... ... ... ... ... ..",
"priority": 0
}
Correct Format for Jamaica => +. (...) ...-....
{
"name": "Jamaica",
"regions": [
"america",
"carribean"
],
"iso2": "jm",
"countryCode": "1876",
"dialCode": "1876",
"format": "+.... ... ... ... ... ..",
"priority": 0
}
The above Jordan format is wrong .So Can it be possible to correct the
format of those wrong Countries.
On Tue, Dec 3, 2024 at 7:28 PM Raza ***@***.***> wrote:
> Hi @chetanbnagmoti <https://github.com/chetanbnagmoti>,
> Can you give me an example of a phone number that exceeds that limit?
> I am not sure, but last I checked the maximum length for a given phone
> number could not exceed 15 digits as per ITU standards
> <https://stackoverflow.com/a/3350566> (which is worldwide).
>
> —
> Reply to this email directly, view it on GitHub
> <#75 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/A4OCWJOQ7JX2HKVNJGCYVL32DW2J5AVCNFSM6AAAAABS5FZ4V2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJUGYZTKMRQGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
I'm sorry but I'm not sure I understand your problem. Can you please use proper formatting when posting code and explain a little more what seems to be the issue? |
Yes, I will do that.
…On Tue, 10 Dec 2024, 20:11 Raza, ***@***.***> wrote:
I'm sorry but I'm not sure I understand your problem. Can you please use
proper formatting when posting code and explain a little more what seems to
be the issue?
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4OCWJISRTJY6IIJ3KVZNOD2E34RFAVCNFSM6AAAAABS5FZ4V2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZRHAZDIMJWGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Can I am contacting you if possible
…On Wed, 11 Dec 2024, 00:10 chetan nagmoti, ***@***.***> wrote:
Yes, I will do that.
On Tue, 10 Dec 2024, 20:11 Raza, ***@***.***> wrote:
> I'm sorry but I'm not sure I understand your problem. Can you please use
> proper formatting when posting code and explain a little more what seems to
> be the issue?
>
> —
> Reply to this email directly, view it on GitHub
> <#75 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/A4OCWJISRTJY6IIJ3KVZNOD2E34RFAVCNFSM6AAAAABS5FZ4V2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZRHAZDIMJWGI>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please changes this Check Because Some Country code Have more than 17 digit including country code so only accepted 15 digit so it is wrong