drizzle-team / drizzle-team/drizzle-orm

[BUG]: Union doesn't respect date modes

Open
#4,189 1 comment 0 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta priority qb/crud qb/set-operators
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.28.1

### Other packages

_No response_

### Describe the Bug

When wrapping a query in a `union()`, dates no longer return as JS date objects and instead return as strings.

E.g.

```
const recipesQuery = db
.select({
id: recipes.id,
publishedAt: recipes.publishedAt,
})
.from(recipes)
```

returns

```
{
id: '01953edb-7101-77be-8c4b-8c7bf1035cff',
publishedAt: 2025-02-25T20:45:23.578Z, // Notice no quotations - js date object
},
```

But

```
// creatorsQuery is a query with same shape as recipesQuery
const unionQuery = union(creatorsQuery, recipesQuery);
```

returns

```
{
id: '01953edb-7101-77be-8c4b-8c7bf1035cff',
publishedAt: '2025-02-24 01:25:54.62+00', // Notice now there are quotations
},
```

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.