Skip to content

Setting null prototype to Date object results error #25145

Closed
@antsmartian

Description

@antsmartian
  • Version: 10.0.0
  • Platform: Mac

Found this, when working on this #25144

Running the below code:

console.log(Object.setPrototypeOf(new Date(), null))

results in error:

util.js:599
        if (Number.isNaN(value.getTime()))
                               ^

TypeError: value.getTime is not a function
    at formatValue (util.js:599:32)
    at inspect (util.js:336:10)
    at Object.formatWithOptions (util.js:190:12)
    at Console.(anonymous function) (console.js:186:15)
    at Console.log (console.js:197:31)
    at Object.<anonymous> (/Users/anto/programs/node/node-hack/date.js:1:71)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)

The same code works on master though.

cc @BridgeAR

Metadata

Metadata

Assignees

No one assigned

    Labels

    utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions