-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Change instanceof(Date) to util.types.isDate(Date) #2862
base: master
Are you sure you want to change the base?
Conversation
Thanks Srayman - is there a way you could include a unit/integration test for this? I often make tests for particular github issues here: https://github.com/brianc/node-postgres/tree/master/packages/pg/test/integration/gh-issues |
I'll have to think about how to setup the Date object to properly test it. We're using a custom Rust library currently in our project and where this problem originated from. I'm looking to see if there's an easy way to recreate the issue natively in JS/TS. If you have any thoughts I'm open to suggestions on how to create a Date that is not an instance of Date. |
vm.runInNewContext('new Date()') should do it, IIRC |
Awesome, did not know about |
Any feedback on this @brianc ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package change looks good to me!
The test could be improved, but so could a lot of other tests. I think it’s fair to take care of it along with those :)
Oh, I forgot pg still declares support for Node 8 (#2865). I don’t think |
Fixes #2860. isDate handles additional cases where a Date object may not be an instance of Date. This impacts whether a date is correctly formatted with the correct timezone for the database.