Another issue I'm having is with the Decimal type....
# orm-help
a
Another issue I'm having is with the Decimal type. I'm trying format the value as USD using
new Int.NumberFormat(...).format()
and it takes a number. It looks like I should be able to do
.toNumber()
on the Decimal type to get it as a number, but I get an error that it's not a function. If I do
.toString()
that works but TypeScript is unhappy. Here is my code:
Copy code
{new Intl.NumberFormat("en-US", {
  style: "currency",
  currency: "USD"
}).format(product.price.toString())}
Has anyone ran into something like this using the Decimal type?
n
a
I did see that page and it's great for creating new Decimal values, but it doesn't mention how to use them once you pull them from the database. I checked you the link to the Decimal.js library which is where I found .toNumber() but it's not working.
I guess my work around is to do this
Number(item.product.price.toString())
a
Yep, I use that or simply prefix the Decimal with
+