P
Prisma3mo ago
Diego

Prisma not recognizing Date-only values

I have a DateTime field with @db.Date annotation, but it still expects me to pass a full ISO 8601 date+time string. The model:
model Usuario {
id Int @id @default(autoincrement())

nome String @db.VarChar(80)
email String @db.VarChar(100)
telefone String? @db.VarChar(20)
dataNascimento DateTime? @db.Date
}
model Usuario {
id Int @id @default(autoincrement())

nome String @db.VarChar(80)
email String @db.VarChar(100)
telefone String? @db.VarChar(20)
dataNascimento DateTime? @db.Date
}
The error:
PrismaClientValidationError:

Invalid `prisma.usuario.create()` invocation:

{

data: {

email: "?????",

senha: "$2b$10$NA1r0R9HHOBql7TIyPP6me6cp2xln.zsdwN4ITAKhlBXJ2nX2ZMp.",

nome: "DIEGO",

dataNascimento: "1995-01-01",

~~~~~~~~~~~~

codigoAtivacao: "YWNlOTdlMjQtMDM4My00MTBhLWI1MjgtN2NlZTA2ODNlNWVi"

}

}

Invalid value for argument `dataNascimento`: premature end of input. Expected ISO-8601 DateTime.
PrismaClientValidationError:

Invalid `prisma.usuario.create()` invocation:

{

data: {

email: "?????",

senha: "$2b$10$NA1r0R9HHOBql7TIyPP6me6cp2xln.zsdwN4ITAKhlBXJ2nX2ZMp.",

nome: "DIEGO",

dataNascimento: "1995-01-01",

~~~~~~~~~~~~

codigoAtivacao: "YWNlOTdlMjQtMDM4My00MTBhLWI1MjgtN2NlZTA2ODNlNWVi"

}

}

Invalid value for argument `dataNascimento`: premature end of input. Expected ISO-8601 DateTime.
What should I do? Am I doing something wrong? (I just migrated from Sequelize, so I'm quite new to Prisma)
1 Reply
Diego
Diego3mo ago
🤷‍♂️ Seriously? No fix for this?