diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 11:11:53 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 11:11:53 -0500 |
| commit | 6611e3a187e5398f686449938b7cf1ddbfcb5392 (patch) | |
| tree | 0fae44f29faf8efa68bcdb113ae1ca003cbd024b /src/components | |
| parent | ec981fd237a50dfc547d8c162b22f4e1a691c9fc (diff) | |
Store amounts as cents
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/expense-form.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/components/expense-form.tsx b/src/components/expense-form.tsx index 3f6490f..d6a8049 100644 --- a/src/components/expense-form.tsx +++ b/src/components/expense-form.tsx @@ -47,7 +47,7 @@ export function ExpenseForm({ group, expense, onSubmit, onDelete }: Props) { defaultValues: expense ? { title: expense.title, - amount: expense.amount, + amount: String(expense.amount / 100) as unknown as number, // hack paidBy: expense.paidById, paidFor: expense.paidFor.map(({ participantId }) => participantId), isReimbursement: expense.isReimbursement, @@ -55,7 +55,9 @@ export function ExpenseForm({ group, expense, onSubmit, onDelete }: Props) { : searchParams.get('reimbursement') ? { title: 'Reimbursement', - amount: Number(searchParams.get('amount')) || 0, + amount: String( + (Number(searchParams.get('amount')) || 0) / 100, + ) as unknown as number, // hack paidBy: searchParams.get('from') ?? undefined, paidFor: [searchParams.get('to') ?? undefined], isReimbursement: true, |
