drizzle-team / drizzle-team/drizzle-orm

[BUG]: Wrong timezone conversion and mode not working when using Bun SQL

Open
#4,311 2 comments 7 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta driver/bun-sql priority qb/crud
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:**
Image

**Value after query:**
`2025-03-24T19:53:17.000Z`

Image

### Expected behavior
The value should return the UTC time (`2025-03-24T22:53:17.725Z`), like other drivers.

Example using `drizzle-orm/node-postgres`:

Image

---
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:**
Image

### Expected behavior
The value should return a string. Following is an example using `drizzle-orm/node-postgres`.

Image

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.