Any way yet to store `decimal` in the database wit...
# orm-help
j
Any way yet to store
decimal
in the database without using floats or returning a Decimal.js instance? I just want to store pricing information, but floats can be unprecise and Decimal.js objects are a hassle to work with
l
We usually just store
minorAmount
and
precision
integers
j
How does that work?
Like, storing an amount integer and a precision integer that you need to divide it with?
l
Yeah essentially
We use dinero.js for currency manipulation
n
j
@Nurul yeah but I do not want to have to create a Decimal object everytime, so I was wondering if there is a better way. Also, it doesn't return nice JSON this way since there is a Decimal.js object in the return data, which I have to convert first 🙂
@Lee Alright maybe I will also go that way. Pity though that direct decimals aren't supported