Comments (2)
Same Issue !!!
Model definition
model Entity {
...
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
...
}
MySQL DDL
CREATE TABLE `entities` (
...
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
...
);
Prisma Version
...
"@prisma/client": "^5.13.0",
"prisma": "^5.13.0",
...
Edit
It turn's out there's no bug in the first place. I'm currently using Prisma in Remix and I totally forgot that the data I received on my component/frontend code actually crossed between server and client, hence, the datetime field on the server part (which is actually a native Date) gets serialized when received on frontend code.
I'm not so sure if that might also be the case for your @JoaoVitorLima242 .
from prisma.
Hi @drichardcarl.
Technicality, but Prisma does not return DateTime
fields as strings, but rather, as JS Date
objects which don't store the timezone. Non-UTC dates is one of the Prisma's weak spot which we are very well aware of and hope to fix one day.
If I understood correctly, in your case you always want to format the dates in GMT-3:00
. If that's the case, result
extension might provide some releif:
const prisma = new PrismaClient().$extends({
result: {
User: {
createdAt: {
needs: ['createdAt'],
compute: (user) => formatInTheRightTimzone(user.createdAt)
}
}
}
})
from prisma.
Related Issues (20)
- createManyAndReturn for Microsoft SQL Server
- Prisma generate option --allow-no-models doesn't work. HOT 1
- Truncate all tables and reset IDs HOT 1
- cannot create databases migrations on Windows HOT 2
- Create a DATABASE Import Export Option in Prisma Studio
- called `Option::unwrap()` on a `None` value HOT 4
- please make generate cli for multischema 제발
- createManyAndReturn include do not work with relations defined on other table HOT 1
- [SQLite] Bug in `prismaSchemaFolder`: Incorrect Database File Generation and Missing Table Error HOT 1
- Selection with `_count: undefined` not working properly HOT 3
- No more enums generated HOT 1
- Create only is applying the migration
- Generic Types for Abstraction HOT 1
- Multi scheme for multi tenant architecture HOT 3
- API Key validations started failing over the last 24h HOT 1
- One model to multiple database schemas for multi-tenancy HOT 2
- @prisma/client is not in the npm registry, or you have no permission to fetch it.
- ConnectorError: 42P05 occurs frequently HOT 9
- Prisma relation query and connect behave strangely with composite relations
- prisma difficulty with accelerate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma.