drizzle-team / drizzle-team/drizzle-orm
[BUG]: Wrong timezone conversion and mode not working when using Bun SQL
- 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.40.0
### What version of `drizzle-kit` are you using?
0.30.5
### Other packages
bun@1.2.4
### Describe the Bug
When using `timestamp` with `bun-sql`, `date` mode is returning the date with my local timezone not in UTC.
Also, `string` mode it's returning a Date constructor.
### **Steps to reproduce it:**
```ts
import { drizzle } from 'drizzle-orm/bun-sql';
import { timestamp } from 'drizzle-orm/pg-core';
createdAt: timestamp('created_at').notNull().defaultNow(),
```
**Value in Drizzle Studio:**
**Value after query:**
`2025-03-24T19:53:17.000Z`
### Expected behavior
The value should return the UTC time (`2025-03-24T22:53:17.725Z`), like other drivers.
Example using `drizzle-orm/node-postgres`:
---
The other problem that is occurring is that when using `mode: string`, it is still returning a Date constructor.
**Fun fact:** the date is returning with the correct time zone in this mode 😄
### **Steps to reproduce it:**
```ts
createdAt: timestamp('created_at', { mode: 'string' }).notNull().defaultNow(),
```
**Value after query:**
### Expected behavior
The value should return a string. Following is an example using `drizzle-orm/node-postgres`.
Contributor guide
Assessment
This issue has not been assessed yet.