Prisma Client is unable to fetch DateTime lists
See original GitHub issueBug description
Prisma Client is unable to fetch DateTime lists
How to reproduce
Use this schema:
generator client {
provider = "prisma-client-js"
}
datasource ds {
provider = "postgresql"
url = "postgresql://siddhant@localhost:5432/experiments" // Replace
}
model User {
id Int @id
dateTimeList DateTime[]
}
& use this script:
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const main = async () => {
await prisma.user.create({
data: {
id: 1,
dateTimeList: {
set: [
new Date().toISOString(),
new Date().toISOString(),
new Date().toISOString(),
],
},
},
});
console.log(
await prisma.user.findMany({
where: {
id: 1,
},
})
);
};
main()
.catch(async (e) => console.log(e))
.finally(async () => {
await prisma.$disconnect();
});
The output of this script is:
[ { id: 1, dateTimeList: Invalid Date } ]
Expected behavior
Expected output:
[ { id: 1, dateTimeList: [
"2020-09-03T20:28:05.886Z"
"2020-09-03T20:28:05.886Z",
"2020-09-03T20:28:05.886Z"
] } ]
Actual data in the DB seems to be correct AFAICT:
Environment & setup
- OS: macOS
- Database: PostgreSQL
- Node.js version: v12.16.3
- Prisma version:
@prisma/cli : 2.6.1
Current platform : darwin
Query Engine : query-engine 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine : migration-engine-cli 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary : prisma-fmt 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio : 0.272.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Prisma Client is unable to fetch DateTime lists · Issue #3517
Bug description Prisma Client is unable to fetch DateTime lists How to reproduce Use this schema: generator client { provider ...
Read more >Prisma Client API (Reference)
Lets you order the returned list by any property. select, UserCountAggregateInputType, No, Select which fields to count (non- null values) - you can...
Read more >Prisma 2 unable to fetch DateTime column with null value
At the fee_start_month column, some of the values are null so prisma2 unable to fetch those records, and It's thrown an exception. Generated ......
Read more >How to Build a Fullstack App with Next.js, Prisma, and ...
Before you can access your database from Next.js using Prisma, you first need to install Prisma Client in your app. You can install...
Read more >End-to-end type safety with Next.js, Prisma, and GraphQL
npm install graphql nexus graphql-scalars @prisma/client ... a lightweight library that provides React Hooks for handling data fetching.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just tried this, and it seems to be working as expected now, closing!
cc @Jolg42 @timsuchanek