You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"
The text was updated successfully, but these errors were encountered:
alekaimer
added a commit
to alekaimer/next-learn
that referenced
this issue
Dec 5, 2024
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
:The text was updated successfully, but these errors were encountered: