Add giftcard management
This commit is contained in:
@@ -95,3 +95,12 @@ export function calculateAge(dateOfBirth: string | undefined | null): number | n
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a 12-character gift card code into display format (XXXX-XXXX-XXXX).
|
||||
* Example: "a3f1c9d2b4e8" → "A3F1-C9D2-B4E8"
|
||||
*/
|
||||
export function formatCardCode(id: string): string {
|
||||
if (id.length !== 12) return id;
|
||||
return `${id.slice(0, 4)}-${id.slice(4, 8)}-${id.slice(8, 12)}`.toUpperCase();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user