Skip to content

Commit

Permalink
Dont remove national prefix digit when separateDialCode enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jackocnr committed Dec 8, 2024
1 parent 38d5137 commit b8174f5
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build/js/intlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2585,7 +2585,7 @@ var factoryOutput = (() => {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInput.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/js/intlTelInputWithUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ var factoryOutput = (() => {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInputWithUtils.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react/build/IntlTelInput.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,7 @@ var Iti = class {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/build/IntlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ var Iti = class {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/build/IntlTelInputWithUtils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,7 @@ var Iti = class {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/build/IntlTelInputWithUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ var Iti = class {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/demo/set-number/set-number-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26131,7 +26131,7 @@
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/demo/simple/simple-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26131,7 +26131,7 @@
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/demo/toggle-disabled/toggle-disabled-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26131,7 +26131,7 @@
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion react/demo/validation/validation-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26131,7 +26131,7 @@
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
3 changes: 2 additions & 1 deletion src/js/intl-tel-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,8 @@ export class Iti {
if (alreadyHasPlus || !dialCode) {
return number;
}
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix;
//* Don't remove "nationalPrefix" digit if separateDialCode is enabled, as it can be part of a valid area code e.g. in Russia then have area codes starting with 8, which is also the national prefix digit.
const hasPrefix = nationalPrefix && number.charAt(0) === nationalPrefix && !this.options.separateDialCode;
const cleanNumber = hasPrefix ? number.substring(1) : number;
return `+${dialCode}${cleanNumber}`;
}
Expand Down
2 changes: 1 addition & 1 deletion vue/build/IntlTelInput.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ class G {
const { dialCode: e, nationalPrefix: i } = this.selectedCountryData;
if (t.charAt(0) === "+" || !e)
return t;
const o = i && t.charAt(0) === i ? t.substring(1) : t;
const o = i && t.charAt(0) === i && !this.options.separateDialCode ? t.substring(1) : t;
return `+${e}${o}`;
}
_getCountryFromNumber(t) {
Expand Down
2 changes: 1 addition & 1 deletion vue/build/IntlTelInputWithUtils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ class K2 {
const { dialCode: n, nationalPrefix: r } = this.selectedCountryData;
if (e.charAt(0) === "+" || !n)
return e;
const c = r && e.charAt(0) === r ? e.substring(1) : e;
const c = r && e.charAt(0) === r && !this.options.separateDialCode ? e.substring(1) : e;
return `+${n}${c}`;
}
_getCountryFromNumber(e) {
Expand Down

0 comments on commit b8174f5

Please sign in to comment.