drizzle-team / drizzle-team/drizzle-orm
[BUG]: Union doesn't respect date modes
- 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
Assessment
This issue has not been assessed yet.