8000 Date values on query results are not `instanceof Date` · Issue #1246 · morintd/prismock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Date values on query results are not instanceof Date #1246

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

Open
thw0rted opened this issue Feb 17, 2025 · 4 comments
Open

Date values on query results are not instanceof Date #1246

thw0rted opened this issue Feb 17, 2025 · 4 comments

Comments

@thw0rted
Copy link

Reproduction here

When creating a new record from a model with columns defined as DateTime, actual Date instances are created. But when querying the same record afterwards, a copy of the date is created which has similar methods but does not pass instanceof Date. This breaks libraries that rely on instanceof check to determine how to handle date/time values, like class-transformer.

@monktastic
Copy link

I think I'm having a related problem: where clauses against DateTime fields don't operate as expected (they never match anything).

@thw0rted
Copy link
Author
thw0rted commented Mar 4, 2025

Is your DateTime where clause using range filtering (gt / gte etc) or looking for exact values? Maybe you could fork my repro with an example.

@monktastic
Copy link

@thw0rted It's using gt. I'm completely new to prismock (and prisma and the entire tool chain) so I don't think I'll be able to spend the time reproducing it, unfortunately. What I can say, however, is that (1) this worked in version 1.33.6, and (2) by removing the where clause and inspecting the date field, I can confirm that it should match. I'm just guessing that it's the same bug as yours, but I'm not 100% sure.

@monktastic
Copy link

Actually I think I'm wrong, and my actual bug is #1263

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

2 participants
0