next-learn
next-learn copied to clipboard
Chapter 12 actions.ts Rounding
The createInvoice() and updateInvoice() actions in actions.ts convert the dollar amount to cents, but the result should be rounded because of floating point error.
const amountInCents = Math.round(amount * 100);