Skip to content

Scheduling infrastructure for absolutely everyone.

fix(phone-input): add Austria mask and prevent double plus prefix (#26626)

Abhay Mishra5fa76f943bdc
diff --git a/packages/features/components/phone-input/PhoneInput.tsx b/packages/features/components/phone-input/PhoneInput.tsx
index 8d644266e21..8894a9cc3d6 100644
--- a/packages/features/components/phone-input/PhoneInput.tsx
+++ b/packages/features/components/phone-input/PhoneInput.tsx
@@ -14,6 +14,7 @@ import classNames from "@calcom/ui/classNames";
const CUSTOM_PHONE_MASKS = {
ci: ".. .. .. .. ..",
bj: ".. .. .. .. ..",
+ at: "... ..........",
};
export type PhoneInputProps = {
@@ -80,7 +81,7 @@ function BasePhoneInput({
autoComplete: "tel",
}}
onChange={(val: string) => {
- onChange(`+${val}`);
+ onChange(val.startsWith("+") ? val : `+${val}`);
}}
containerClass={classNames(
"hover:border-emphasis focus-within:border-emphasis border-default !bg-default rounded-md border focus-within:outline-none focus-within:ring-0 focus-within:ring-brand-default disabled:cursor-not-allowed",
@@ -132,7 +133,7 @@ function BasePhoneInputWeb({
autoComplete: "tel",
}}
onChange={(val: string) => {
- onChange(`+${val}`);
+ onChange(val.startsWith("+") ? val : `+${val}`);
}}
containerClass={classNames(
"hover:border-emphasis focus-within:border-emphasis border-default !bg-default rounded-md border focus-within:outline-none focus-within:ring-0 focus-within:ring-brand-default disabled:cursor-not-allowed",