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
Hey folks, curious to understand what (if any) plans you have for supporting the bigint type?
I'm migrating some code to use the latest Square SDK and noticed that they are now returning all numbers as bigint, and creating a currency from a bigint results in a $0.00 value.
When this library was first created, BigInt wasn't widely supported across all browsers - but that has certainly changed.
There's some considerations to be made because we'd either have to support BigInt internally, or truncate to the max integer, which negates some of the benefits from using BigInt. I would certainly thing supporting this in the future could be a possibility though.
I figured as much, and it's not even that there is necessarily a need to work with numbers that big, just that it's becoming more common for source data to be returned in that (bigInt) format - Square (my case in question) is very widely used, for example.
In the short term, since bigInt's stringify to a usable integer (within the bounds of discussions), I am able to resolve my issues by making my current calls with a .toString() on the end of the values. That might be sufficient as a short term (non-breaking) fix for the interim.
Hey folks, curious to understand what (if any) plans you have for supporting the bigint type?
I'm migrating some code to use the latest Square SDK and noticed that they are now returning all numbers as bigint, and creating a currency from a bigint results in a $0.00 value.
currency(100).format() --> $1.00
currency(100n).format() --> $0.00
The text was updated successfully, but these errors were encountered: