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

new Date(number) throws TypeError: Bind must be called on a function #223

Open
jer-sen opened this issue Dec 5, 2021 · 5 comments
Open

Comments

@jer-sen
Copy link

jer-sen commented Dec 5, 2021

Hello,

When calling new Date(1234) I get this error:

TypeError: Bind must be called on a function

I would expect just to get a Date with valueOf returning 1234.

@NeilFraser
Copy link
Owner

Can't recreate. My steps:

Actual result:
An alert with "Wed Dec 31 1969 16:00:01 GMT-0800 (Pacific Standard Time)"

What steps are you using to get this error?

@jer-sen
Copy link
Author

jer-sen commented Dec 6, 2021

Just install js-interpreter npm module with npm install js-interpreter, then run node command in a terminal and then this JS code: (new (require('js-interpreter'))("new Date(1234)")).run();.
You should get the error TypeError: Bind must be called on a function.

@NeilFraser
Copy link
Owner

Got it. This bug was previously raised and fixed in #218. Looks like the js-interpreter package you are using needs to be updated. Not sure whom to ping regarding that.

@jer-sen
Copy link
Author

jer-sen commented Dec 23, 2021

The npm package seems abandoned :( https://www.npmjs.com/package/js-interpreter

It is downloaded 3100 times a week. You don't want to publish your project on npm?

@aminmarashi
Copy link
Contributor

@jer-sen @NeilFraser I have updated the package, sorry if this has been misleading, but the NPM package points to my repo which has this one as a submodule and publishes the package from there, I'll keep an eye on issues here in case the package related requests come up here.

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

3 participants