Open
Description
In Chapter 12:
https://nextjs.org/learn/dashboard-app/mutating-data#storing-values-in-cents
The dollar amount is converted to cents by multiplying by 100. However, this doesn't convert it to an integer and can lead to database errors. The value after multiplication needs to be rounded (Math.round(amount * 100)
).
For example, entering 2.55
:
Database Error: Failed to Update Invoice. NeonDbError: invalid input syntax for type integer: "254.99999999999997"
Metadata
Metadata
Assignees
Labels
No labels