Files
splitt-the-bill/shared/utils/money.ts
T
anbraten cbe1b42f6e
tinyedge/deploy Deployed by TinyEdge
🐛 add env to useDb and apply prettier
2026-08-07 13:28:26 +02:00

15 lines
352 B
TypeScript

export function toCents(amount: number): number {
return Math.round(amount * 100);
}
export function fromCents(cents: number): number {
return cents / 100;
}
export function formatCurrency(cents: number, currency: string): string {
return new Intl.NumberFormat(undefined, {
style: 'currency',
currency,
}).format(fromCents(cents));
}