Skip to content

Date.UTC change in precision #56762

@subfuzion

Description

@subfuzion

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions