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

Setting null prototype to Date object results error #25145

Closed
antsmartian opened this issue Dec 20, 2018 · 4 comments
Closed

Setting null prototype to Date object results error #25145

antsmartian opened this issue Dec 20, 2018 · 4 comments
Labels
util Issues and PRs related to the built-in util module.

Comments

@antsmartian
Copy link
Contributor

  • 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

@devsnek
Copy link
Member

devsnek commented Dec 20, 2018

we should be using Date.prototype.getTime.call(value), like we do with regex etc

@antsmartian antsmartian added the util Issues and PRs related to the built-in util module. label Dec 20, 2018
@BridgeAR
Copy link
Member

This could potentially be backported but I don't think we need an issue for it. There are lots of cases like that in 10 and it's not limited to dates.
Please feel free to reopen if you think this should stay open.

@antsmartian
Copy link
Contributor Author

Is there any other place where we are tracking the other issues (as you had mentioned). Or we can add a backport label on the PR which already in master, which fixes the issue?

@BridgeAR
Copy link
Member

No, there's no tracking issue. Backports are done automatically but some of these changes might have been done in a semver-major commit or might not yet been backported due to lots of conflicts. In the latter case the label will normally be applied by the person who found that there are to many conflicts to fix those easily for a release and we have to do those manually.

You could check where this change was done by looking at git blame and then checking the PR in which those changes have been made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
util Issues and PRs related to the built-in util module.
Projects
None yet
Development

No branches or pull requests

3 participants