Skip to content

new Date() instance of Date should be true when using setSystemTime #4579

@spiroka

Description

@spiroka

Describe the bug

When using setSystemTime, Date objects will not be instances of (the now mocked) Date.

Reproduction

https://stackblitz.com/edit/vitejs-vite-uwiefu?file=index.test.js

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
    Memory: 10.69 GB / 32.00 GB

  Binaries:
    Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD

  Browsers:
    Edge: Spartan (44.19041.3570.0), Chromium (119.0.2151.72)
    Internet Explorer: 11.0.19041.3570

  npmPackages:
    @vitejs/plugin-react: ^4.1.1 => 4.1.1
    @vitest/coverage-v8: ^0.34.6 => 0.34.6
    @vitest/ui: ^0.34.6 => 0.34.6
    vite: 4.5.0 => 4.5.0
    vitest: ^0.34.6 => 0.34.6

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions