Skip to content

feat(i18n): locale-aware date + currency formatting#24

Open
abdout wants to merge 1 commit into
mainfrom
feat/i18n-date-currency
Open

feat(i18n): locale-aware date + currency formatting#24
abdout wants to merge 1 commit into
mainfrom
feat/i18n-date-currency

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented Apr 25, 2026

Summary

  • Replaces hardcoded `'en-US'` in two `formatDate` utilities with an optional `locale` parameter (default `'en'`).
  • Adds `formatCurrency(amount, locale)` to `marketing/utils.ts` using `Intl.NumberFormat`. Maps locale to currency: `'ar'` → SAR, others → USD.
  • API-additive: existing callers behave as before since they pass no locale and default to `'en'`.

Changes

  • `src/components/marketing/utils.ts` — `formatDate` accepts `locale`; new `formatCurrency`
  • `src/components/marketing/pricing/lib/utils.ts` — `formatDate` accepts `locale`

Test plan

  • `formatDate(new Date(), 'ar')` → `"٢٥ أبريل ٢٠٢٦"` style
  • `formatCurrency(100, 'en')` → `"$100.00"`
  • `formatCurrency(100, 'ar')` → SAR-formatted Arabic numerals
  • Default `'en'` behavior unchanged for both functions
  • `pnpm tsc --noEmit` no new errors

Closes #23

🤖 Generated with Claude Code

Adds optional locale parameter to formatDate (default 'en'), and a
new formatCurrency helper using Intl.NumberFormat with USD/SAR
mapping. Replaces the hardcoded 'en-US' in both date utils.

Both formatDate callers (video/more.tsx commented; billing-info.tsx
in a Class 1 dead-import file) keep working with default 'en'.

Closes #23

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marketing Ready Ready Preview, Comment Apr 25, 2026 0:24am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(i18n): locale-aware date + currency formatting

1 participant