From 375f16486b77e85ec778a28b0591db24ed182149 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 9 Apr 2024 16:46:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20WhatsApp=E5=8F=B7=E7=A0=81=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/channel/whatsappUtils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/channel/whatsappUtils.js b/src/channel/whatsappUtils.js index 4ddc5ce..1c7fc54 100644 --- a/src/channel/whatsappUtils.js +++ b/src/channel/whatsappUtils.js @@ -682,7 +682,9 @@ export const handleNotification = (title, _options) => { */ export const phoneNumberToWAID = (input) => { // Remove any non-digit characters except '+' - const cleanedInput = input.replace(/[^\d+]/g, ''); + const cleanedInput = (input.replace(/[^\d+]/g, '')) + .replace(/^0+/, '') // Remove leading zeros + ; // Check if the number starts with a valid country code const countryCode = cleanedInput.slice(0, 2);