diff --git a/src/components/marketing/pricing/lib/utils.ts b/src/components/marketing/pricing/lib/utils.ts index c3bad33..763d533 100644 --- a/src/components/marketing/pricing/lib/utils.ts +++ b/src/components/marketing/pricing/lib/utils.ts @@ -69,9 +69,9 @@ export function constructMetadata({ }; } -export function formatDate(input: string | number): string { +export function formatDate(input: string | number, locale: string = 'en'): string { const date = new Date(input); - return date.toLocaleDateString("en-US", { + return date.toLocaleDateString(locale, { month: "long", day: "numeric", year: "numeric", diff --git a/src/components/marketing/utils.ts b/src/components/marketing/utils.ts index 565093e..b736d55 100644 --- a/src/components/marketing/utils.ts +++ b/src/components/marketing/utils.ts @@ -5,15 +5,20 @@ export function getCurrentDomain(): string { return ''; } -export function formatDate(date: Date | string): string { +export function formatDate(date: Date | string, locale: string = 'en'): string { const d = new Date(date); - return d.toLocaleDateString('en-US', { + return d.toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' }); } +export function formatCurrency(amount: number, locale: string = 'en'): string { + const currency = locale === 'ar' ? 'SAR' : 'USD'; + return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(amount); +} + export function truncateText(text: string, maxLength: number): string { if (text.length <= maxLength) return text; return text.substring(0, maxLength) + '...';