drizzle-team / drizzle-team/drizzle-orm

[BUG]:Timezone of Date wrongly converted when saving

Open
#4,593 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.41.0

### What version of `drizzle-kit` are you using?

0.30.6

### Other packages

_No response_

### Describe the Bug

I have a JS Date object which I would like to save into a Postgres Date Column. The JS Date is in my local timezone (GMT+2), time is 00:00. When I save this date into the DB, the date before will be saved.
I would expect to have my local date saved.
After reading to code I suspect that the conversion from date to string via toISODate() is responsible for this. Because after conversion to ISO datetime shows the last day in UTC.

More system info:
- Postgres 17 in docker container
- postgres package as DB driver

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.