Fil opened a new issue, #40718:
URL: https://github.com/apache/arrow/issues/40718

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Doing a round-trip with a JavaScript Date in apache-arrow/js sometimes 
results in wrong values:
   
   ```js
   import * as Arrow from "apache-arrow";
   const date = new Date(1950, 1, 0);
   const data = [{date}]
   console.warn("true date", date, +date);
   const arrow = Arrow.tableFromJSON(data);
   const [lo, hi] = arrow.batches[0].data.children[0].values;
   console.warn("encoded bytes", hi * (2**32) + lo);
   for (const d of arrow) console.log("decoded date", d.date, +d.date)
   ```
   
   this prints:
   
   ```
   ❯ node test-arrow.js
   true date 1950-01-30T23:00:00.000Z -628563600000
   encoded bytes -628563600000
   decoded date 1950-03-21T16:02:47.296Z -624268632704
   ```
   
   As you can see there is a difference of 45 days. If I go and modify 
factories.ts and change `dtypes.DateMillisecond` to `dtypes.Float64` (line 
122), the decoding returns the correct number.
   
   version information:
   
   ```
   apache-arrow@^15.0.2:
     resolved 
"https://registry.yarnpkg.com/apache-arrow/-/apache-arrow-15.0.2.tgz#d87c6447d64d6fab34aa70119362680b6617ce63";
   
   ❯ node -v
   v20.11.1
   ```
   
   The results are correct for dates after epoch, but testing with `new 
Date(1969, 11, 31);` exhibits the problem.
   
   ### Component(s)
   
   JavaScript


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to