-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
[BUG]: defaultNow()
in date
mode should save new Date()
#1148
Comments
gt
does not work correctly with timestamps
This issue was discussed in discord here: https://discord.com/channels/1043890932593987624/1146453658813333514 It looks like the conversion to a JS Date object loses precision and as such breaks expected behavior. I don't know if there's a straightforward fix to this, but as a direct course of action, I'd suggest pointing this behavior out in the docs - "Date" mode is less precise and can lead to unexpected results. |
A few more thoughts on this. The only real issue here is the behavior of Having said that: in current iteration, I would classify this as a bug rather than a limitation. |
gt
does not work correctly with timestampsdefaultNow()
in date
mode should save new Date()
I've looked at the internals for this and I think this can be fairly easily fixed but since it is a change that needs to be made across several drivers and probably need to juggle around some baseclasses I feel like I'm not going to be able to produce a satisfying result. Basically there are two steps:
|
This issue should be closed by #1659. |
What version of
drizzle-orm
are you using?Latest
What version of
drizzle-kit
are you using?No response
Describe the Bug
gt
in combination with timestamp returns wrong result.Expected behavior
gt
should not behave likegte
when used with timestamps. Might be true forlt
, too, I haven't checked.I have also tested with sql`` and same result:
Also, this only happens with
mode: 'date'
(default),mode: 'string'
works fineThe text was updated successfully, but these errors were encountered: