Hi there, I’m a new-comer by Prisma, I have a ques...
# orm-help
a
Hi there, I’m a new-comer by Prisma, I have a question related to
date
type using
nestjs
app with
prisma
and using
postgresql
as
db
. I opened this discussion on prisma’s github for further details on the question. Basically I’m struggling to understand what
date object
to pass to the
this.prisma.user.create({ data: {date: XXX}})
. I define the field
date
as
DateTime @db.Date
in thet prisma schema. But
Postgresql
wants a date object with format
'YYYY-MM-DD',
but I’m in a
nestjs
app, I can’t pass a string, since prisma is expecting a date object. If I do sth like
new Date()
with whatever format, like iso and so on, it stills doesn’t correspond to the
'YYYY-MM-DD'
, I can only obtain this if I pass a string, but then prisma complains. Could someone guide me on that topic? In the docu I just found this, but this just works purely with postgresql, not with the prisma client. Thanks!
👀 1
n
Hey Albert 👋 We have this GitHub Issue: #4355, which discusses allowing only dates of format
YYYY-MM-DD
For now, you could use string datatype to store the date literal, or you could use this middleware which converts the date before sending the response to the client.
v
👋 Hello @Albert Montolio - did you have a chance to see Nurul's comment? Let us know if you still need help!