Initial commit

Next.js + Express event management app for Hope Family Church.
This commit is contained in:
2026-07-23 15:26:47 +02:00
commit 3d381944d2
246 changed files with 57565 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* South African phone number utilities (mirrors backend/src/utils/whatsapp.js logic).
*/
/**
* Normalise a raw phone input to the international SA format (27XXXXXXXXX).
* Returns null if the input is not a valid SA mobile number.
*/
export function normalizeZAPhone(raw: string | null | undefined): string | null {
if (!raw) return null;
let digits = raw.replace(/\D/g, '');
if (digits.startsWith('0') && digits.length === 10) digits = '27' + digits.slice(1);
if (/^27\d{9}$/.test(digits)) return digits;
return null;
}
/**
* Returns true when the value is a valid SA mobile number (any common format).
*/
export function isValidZAPhone(raw: string | null | undefined): boolean {
return normalizeZAPhone(raw) !== null;
}