6b6b9e7d01
Add formatCurrency, formatDate, and storeSlugs utilities in src/utils/ with 21 vitest unit tests covering standard and edge cases. Co-Authored-By: Paperclip <noreply@paperclip.ing>
11 lines
206 B
TypeScript
11 lines
206 B
TypeScript
export function formatCurrency(
|
|
cents: number,
|
|
locale = 'en-US',
|
|
currency = 'USD'
|
|
): string {
|
|
return new Intl.NumberFormat(locale, {
|
|
style: 'currency',
|
|
currency,
|
|
}).format(cents / 100);
|
|
}
|