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

[MySQL] Treat MySQL date as utc to fix timezone bug #1443

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robreiss
Copy link

Pull request to fix bug #1442

Copy link
Collaborator

@Angelelz Angelelz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good

@OwenVey
Copy link

OwenVey commented May 26, 2024

Any reason this hasn't been added yet? Looks like the same logic is already in place for MySQL. Right now, the date type in Postgres with { mode: 'date' } is unusable as the mapped Date() object on the consumer side is a day earlier.

@Sparticuz
Copy link

Sparticuz commented Feb 10, 2025

I'm not sure this is what should be done. MySQL doesn't store the time in a DATE field, so when I select BETWEEN "2024-05-01 04:00:00.000" AND "2024-06-01 03:59:59.999" for example, it does not return rows where the date value is "2024-05-01" (both with and without this patch).

In my example, BETWEEN "2024-05-01 04:00:00.000" AND "2024-06-01 03:59:59.999" should go to BETWEEN "2024-05-01" AND "2024-05-31" Just dropping the Z doesn't work.

I'm really not sure how to solve this without either going to string mode, or accounting for time zones in drizzle.

EDIT: After writing this, I realized it may be my dev machine having a timezone and when I specify that the node process is UTC it seems to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants