Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date.UTC change in precision #56762

Open
subfuzion opened this issue Jan 25, 2025 · 3 comments
Open

Date.UTC change in precision #56762

subfuzion opened this issue Jan 25, 2025 · 3 comments

Comments

@subfuzion
Copy link

Version

v22.13.1

Platform

Linux lima-default 6.11.0-12-generic #13-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 21 20:54:19 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Darwin ftl.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041 arm64 arm Darwin

Subsystem

No response

What steps will reproduce the bug?

From v20 on, there is a change in the output from the following command:

node -e "console.log(Date.UTC(1970, 0, 213503982336, 0, 0, 0, -18446744073709552000))"
34448384

Versions less than v20 produce the following result:

34447360

Comparisons

Platform / Version result
node v18.20.6 34447360
node v19.9.0 34447360
node v20.18.2 * 34448384
node v22.13.1 * 34448384
node v23.6.1 * 34448384
deno v2.1.7 34447360
bun v1.2.0 34447360
chrome v131.0.6778.265 (official build) (arm64) 34447360
safari v18.2 (20620.1.16.11.8) 34447360

How often does it reproduce? Is there a required condition?

All versions from v20 on produce a result that is different from previous versions as well as other JavaScript runtimes, including Chrome, Safari, Deno, and Bun.

What is the expected behavior? Why is that the expected behavior?

Unless this result is expected due to increased precision that should be documented, the expected behavior is to produce the same result consistent with Node.js versions before v20 and other JavaScript runtimes, including Chrome, Safari, Deno, and Bun.

What do you see instead?

34448384 instead of expected 34447360.

Additional information

No response

@cjihrig
Copy link
Contributor

cjihrig commented Jan 25, 2025

It looks like it changed specifically in 20.18.1 and 22.10.0. Possibly because of #55056 (I did not verify).

EDIT: I tested on main and it outputs 34447360. Node v23.6.1 is the latest release at the time of writing, and it outputs 34448384. Either something recently landed to fix this, or it's a problem related to the release binaries.

@subfuzion
Copy link
Author

Interesting. FWIW, I don't get that result on a Mac (Darwin arm64) with either v23.6.1 or with the latest commit on main (1263efd) for v24.0.0-pre:

~/code/thirdparty/node (main)
$ ./out/Release/node -v
v24.0.0-pre
~/code/thirdparty/node (main)
$ ./out/Release/node -e "console.log(Date.UTC(1970, 0, 213503982336, 0, 0, 0, -18446744073709552000))"
34448384
~/code/thirdparty/node (main)
$ git checkout -b current v23.6.1
Switched to a new branch 'current'
~/code/thirdparty/node (current)
$ make clean all
...
~/code/thirdparty/node (current)
$ ./out/Release/node -v
v23.6.1
~/code/thirdparty/node (current)
$ ./out/Release/node -e "console.log(Date.UTC(1970, 0, 213503982336, 0, 0, 0, -18446744073709552000))"
34448384

@cjihrig
Copy link
Contributor

cjihrig commented Jan 28, 2025

Cross posting in case it is relevant: @targos mentioned in #56796 (comment) that the build infra updated from macOS 11 to macOS 13 around this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants