未验证 提交 d8a4a54a 编写于 作者: L Linhe Huo 提交者: GitHub

[TD-6032]<fix>: fix nanosecond 999999999 error for nodejs [ci skip] (#7331)

上级 707b9fb7
...@@ -47,7 +47,8 @@ class TaosTimestamp extends Date { ...@@ -47,7 +47,8 @@ class TaosTimestamp extends Date {
super(Math.floor(date / 1000)); super(Math.floor(date / 1000));
this.precisionExtras = date % 1000; this.precisionExtras = date % 1000;
} else if (precision === 2) { } else if (precision === 2) {
super(parseInt(date / 1000000)); // use BigInt to fix: 1623254400999999999 / 1000000 = 1623254401000 which not expected
super(parseInt(BigInt(date) / 1000000n));
// use BigInt to fix: 1625801548423914405 % 1000000 = 914496 which not expected (914405) // use BigInt to fix: 1625801548423914405 % 1000000 = 914496 which not expected (914405)
this.precisionExtras = parseInt(BigInt(date) % 1000000n); this.precisionExtras = parseInt(BigInt(date) % 1000000n);
} else { } else {
......
{ {
"name": "td2.0-connector", "name": "td2.0-connector",
"version": "2.0.9", "version": "2.0.10",
"description": "A Node.js connector for TDengine.", "description": "A Node.js connector for TDengine.",
"main": "tdengine.js", "main": "tdengine.js",
"directories": { "directories": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册