Skip to content

Commit

Permalink
SNOW-922989 Replace deprecated bignumber.js floor function (#649)
Browse files Browse the repository at this point in the history
* Replace deprecated bignumber floor function with integerValue calls

* Update bignumber.js dependency to require v9.1.2 and up
  • Loading branch information
mblakley authored Oct 19, 2023
1 parent 144dfe8 commit bcdcd99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/connection/result/column.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,10 @@ function convertRawTimestampTz(rawColumnValue, column, context)

// extract everything but the lowest 14 bits to get the fractional seconds
valFracSecsBig =
valFracSecsWithTzBig.dividedBy(16384).floor();
valFracSecsWithTzBig.dividedBy(16384).integerValue(BigNumber.ROUND_FLOOR);

// extract the lowest 14 bits to get the timezone
if (valFracSecsWithTzBig.greaterThanOrEqualTo(0))
if (valFracSecsWithTzBig.isGreaterThanOrEqualTo(0))
{
timezoneBig = valFracSecsWithTzBig.modulo(16384);
}
Expand Down Expand Up @@ -521,7 +521,7 @@ function convertRawTimestampHelper(
// split the value into epoch seconds + nanoseconds; for example,
// 1365148923.123456789 will be split into 1365148923 (epoch seconds)
// and 123456789 (nano seconds)
var valSecBig = epochFracSecsBig.dividedBy(scaleFactor).floor();
var valSecBig = epochFracSecsBig.dividedBy(scaleFactor).integerValue(BigNumber.ROUND_FLOOR);
var fractionsBig = epochFracSecsBig.minus(valSecBig.times(scaleFactor));
var valSecNanoBig = fractionsBig.times(Math.pow(10, 9 - scale));

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"asn1.js-rfc5280": "^3.0.0",
"axios": "^1.5.1",
"big-integer": "^1.6.43",
"bignumber.js": "^2.4.0",
"bignumber.js": "^9.1.2",
"binascii": "0.0.2",
"bn.js": "^5.2.1",
"browser-request": "^0.3.3",
Expand Down

0 comments on commit bcdcd99

Please sign in to comment.