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

[BUG]: MySQL date column has incorrect timezone conversion #1442

Open
robreiss opened this issue Oct 30, 2023 · 0 comments
Open

[BUG]: MySQL date column has incorrect timezone conversion #1442

robreiss opened this issue Oct 30, 2023 · 0 comments
Assignees
Labels
bug Something isn't working db/mysql priority Will be worked on next

Comments

@robreiss
Copy link

robreiss commented Oct 30, 2023

What version of drizzle-orm are you using?

0.28.6

What version of drizzle-kit are you using?

0.19.13

Describe the Bug

The MySQL "date" handling does not correctly translate in and out from the mysql2 driver. This can cause dates to be a day off between input and output from the database. The "datetime" MySQL data type had been fixed earlier by the PR 1082, the PR associated with this bug does the same for the MySQL "Date" type.

Running the tests while having the ava test runner in timezone "America/Los_Angeles" will cause the test 'insert + select all possible dates' to fail. When the date inserted is new Date('2022-11-11') then when the column is selected out the date can be a day off. i.e. new Date('2022-11-10')

"test:tz": "TZ='America/Los_Angeles' ava tests/mysql.test.ts --timeout=60s --serial --match='*possible dates' --match='*timezone'",

Expected behavior

A date inserted into a MySQL date column will be the same day as when retrieved via select.

Environment & setup

MySQL

@robreiss robreiss added the bug Something isn't working label Oct 30, 2023
@Angelelz Angelelz self-assigned this Dec 15, 2023
@L-Mario564 L-Mario564 added db/mysql priority Will be worked on next labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working db/mysql priority Will be worked on next
Projects
None yet
Development

No branches or pull requests

3 participants