drizzle-team / drizzle-team/drizzle-orm
[BUG]: MySQL date column has incorrect timezone conversion
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### 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](https://github.com/drizzle-team/drizzle-orm/pull/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
Contributor guide
Assessment
This issue has not been assessed yet.