-
-
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]: Inconsistencies when working with timestamps and corresponding datetime objects in javascript. #1176
Comments
Enabling After enabling that option both Also one thing to mind is that javascript date cannot represent the datetime information upto the last 3 microseconds like most databases do. When datetime information is retrieved from the database information pertaining to last 3 microseconds of the timestamp is lost. So, it's probably better to use |
For MySQL this line in the mysql-core datetime column may be problematic? It just adds 'Z' and assumes the returned date is UTC, but MySQL does not change the timezone by itself to UTC when just selecting a datetime field. This maybe problematic if these dates are parsed to ISO and returned to a client, which will interpret the datetime ias UTC. This results in logic date erros for example when someone compares the date to local "now". |
Should be fixed in I plan to release it in version |
Fixed in Please check release notes for more info |
What version of
drizzle-orm
are you using?0.28.5
What version of
drizzle-kit
are you using?0.19.13
Describe the Bug
Here are my findings:-
When mode: "date" is used the last 6 digit microseconds information is lost from the datetime object received in javascript after querying the database. The datetime information up till the seconds is retained in the corresponding javascript date object.
When mode: "string" is used microseconds information upto starting 3 digits are retained in the datetime object received after querying the database. The datetime information in the corresponding javascript object is mutated to be 5 hours 30 mintues behind of what's stored in the database. I'm not passing any custom configuration for this mutation to take place and also my timezone is ahead of UTC not behind so this doesn't make sense.
Expected behavior
The microseconds information should be retained when using mode: "date" with timestamps and accurate datetime information should be retained in the corresponding javascript date object when using mode: "string" with timestamps.
Environment & setup
OS: Fedora Linux 38 (Workstation Edition) x86_64
Kernel: 6.4.13-200.fc38.x86_64
Node version: 18.17.1
The text was updated successfully, but these errors were encountered: