mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-21 23:16:13 +01:00
format currency with thousand separators (#81)
This commit is contained in:
@@ -20,3 +20,12 @@ export function formatExpenseDate(date: Date) {
|
||||
export function formatCategoryForAIPrompt(category: Category) {
|
||||
return `"${category.grouping}/${category.name}" (ID: ${category.id})`
|
||||
}
|
||||
|
||||
export function formatCurrency(currency: string, amount: number) {
|
||||
const format = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})
|
||||
const formattedAmount = format.format(amount / 100)
|
||||
return `${currency} ${formattedAmount}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user